Wednesday, August 03, 2005

Validate or not validate: that is the question

Should we validate incoming and/or outgoing SOAP messages against a schema? Shouldn’t we be able to switch validation on and off on our Web Service platform level? I am just concern that, for example when using a JAX-PC platform the Web Service platform does successfully transform invalid SOAP messages in JAVA objects.
I wonder if AXIS does it, ideally that should be done by the Castor stack. I am pretty certain that .net has this type of feature. It would be good if somebody can confirm that.
Regarding WebSphere they claim that:

“If a WebSphere web services client is developed with the supported programming model, like JAX-RPC and SAAJ, the web services engine will not serialize the request across to be a malformed XML document--i.e., the SOAP message should be structured according to the WSDL's style and use, and that it should conform with the WSDL's schema. A WebSphere web service won't accept a malformed, non-schema-compliant request that is not compatible with the WSDL describing the service, and if that request is malformed, the web services engine should throw some kind of exception.”

I am doubtful as simply because on of my document/literal wrapped Web Service response SOAP body contains the following:
....

losssets type="soapenc:Array" arraytype="p416:comindLossSetBase[2]"

....
Knowing that the schema describing the SOAP body is as followed (this is only a relevant snippet);
....

element type="comind:CILossSetSet" name="lossSets"
complextype
complextype name="CILossSetSet"
sequence
element type="" name="lossSet"

....
The SOAP body doesn’t validate against the schema! I guess that I have found an issue with WebSphere. Unfortunately, I haven’t managed to replicate this problem with some mock WSDLs. So, as I cannot give away our corporate data to IBM I only hope that IBM will give us an answer without the sacrosanct “standalone reproducible test case”.

So, should we validate or not? I would say that we should always validate attachment and certainly validate the SOPA body when our Web Service is externally exposed.

PS: Sorry about my SOAP code but I didn’t find a way of displaying the chevrons.

0 Comments:

Post a Comment

<< Home