Implementing extensions to the JAX-RPC and Web Services for J2EE client programming models
WebSphere Application Server provides extensions to the Java API for XML-based RPC (JAX-RPC) and Web Services for Java 2 Platform, Enterprise Edition (J2EE) client programming models.
About this task
We can customize a Web service by using the following extensions to the JAX-RPC and Web Services for J2EE client programming models.
Procedure
- Set the REQUEST_TRANSPORT_PROPERTIES and RESPONSE_TRANSPORT_PROPERTIES properties in a JAX-RPC client Stub to enable a Web services client to send or retrieve HTTP transport headers.
By modifying your client code to send transport headers, we can send specific information within the HTTP transport headers of outgoing requests.
See Sending HTTP transport headers or Receiving HTTP transport headers to learn how to modify your client code to send or retrieve transport headers. See HTTP transport header properties best practices to enable a Web services client to send or retrieve HTTP transport headers.
- Implement support for javax.xml.rpc.ServiceFactory.loadService() methods as described by the JAX-RPC specification.
The loadService methods create an instance of the generated service implementation class in an implementation-specific manner. The loadService methods are new for JAX-RPC 1.1 and include three signatures:
- public.javax.xml.rpc.Service loadService (Class serviceInterface)
As documented in the JAX-RPC specification, this method returns the generated service implementation for the service interface. We can review the JAX-RPC specification through Web services: Resources for learning.
- public.javax.xml.rpc.Service loadService (URL wsdlDocumentLocation, Class serviceInterface, Properties properties)
This method behaves like the loadService (Class serviceInterface) because the following parameters are ignored:
- wsdlDocumentLocation
- properties
- public.javax.xml.rpc.Service loadService (URL wsdlDocumentLocation, QName serviceName, Properties properties)
This method returns the generated service implementation for the specified service by using optional namespace-to-package mapping information.
- wsdlDocumentLocation - ignored
- serviceName - QName (namespace, localpart) of the service
- properties - If this parameter is non-null, it contains namespace-to-package mapping entries. Each Property entry key is a String corresponding to the namespace. Each Property entry value is a String corresponding to the Java package name.
If the properties argument contains an entry with a key (namespace) that matches the namespace portion of the QName serviceName argument, the entry value (javaPackage) is used as the package name when trying to locate the service implementation.
- Implement the CustomBinder interface to provide concrete custom data binders for a specific XML schema type.
Custom data binders are used to map XML schema types with Java objects. Custom data binders provide bindings for XML schema types that are not supported by the current Java API for XML-based Remote Call Procedure (JAX-RPC) specification. WAS provides an extension to the Java 2 Enterprise Edition (J2EE) programming model called the CustomBinder interface that implements these custom bindings for a specific XML schema type. The CustomBinder interface has three properties, in addition to deserialize and serialize methods:
- QName for the XML schema type
- QName scope
- Java type
The custom data binder defines serialize and deserialize methods to convert between a Java object and a SOAPElement interface. A custom data binder is added to the runtime system and interacts with the Web services runtime using a SOAPElement. They are added to the runtime by using custom binding providers. See the related links to learn more about the topics associated with the CustomBinder interface.
What to do next
See the related links to learn more about the topics associated with these programming model extensions.
To review the documentation used for APIs and SPIs, see Reference: Generated API documentation.
Review the specifications for the standards and APIs used in developing Web services.
See also
Custom data binders
Custom binding providers
CustomBinder interface
Usage patterns for deploying custom data binders
HTTP transport header properties best practices
Sending HTTP transport headers
Retrieving HTTP transport headers
Related information
SOAP with Attachments API for Java interface