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:[EMAIL PROTECTED]                  Is a blessing in disguise
http://www.schuerig.de/michael/           --Janis Ian, From Me To You

Reply via email to