what is the good/standard way to inform client the parameter restriction/fomat
posted 9 years ago
I posted couple messages but seems not big response. So I will simplify my question as this:
What is the good or standard way to implement the webservice so the ciient will know the rule of the data format so they can do the program validation at their side? I listed couple ways I tried, could anyone tell me any way better or is there any other or standard way?
1. I tried to define Simple Type for SSN retrct it as 9 digit without'-' or '/' and then derived the complex type as this in the wsdl:
it finally works but the simple Type defined in the WSDL will cause stub generated extra java Object like SocialSecurityNumber.java and I have to modify the SEI to change the passing in String ssn to Object SocialSecurityNumber SSN. that is painful.
2. do not define any restriction on the SSN, just simple xsd:string type,but define webservice application exception for bad SSN input and map the exception as the fault in the WSDL. This way, the client will see the fault detail and figure out the format for the SSN input requirement.
this way seems ease the webservice programming, but client have to wait till the run time to find out the ssn format.
3. Add document/comment in the wsdl for the restriction on some special element requirement ?