my dog learned polymorphism*
The moose likes Web Services and the fly likes what is the good/standard way to inform client  the parameter restriction/fomat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "what is the good/standard way to inform client  the parameter restriction/fomat" Watch "what is the good/standard way to inform client  the parameter restriction/fomat" New topic
Author

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

grace smith
Greenhorn

Joined: Jun 14, 2005
Posts: 23
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}"/>
</restriction>
</simpleType>

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

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.
 
jQuery in Action, 2nd edition
 
subject: what is the good/standard way to inform client the parameter restriction/fomat
 
Similar Threads
Web Service SimpleType restrictions?
java.io.IOException: Type {http://lang.java}Exception is referenced but not defined.
how to define SSN format in WSDL
web service function parameter format limitation and validatioin question
question on client side soap binding stub on wsdl complext type element