| Author |
WSDL validation using XSD
|
Shailendra Suryawanshi
Greenhorn
Joined: May 13, 2008
Posts: 9
|
|
Has anyone tried or implemented a solution that would validate incoming request using schema types defined in a WSDL doc ?
For e.g. Let's assume following method is exposed as a service and takes in a "partNumber" as an input string. Its simple type is defined with restriction.
public org.w3c.dom.Element getPartDetails(String partNumber);
Would proxy or server-side skeleton make sure that partNumber string can be of max 20 char and it can have one of two values specified ?
I wish to validate incoming SOAP request using XSD. or is there any alternate available?
|
Shailendra Suryawanshi<br /> <br />[SCJP 6]
|
 |
Peer Reynders
Bartender
Joined: Aug 19, 2005
Posts: 2906
|
|
Shailendra Suryawanshi wrote:Would proxy or server-side skeleton make sure that partNumber string can be of max 20 char and it can have one of two values specified?
Typically not because of performance reasons. The generated code parses "just enough" to make the translation to the implementation platform. So errors of that parsing process will be caught but fullblown validation or enforcements of constraints isn't implemented.
I wish to validate incoming SOAP request using XSD. or is there any alternate available?
You would typically implement that in a handler in the SOAP message chain. The handler can be deployed and removed independently from the service logic. If the validation fails the handler would generate a SOAP Fault and the service logic would never see the request. Validating document/literal messages would be slightly easier than rpc/literal; for document/literal messages the entire payload in the SOAP body can be validated via XML Schema, for rpc/literal you would have to isolate each parameter in the operation payload and validate them separately.
Which style of WSDL should I use?
|
"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
|
 |
 |
|
|
subject: WSDL validation using XSD
|
|
|