Hi Tim,

The "wrapped" style indicates a particular style of doing document/literal that 
emulates RPC.  This sounds a bit strange, but the best example of this is Microsoft 
.NET web services.  For document style, each message part is an element in the 
request.  For a wrapped style service, there is only a single message part, and its 
name is "parameters".  This part is defined to be an element, who's name is the same 
as the operation name.  This element then contains the parameters to the operation; 
the parameters are wrapped in an element.

Here is a .NET Hello World WSDL:

<s:element name="HelloWorld">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="message" type="s:string" /> 
  </s:sequence>
 </s:complexType>
</s:element>
<s:element name="HelloWorldResponse">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" /> 
   </s:sequence>
  </s:complexType>
</s:element>

<message name="HelloWorldSoapIn">
  <part name="parameters" element="s0:HelloWorld" /> 
</message>
<message name="HelloWorldSoapOut">
  <part name="parameters" element="s0:HelloWorldResponse" /> 
</message>

Here is what the SOAP request body looks like for this:

  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/";>
      <message>string</message>
    </HelloWorld>
  </soap:Body>

Contrast this to what Axis would generate for the same hello world service using 
rpc/encoded:

<message name="message" type="xsd:string">
<message name="HelloWorldResult" type="xsd:string">


The WSDL2Java tool recognizes this style of WSDL (in specific, by seeing a 
document/literal operation, with a single message part, named 'parameters') and goes 
in to wrapped mode.  This causes the stubs generated to 'peel back' a layer in the 
Schema types, and use the elements in the complextType (in our example, 
HelloWorldSoapIn) as the parameters to the generated stub function.  It also sets the 
style to "wrapped" in the Call object.

So what does Axis do when the document style is set to "wrapped"?  It treats the 
operation as an RPC operation, but it sends document style, literal encoded XML.  The 
net effect is pretty simple: first we turn of multirefs and xsi types.  Then we treat 
each of the parameters specified in the JAX-RPC Call object just like we would for RPC 
style, and we wrap the parameters in an element with a QName the same as the operation 
name.  This is OK, because the element specified in the WSDL has the SAME name as the 
operation (by definition).

Why do we go through this?  Because ALL .NET services are represented in WSDL by 
default in this 'wrapped' manner, so left to default behavior, Axis would generate 
stub code that would always have a single input JavaBean (in our example, 
HelloWorldSoapIn) and a single return value JavaBean (HelloWorldSoapOut).

So instead of this:
   String HelloWorld(String message)
you would get this:
   HelloWorldSoapOut HelloWorld(HelloWorldSoapIn parameters)

Which isn't very friendly.

Hope this helps clarify things a bit.  On rereading your original note, I realize you 
only asked about when WSDL2Java.  But I hope the extra info helps too.

--
Tom Jordahl
Macromedia



-----Original Message-----
From: Tim Blake [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 7:35 AM
To: [EMAIL PROTECTED]
Subject: Wrapped vs. Document


Hi,

Could someone explain the criteria used to decide whether a service is "wrapped" or 
"document" during the WSDL2Java process?  I've had a look through the source code, but 
couldn't find the pertinent information.

Many thanks,
Tim

Reply via email to