<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns1:GetDetails xmlns:ns1="http://services.sample.com/Details">
<yup:GetDetails xmlns:yup="http://services.sample.com/yupment" xmlns:ent="http://services.sample.com/Common/Entities" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<yup:DetailsRequest>
Here <ns1:GetDetails is an extra element in the request, due to which it was failing the validation in the server side. I tried to find the root cause of why Xfire/Jibx is adding this extra element. Debugged the Xfire source and find the place where it is adding it and found out if "wrapped" is true it will add ns1 element to the request. I tried to find out where are we defining this wrapped flag. Mean while I noticed that the client wsdl is created by using microsoft tools. It gave me a wild guess of whether they are using any of so called "non standard" stuff.
Kept on reading so many article about WS styles and finally caught the attention of following snippet. Yeah .. thats right .. there is a 'non standard' microsoft stuff out there,document/literal wrapped pattern.
These are the basic characteristics of the document/literal wrapped pattern:
- The input message has a single part.
- The part is an element.
- The element has the same name as the operation.
- The element's complex type has no attributes.
So mastery solved..... By seeing the same element and operation name Xfire was creating the out going request as a wrapped one.
<wsdl:message name="AService_GetDetailsInfo_InputMessage">
<wsdl:part name="parameters" element="tns:GetDetailsInfo"/>
</wsdl:message>
</wsdl:message>
<wsdl:portType name="AService">
<!-- Changed from GetAccountInfo to GetDetailsInfoOp to avoid wrapped style;Hence do double request by Xfire!-->
<wsdl:operation name="GetDetailsInfoOp">
<wsdl:input wsaw:Action=
<wsdl:output wsaw:Action=
<wsdl:fault wsaw:Action=
<wsdl:fault wsaw:Action=
</wsdl:operation>
</wsdl:portType>
<!-- Changed from GetAccountInfo to GetDetailsInfoOp to avoid wrapped style; Hence do double request by Xfire!-->
<wsdl:operation name="GetDetailsInfoOp">
<soap:operation soapAction=
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
To read more about the pros and cones of Wrapped style as well as other styles go to:
Moral : Go back to the basics when ever you can ... Knowledge is power !!!!!
No comments:
Post a Comment