Service Mapping

The second goal of JAX-RPC is to simplify writing SOAP nodes and SOAP clients. As you saw in Chapter 7, writing nodes may not be difficult with a library such as Apache SOAP. The clients, though, require more work.

Mapping Services to Java

As of version 0.6, JAX-RPC maps WSDL services as Java classes that extend javax.xml.rpc.Service. Service is a new interface that is equivalent to the wsdl:service tag.

Service offers a few generic methods to retrieve a service port and create Call objects (more on call objects in the next section).

The generated service interface takes this form:

 public interface <ServiceName> extends javax.xml.rpc.Service { public <ServiceDefInterface> get<Name of the wsdl:port>() throws JAXRPCException; // ...

Get Java™ Web Services Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.