• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Understanding Wrapped and Unwrapped/Bare Document with Example

 
sandeep nanjegowda
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



I have two Web Services , DOCUMENT WRAPPED and DOCUMENT BARE ( interfaces given below ).

package math.service3;
@WebService
@SOAPBinding( parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface MathOperation {

@WebMethod
public int getRectangleArea(Rectangle rec);
}

package math.service;
@WebService
public interface MathOperation {

@WebMethod
public int getRectangleArea(Rectangle rectangle);
}

I have implemented , deployed and created sample requests in SOAPUI

request for WRAPPED

<soapenv:Body>
<ser:getRectangleArea>
<!--Optional:-->
<arg0>
<breadth>2</breadth>
<length>3</length>
</arg0>
</ser:getRectangleArea>
</soapenv:Body>

request for BARE

<soapenv:Body>
<ser:getRectangleArea>
<breadth>1</breadth>
<length>2</length>
</ser:getRectangleArea>
</soapenv:Body>

QUESTION 1: In one of old blog ( http://www.coderanch.com/t/529751/java-Web-Services-OCEJWSD/certification/determine-Document-style-RPC-SOAP) , i read --> "You can notice difference if you compare RPS style with bare document style. In this case document style won't have operation name in SOAP message" said by Mikalai Zaikin . But If I see in the sample request that is created for my services , I see operation name in bare document style also . Is this an update in latest JAX-WS?


QUESTION 2: Once service was running I used wsimport to create artifacts from wsdl . The Interface created from bare wsdl from wsimport had @SOAPBinding( parameterStyle as BARE ) , how did wsimport identify that the interface should be bare by looking at WSDL and XSD. The One difference I see , WRAPPED XSD has complextype with name getRectangleArea which is the webservice method name but the BARE XSD has complextype with webservice method input.


Below are the sections of XSD and WSDL which are relevant from both Services .
WRAPPED

WSDL

<operation name="getRectangleArea">
<input wsam:Action="http://service.math/MathOperation/getRectangleAreaRequest" message="tns:getRectangleArea"/>
<output wsam:Action="http://service.math/MathOperation/getRectangleAreaResponse" message="tns:getRectangleAreaResponse"/>
</operation>

<message name="getRectangleArea">
<part name="parameters" element="tns:getRectangleArea"/>
</message>

XSD

<xs:element name="getRectangleArea" type="tns:getRectangleArea"/>

<xs:complexType name="getRectangleArea">
<xs:sequence>
<xs:element name="arg0" type="tns:rectangle" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="rectangle">
<xs:sequence>
<xs:element name="breadth" type="xs:int"/>
<xs:element name="length" type="xs:int"/>
</xs:sequence>
</xs:complexType>


BARE

WSDL

<operation name="getRectangleArea">
<input wsam:Action="http://service3.math/MathOperation/getRectangleAreaRequest" message="tns:getRectangleArea"/>
<output wsam:Action="http://service3.math/MathOperation/getRectangleAreaResponse" message="tns:getRectangleAreaResponse"/>
</operation>

<message name="getRectangleArea">
<part name="getRectangleArea" element="tns:getRectangleArea"/>
</message>

XSD

<xs:element name="getRectangleArea" nillable="true" type="tns:rectangle"/>

<xs:complexType name="rectangle">
<xs:sequence>
<xs:element name="breadth" type="xs:int"/>
<xs:element name="length" type="xs:int"/>
</xs:sequence>
</xs:complexType>

Thanks
Sandeep
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic