You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sathya Sankar <sa...@yahoo.com> on 2004/12/09 21:16:16 UTC

Document Literal Wrapped Response from Axis

I'm trying to understand how the response messages are formatted for a Document Literal service. I have attached the WSDL I'm working with.
 
The request that gets sent (using the Axis test client) looks good to me. The "Data" gets wrapped into "RequestData" and goes out. 

 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body>
<RequestData xmlns="http://www.your-company.com/Test-PC.xsd1">
     <Data/>
</RequestData>
</soapenv:Body></soapenv:Envelope>
 

But the response that Axis sends back is 
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<RequestDataResponse xmlns="http://www.your-company.com/Test-PC.xsd1">
   <Response>250</Response>
</RequestDataResponse>
</soapenv:Body></soapenv:Envelope>
 
Basically, the "Response" gets wrapped into an element "RequestDataResponse" and gets
sent out.
 
The Axis client deals with this response fine and I'm able to parse the response. But
I'm trying to make a Document/Literal Wrapped service hosted in Axis 1.2 RC to talk to a 
client build using "Systinet" toolkit and the extra response wrapper ("RequestDataResponse") throws the client toolkit off since it doesn't know about it. 
 
The stubs generated in Systinet using the WSDL does not have any classes of type RequestDataResponse and it blows up trying to parse the response.
 
Is this an issue with Axis or is this how the response is supposed to work ? Does anybody know of work arounds or any switches to turn on/off that would get me past this issue. 
 
Would really appreciate any insights/suggestions on this issue.
Thanks!



		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - Find what you need with new enhanced search. Learn more.

Re: Document Literal Wrapped Response from Axis

Posted by Michael Schuerig <mi...@schuerig.de>.
On Thursday 09 December 2004 21:16, Sathya Sankar wrote:
> I'm trying to understand how the response messages are formatted for
> a Document Literal service. I have attached the WSDL I'm working
> with.
>
> The request that gets sent (using the Axis test client) looks good to
> me. The "Data" gets wrapped into "RequestData" and goes out.
>
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body>
> <RequestData xmlns="http://www.your-company.com/Test-PC.xsd1">
> <Data/>
> </RequestData>
> </soapenv:Body></soapenv:Envelope>
>
>
> But the response that Axis sends back is
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body>
> <RequestDataResponse
> xmlns="http://www.your-company.com/Test-PC.xsd1">
> <Response>250</Response>
> </RequestDataResponse>
> </soapenv:Body></soapenv:Envelope>
>
> Basically, the "Response" gets wrapped into an element
> "RequestDataResponse" and gets sent out.

Yes, that's exactly as it's supposed to be with a wrapped service. The 
request body is wrapped in <MethodName>...</MethodName>, the response 
body is wrapped in <MethodNameResponse>...</MethodNameResponse>. That's 
what makes it wrapped. Also, as far as I remember, if you don't 
explicitly say what kind of service you have, Axis uses this naming 
convention to sense if your document-style service is actually 
wrapped-style.

As a matter of style I don't like wrapped-style WSDL definitions. I'm 
just a newbie, though, so my opinion doesn't have that much weight. If 
explicitly-specified wrapped-style isn't mandated by interoperability, 
I would avoid it. In my current (toy) case, I have a plain 
document/literal WSDL definition, but I tell Axis on both ends to 
actually wrap messages so that I get wrapped-style on the wire.

On the server-side, my service is defined like this

  <service name="MyService" provider="java:RPC" style="wrapped" 
use="literal">
    ...
  </service

And on the client-side, in my hand-written code, I explicitly call

  call.setOperationStyle(Style.WRAPPED);

wsdl2java puts equivalent code in its generated ...BindingStubImpl 
classes, unless support for wrapped is explicitly turned of with 
--noWrapped.

Michael

-- 
Michael Schuerig                      They tell you that the darkness
mailto:michael@schuerig.de                  Is a blessing in disguise
http://www.schuerig.de/michael/           --Janis Ian, From Me To You

Re: Document Literal Wrapped Response from Axis

Posted by Sathya Sankar <sa...@yahoo.com>.
Tony/Michael,
 
"I don't think wrapped has any effect on the response and only an effect on the server side of the request." 
 
This was exactly my impression too but Axis seems to be adding an extra layer of wrapping, that too with the name "methodName"Response (like Michael was mentioning in the previous email). My concern is, this is not the interpretation by other toolkits (atleast Systinet) and they blow up because they don't understand the "response" wrapper from Axis.
 
