Q
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How will the Web service handle a SOAP request coming from a client which is not in the right format

How will the Web service handle a SOAP request coming from a client which is not in the right format? Will such requests be discarded? How should we equip the Web service to serve any kind of request coming in any format?

If a client sends an misformatted or invalid SOAP request, the service can reject the request and return a SOAP Fault. In such a situation, the SOAP Fault should indicate a fault code of "env:Client", and the service should provide additional information about the cause of the fault in the <detail> element in the SOAP Fault.

If you would like to equip your service to serve any kind of request, then you should define your service to accept an input message with a schema structure of <xsd:any>. For example, the WSDL input message would be described as follows:

<wsdl:message name="anyInput">

    <wsdl:part name="body" element="xsd:any"/>

</wsdl:message>

Note that this message structure is not WS-I compliant, and therefore I do not recommend that you define services this way. Also, this message definition provides no information to your potential clients as to what the proper format of an input message might be. It's always a better idea to define the expected format of your input messages in your WSDL document.

Also, you will need to use "message" style processing when building your service. When using this type of processing, your SOAP server does not process the SOAP Body. Instead it simply hands the application the SOAP message as a DOM, and your application must then process the DOM. (That's, of course, assuming that the message is in fact XML.)

I'm not sure that I see tremendous value in trying to make your service serve any kind of request. For example, if you provide a service that accept commercial retail orders, the input message should contain an XML document formatted according to your order schema. What would your service do if it received an input message containing an insurance claim?

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchSoftwareQuality

SearchAWS

SearchCloudComputing

TheServerSide.com

Close