O'Reilly logo

Java SOA Cookbook by Eben Hewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Choosing Encoding, Use, and Parameter Styles

Problem

You need to determine the best encoding style, parameter style, and use values for your web service.

Solution

Check out the discussion below for advantages and disadvantages of the different combinations.

Discussion

A web service definition is mapped to a WSDL binding in order to indicate the transport mechanism used to communicate with the service. Consider the following WSDL binding:

<binding name="CartEJBPortBinding" type="tns:CartEJB">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document">
</soap:binding>
<operation name="getVersion">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>

There are three items at work here, two of which are explicit and one that is implicit:

  • The SOAP binding style (“document”)

  • The SOAP binding use (“literal”)

  • The SOAP binding parameter Style (“wrapped”)

The two explicit items are style and use. They are specified in the soap:binding style attribute and the soap:body use attribute, respectively. We’ll talk about parameter style in a moment.

Style

The soap:binding element’s style attribute can have the value of “rpc” or “document”. A value of “rpc” indicates that you want to use SOAP messages containing parameters and return values. In this way, your web service will mimic an RMI call. A value of “document” indicates you want your SOAP messages to use ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required