The WSDL definition for the types & messages is
 
            <xsd:element name="Response" type="xsd:int"/>
            <xsd:element name="ResponseData">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element maxOccurs="1" minOccurs="0" ref="xsd1:Response"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="ResponseData">
        <wsdl:part element="xsd1:ResponseData" name="name"/>
    </wsdl:message>
    <wsdl:message name="RequestData">
        <wsdl:part element="xsd1:RequestData" name="name"/>
    </wsdl:message>

    <wsdl:portType name="TestPCPortType">
        <wsdl:operation name="RequestData">
            <wsdl:input message="tns:RequestData"/>
            <wsdl:output message="tns:ResponseData"/>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="TestPCBinding" type="tns:TestPCPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="RequestData">
            <soap:operation
                soapAction="capeconnect:TestPC:TestPCPortType#RequestData"
                style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

 
In Axis, the only data structure Axis created is "Data". On the request side (using Axis test client), I can see the "Data" element getting wrapped into "RequestData" (which is what the WSDL specifies) and that looks fine. But on the response side, I exect only the "Response" tag to go out and it basically gets wrapped into "RequestDataResponse" tag and gets sent out. 
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <RequestDataResponse xmlns="http://www.your-company.com/Test-PC.xsd1">
   <Response>250</Response>
  </RequestDataResponse>
 </soapenv:Body>
</soapenv:Envelope>
 
The "RequestDataResponse" is not in the WSDL and Systinet client blows up with the Exception:
 

INFO: com.systinet.wasp.validator.serialization.ProxyDeSerializerHelper - instantiation of com.systinet.wasp.validator.serialization.ValidatingSerializer failed, if validations are required, they will be ommited

java.lang.reflect.UndeclaredThrowableException

at $Proxy53.RequestData(Unknown Source)

at com.sathya.client.TestPCClient.main(TestPCClient.java:34)

