This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Web services Input data validation

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic