aspose file tools*
The moose likes Web Services and the fly likes Web services Input data validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web services Input data validation" Watch "Web services Input data validation" New topic
Author

Web services Input data validation

Janardhan Kotha
Greenhorn

Joined: Feb 01, 2006
Posts: 14
Hi,

In the wsdl, we had some constraints on the input data.

For eg:-
<xsd:element minOccurs="1" name="DomainID">
<xsd:simpleType>
<xsd:restriction base="int">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="999"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

Web services client & server are implemented in Java. Here the Client builds the DomainID java object and invokes an operation and passes DomainID. Code works fine even if the client sets a value i.e out of range from 0-999. Right now I am validating the data manually on the server side.

Since on the server side I am receiving java object as input, I can NOT use schema defined in WSDL for validation.

Does anyone of you know IF there is a way to inform SOAP Runtime dont send the soap message to the server if input is not valid as per the schema defined in WSDL??

Please share your thoughts on this.

Thanks,
Janardhan.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Janardhan Kotha:
Does anyone of you know IF there is a way to inform SOAP Runtime dont send the soap message to the server if input is not valid as per the schema defined in WSDL??


You haven't indicated which web service API (JAX-RPC, JAX-WS) and which Web service toolkit (Axis, Axis 2, Glassfish Apache CXF, etc.) you are using.

Many SOAP web service toolkits do not validate incoming documents against the schema for performance reasons. And if they did you would need to be able to configure how schema validation errors map to SOAP faults (which themselves need to appear in the WSDL).

So the only recourse is to develop a SOAP Message handler that validates the incoming document and then issue an appropriate SOAP fault if the validation fails.

Writing a Handler in JAX-WS
How to create a simple JAX-RPC handler
Janardhan Kotha
Greenhorn

Joined: Feb 01, 2006
Posts: 14
Thanks Peer Reynders.

We are using Websphere runtime for web services and JAX-RPC in client side.

Do you know by any chance if IBM has any option to enable the data validation by schema?

Thanks,
Janardhan.
Chris Graham (WarpSpeed)
Greenhorn

Joined: Feb 24, 2008
Posts: 1
Originally posted by Janardhan Kotha:
Thanks Peer Reynders.

We are using Websphere runtime for web services and JAX-RPC in client side.

Do you know by any chance if IBM has any option to enable the data validation by schema?

Thanks,
Janardhan.


Hello. I have exactly the same issue. Did you ever find a means of doing this?

Thanks.

-Chris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web services Input data validation