Caused by: org.idoox.xmlrpc.MessageProcessingException: Unknown element {http://www.your-company.com/Test-PC.xsd1}RequestDataResponse

at org.idoox.wasp.wsdl.SOAPMethodInfo$RequiredElements$Invocation.notNillElement(SOAPMethodInfo.java:1052)

at com.systinet.wasp.rpc.WaspCallImpl.deserializeFromXml(WaspCallImpl.java:1452)

at com.systinet.wasp.rpc.WaspCallImpl.readResponse(WaspCallImpl.java:1270)

at com.systinet.wasp.rpc.WaspCallImpl.deserializeResponse(WaspCallImpl.java:1073)

at com.systinet.wasp.rpc.WaspCallImpl.invoke(WaspCallImpl.java:509)

at com.systinet.wasp.rpc.WaspCallImpl.invoke(WaspCallImpl.java:454)

at com.systinet.wasp.client.ClientProxy._invoke(ClientProxy.java:454)

at com.systinet.wasp.client.ClientProxy.invoke(ClientProxy.java:112)

... 2 more

INFO: com.systinet.wasp.WaspImpl - Stopping Systinet WASP Server for Java/5.0 (Java/1.4.2_03; Windows 2000/5.0)

The only way I'm able to make both the toolkits talk is by explicitly defining the element "RequestDataResponse" and by sending that as the response. That way, Systinet also knows about it and expects it. 
I didn't think I had to do that. If you guys think it is a bug I can log it in.
 
Thanks for all the responses
Sathya


tony.q.weddle@gsk.com wrote:

I don't think wrapped has any effect on the response and only an effect on the server side of the request. The WSDL describes exactly what goes on the wire, so wrapped is a convention for Axis (and some other toolkits) that allows it to unwrap the request message one level and use the child elements to form the parameters for a call to the actual service. On the return message, the message should be formatted exactly as the WSDL states; there is no need for wrapping, or else the client would not get what was expected. 

Did WSDL2Java generate a RequestDataResponse class? This would surprise me, as I've never seen a class generated for the outside element. Notice, though, that the name of the outer response element that you get back from the service (RequestDataResponse) doesn't match the WSDL (ResponseData). Is the Web service doing its own thing? 

What exactly is the error that you get from the Systinet client?

Tony 

"Sathya Sankar" <sa...@yahoo.com> wrote on 09/12/2004 20:16:16:

> I'm trying to understand how the response messages are formatted for
> a Document Literal service. I have attached the WSDL I'm working with. 
>   
> The request that gets sent (using the Axis test client) looks good 
> to me. The "Data" gets wrapped into "RequestData" and goes out. 
>   
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> " xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:
> //www.w3.org/2001/XMLSchema-instance"><soapenv:Body>
> <RequestData xmlns="http://www.your-company.com/Test-PC.xsd1">
>      <Data/>
> </RequestData>
> </soapenv:Body></soapenv:Envelope> 
>   
> 
> But the response that Axis sends back is 
>   
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> " xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:
> //www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <RequestDataResponse xmlns="http://www.your-company.com/Test-PC.xsd1">
>    <Response>250</Response>
> </RequestDataResponse>
> </soapenv:Body></soapenv:Envelope> 
>   
> Basically, the "Response" gets wrapped into an element 
> "RequestDataResponse" and gets
> sent out. 
>   
> The Axis client deals with this response fine and I'm able to parse 
> the response. But
> I'm trying to make a Document/Literal Wrapped service hosted in Axis
> 1.2 RC to talk to a 
> client build using "Systinet" toolkit and the extra response wrapper
> ("RequestDataResponse") throws the client toolkit off since it 
> doesn't know about it. 
>   
> The stubs generated in Systinet using the WSDL does not have any 
> classes of type RequestDataResponse and it blows up trying to parse 
> the response. 
>   
> Is this an issue with Axis or is this how the response is supposed 
> to work ? Does anybody know of work arounds or any switches to turn 
> on/off that would get me past this issue. 
>   
> Would really appreciate any insights/suggestions on this issue. 
> Thanks! 
> Do you Yahoo!?
> Yahoo! Mail - Find what you need with new enhanced search. Learn more.
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions
>     name="Test-PC"
>     targetNamespace="http://www.your-company.com/Test-PC.wsdl"
>     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>     xmlns:tns="http://www.your-company.com/Test-PC.wsdl"
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns:xsd1="http://www.your-company.com/Test-PC.xsd1">
>     <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/
> ">Created using Cape Clear Studio SOA Editor - http://www.capeclear.
> com</wsdl:documentation>
>     <wsdl:types>
>         <xsd:schema
>             targetNamespace="http://www.your-company.com/Test-PC.xsd1"
>             xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             xmlns:xsd1="http://www.your-company.com/Test-PC.xsd1">
>             <xsd:element name="Data">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> name="DataId" type="xsd:string"/>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> name="DataType" type="xsd:string"/>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> name="DataDate" type="xsd:string"/>
>                     </xsd:sequence>
>                 </xsd:complexType>
>             </xsd:element>
>             <xsd:element name="RequestData">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> ref="xsd1:Data"/>
>                     </xsd:sequence>
>                 </xsd:complexType>
>             </xsd:element>
>             <xsd:element name="Response" type="xsd:int"/>
>             <xsd:element name="ResponseData">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> ref="xsd1:Response"/>
>                     </xsd:sequence>
>                 </xsd:complexType>
>             </xsd:element>
>         </xsd:schema>
>     </wsdl:types>
>     <wsdl:message name="ResponseData">
>         <wsdl:part element="xsd1:ResponseData" name="name"/>
>     </wsdl:message>
>     <wsdl:message name="RequestData">
>         <wsdl:part element="xsd1:RequestData" name="name"/>
>     </wsdl:message>
>     <wsdl:portType name="TestPCPortType">
>         <wsdl:operation name="RequestData">
>             <wsdl:input message="tns:RequestData"/>
>             <wsdl:output message="tns:ResponseData"/>
>         </wsdl:operation>
>     </wsdl:portType>
>     <wsdl:binding name="TestPCBinding" type="tns:TestPCPortType">
>         <soap:binding style="document" transport="http://schemas.
> xmlsoap.org/soap/http"/>
>         <wsdl:operation name="RequestData">
>             <soap:operation
>                 soapAction="capeconnect:TestPC:TestPCPortType#RequestData"
>                 style="document"/>
>             <wsdl:input>
>                 <soap:body use="literal"/>
>             </wsdl:input>
>             <wsdl:output>
>                 <soap:body use="literal"/>
>             </wsdl:output>
>         </wsdl:operation>
>     </wsdl:binding>
>     <wsdl:service name="TestPC">
>         <wsdl:port binding="tns:TestPCBinding" name="TestPCPort">
>             <soap:address location="http://localhost:
> 8080/axis/services/TestPCPortType"/>
>         </wsdl:port>
>     </wsdl:service>
> </wsdl:definitions>

		
---------------------------------
Do you Yahoo!?
 Take Yahoo! Mail with you! Get it on your mobile phone.

Re: Document Literal Wrapped Response from Axis

Posted by to...@gsk.com.
I don't think wrapped has any effect on the response and only an effect on 
the server side of the request. The WSDL describes exactly what goes on 
the wire, so wrapped is a convention for Axis (and some other toolkits) 
that allows it to unwrap the request message one level and use the child 
elements to form the parameters for a call to the actual service. On the 
return message, the message should be formatted exactly as the WSDL 
states; there is no need for wrapping, or else the client would not get 
what was expected. 

Did WSDL2Java generate a RequestDataResponse class? This would surprise 
me, as I've never seen a class generated for the outside element. Notice, 
though, that the name of the outer response element that you get back from 
the service (RequestDataResponse) doesn't match the WSDL (ResponseData). 
Is the Web service doing its own thing?

What exactly is the error that you get from the Systinet client?

Tony

"Sathya Sankar" <sa...@yahoo.com> wrote on 09/12/2004 20:16:16:

> I'm trying to understand how the response messages are formatted for
> a Document Literal service. I have attached the WSDL I'm working with.
> 
> The request that gets sent (using the Axis test client) looks good 
> to me. The "Data" gets wrapped into "RequestData" and goes out. 
> 
> <soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> " xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:
> //www.w3.org/2001/XMLSchema-instance"><soapenv:Body>
> <RequestData xmlns="http://www.your-company.com/Test-PC.xsd1">
>      <Data/>
> </RequestData>
> </soapenv:Body></soapenv:Envelope>
> 
> 
> But the response that Axis sends back is 
> 
> <soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> " xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:
> //www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <RequestDataResponse xmlns="http://www.your-company.com/Test-PC.xsd1">
>    <Response>250</Response>
> </RequestDataResponse>
> </soapenv:Body></soapenv:Envelope>
> 
> Basically, the "Response" gets wrapped into an element 
> "RequestDataResponse" and gets
> sent out.
> 
> The Axis client deals with this response fine and I'm able to parse 
> the response. But
> I'm trying to make a Document/Literal Wrapped service hosted in Axis
> 1.2 RC to talk to a 
> client build using "Systinet" toolkit and the extra response wrapper
> ("RequestDataResponse") throws the client toolkit off since it 
> doesn't know about it. 
> 
> The stubs generated in Systinet using the WSDL does not have any 
> classes of type RequestDataResponse and it blows up trying to parse 
> the response.
> 
> Is this an issue with Axis or is this how the response is supposed 
> to work ? Does anybody know of work arounds or any switches to turn 
> on/off that would get me past this issue. 
> 
> Would really appreciate any insights/suggestions on this issue.
> Thanks!
> Do you Yahoo!?
> Yahoo! Mail - Find what you need with new enhanced search. Learn more.
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions
>     name="Test-PC"
>     targetNamespace="http://www.your-company.com/Test-PC.wsdl"
>     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>     xmlns:tns="http://www.your-company.com/Test-PC.wsdl"
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns:xsd1="http://www.your-company.com/Test-PC.xsd1">
>     <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/
> ">Created using Cape Clear Studio SOA Editor - http://www.capeclear.
> com</wsdl:documentation>
>     <wsdl:types>
>         <xsd:schema
>             targetNamespace="http://www.your-company.com/Test-PC.xsd1"
>             xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             xmlns:xsd1="http://www.your-company.com/Test-PC.xsd1">
>             <xsd:element name="Data">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> name="DataId" type="xsd:string"/>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> name="DataType" type="xsd:string"/>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> name="DataDate" type="xsd:string"/>
>                     </xsd:sequence>
>                 </xsd:complexType>
>             </xsd:element>
>             <xsd:element name="RequestData">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> ref="xsd1:Data"/>
>                     </xsd:sequence>
>                 </xsd:complexType>
>             </xsd:element>
>             <xsd:element name="Response" type="xsd:int"/>
>             <xsd:element name="ResponseData">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element maxOccurs="1" minOccurs="0" 
> ref="xsd1:Response"/>
>                     </xsd:sequence>
>                 </xsd:complexType>
>             </xsd:element>
>         </xsd:schema>
>     </wsdl:types>
>     <wsdl:message name="ResponseData">
>         <wsdl:part element="xsd1:ResponseData" name="name"/>
>     </wsdl:message>
>     <wsdl:message name="RequestData">
>         <wsdl:part element="xsd1:RequestData" name="name"/>
>     </wsdl:message>
>     <wsdl:portType name="TestPCPortType">
>         <wsdl:operation name="RequestData">
>             <wsdl:input message="tns:RequestData"/>
>             <wsdl:output message="tns:ResponseData"/>
>         </wsdl:operation>
>     </wsdl:portType>
>     <wsdl:binding name="TestPCBinding" type="tns:TestPCPortType">
>         <soap:binding style="document" transport="http://schemas.
> xmlsoap.org/soap/http"/>
>         <wsdl:operation name="RequestData">
>             <soap:operation
> soapAction="capeconnect:TestPC:TestPCPortType#RequestData"
>                 style="document"/>
>             <wsdl:input>
>                 <soap:body use="literal"/>
>             </wsdl:input>
>             <wsdl:output>
>                 <soap:body use="literal"/>
>             </wsdl:output>
>         </wsdl:operation>
>     </wsdl:binding>
>     <wsdl:service name="TestPC">
>         <wsdl:port binding="tns:TestPCBinding" name="TestPCPort">
>             <soap:address location="http://localhost:
> 8080/axis/services/TestPCPortType"/>
>         </wsdl:port>
>     </wsdl:service>
> </wsdl:definitions>