• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is the good/standard way to inform client the parameter restriction/fomat  RSS feed

grace smith
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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:

<simpleType name="socialSecurityNumber">
<restriction base="xsd:string">
<pattern value="\d{3}\d{2}\d{4}"/>

<element name="findBySSN">
<element name="SSN" nillable="true" type="intf:socialSecurityNumber"/>

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 ?

Appreciate any help.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!