SOAP Binding can be done using two styles: DOCUMENT and RPC. This is denoted in the wsdl as style in the binding section.
The @SOAPBinding annotation can be used over an SEI (separate interface or class) to configure the soap binding styles, when developing a web service bottom up. Default is DOCUMENT. Annotate the SEI with @SOAPBinding(Style=Style.RPC) to get the RPC style. Generate a wsdl both with DOCUMENT and RPC styles and refer to them in parallel while going through these notes.
SOAP messages will contain full XML documents.
The types section holds, points to, or imports an XSD.
Document style can hence support services with rich, explicitly defined data types.
In unwrapped document style, the SOAP message does not carry the name of the service operation.
The wrapped document convention provides a way to name the body of the SOAP message after the corresponding service operation.
The parameter style attribute of the @SOAPBinding annotation can also be used to specify if the document parameters should use wrapped style or unwrapped stye.
Can support any service pattern.
From an architectural perspective, the document style is simpler as the body of the SOAP message is a self-contained with XSD.
Annotations for DOCUMENT style
Document style is the default SOAP Binding style, but can also be explicitely set using the @SOAPBinding annotation.
SOAP messages contain parameters in the request messages and return values in the response messages.
The types section is empty, as the service return only simple types.
XSD is not used for defining types.
the messages carry the names of the @WebMethods operations.
Supports only request-reply.
From developer perspective, rpc is simpler
wsgen utility is not required to generate java types that correspond to XML schema.
Annotations for RPC style
You can use the @SOAPBinding annotation to change the style to RPC
default is DOCUMENT
You can use @WebParam annotation before a method argument to give a different name for the input argument.
You can use @WebResult annotation above a method to to give a different name for the output.
The body of a SOAP message can be validated against the XSD given in the types section of the WSDL.
A service in document style can use rich data types.
There is a great flexibility in how the body of the SOAP message is structured as the structure is clearly defined in an XSD.
The wrapped document convention provides a way to add the major upside of rpc style to document style, which is naming the body of the SOAP message after the corresponding service operation.
In unwrapped document style, the SOAP message does not carry the name of the service operation, which can complicate the dispatching of messages to the appropriate program code.
The wrapped document style adds a level of complexity, in particular at the API level. Writing a client against a wrapped document service can be more challenging.
The wrapped variant does not support overloaded service operations because the XML wrapper element in the body of a SOAP message must have the name of the service operation. In effect, then, there can be only one operation for a given element name.
The automatically generated WSDL is relatively short and simple because there is no types section.
Messages in the WSDL carry the names of the underlying web service operations by default, which are @webMethods in a java-based service. The WSDL thus has a what-you-see-is-what-you-get style wrt the service’s operations.
Message throughput may improve because the messages do not carry any type encoding information.
The WSDL, with its empty types section, does not provide an XSD against which the body of a SOAP message can be validated.
The service cannot use rich data types because there is no XSD to define such types.
Since RPC is associated with the request /response pattern, it encourages tight coupling between server and the client.
Long term support for rpc from web services community and the WS-I group is doubtful.
We will see more about @SOAPBinding annotation and additional SOAP Binding attributes.
Also, do the labs and read these notes again for a better understanding.
Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!