O'Reilly logo

Java Web Services in a Nutshell by Kim Topley

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

RPC-Style and Document-Style JAX-RPC

In Section 5.2.6, it was noted that the SOAP binding for an individual operation or for all operations defined within a portType element can have a style attribute that takes either of the values rpc or document. However, not much was said about the actual differences between these two styles. This section looks at how RPC- and document-style operations are represented in SOAP messages as well as at the support that JAX-RPC provides for each.

RPC-Style Operations

Perhaps not surprisingly, when you create client-side stubs and server-side ties for a web service for which the definition is supplied in the form of a Java interface, each method in the interface is mapped to an RPC-style operation. The distinguishing feature of an RPC-style operation is the way in which it is represented as a SOAP message, which is specified in section 7 of the SOAP 1.1 specification. For example, Figure 6-2 shows the message that is sent as a result of invoking the following method from the BookQuery interface from the book web service created in Chapter 2:

public String getAuthor(String name) throws RemoteException;

As you can see, the SOAP body contains a single element that is named for the operation being invoked. This element is in the namespace associated with the web service, which is provided in the config.xml file supplied to wscompile, as shown in Example 2-9. The arguments required for the method call are nested as child elements. In this case, a single element ...

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