Interoperating with Web Services Addressing endpoints that do not support the default specification supported by WebSphere Application Server

A target web service endpoint might not support the same Web Services Addressing (WS-Addressing) namespace as this product. In most cases, you do not have to undertake any extra actions to interoperate with such endpoints, however some scenarios require additional steps in the implementation of your web service.

About this task

WebSphere® Application Server supports the default WS-Addressing 2005/08 namespace https://www.w3.org/2005/08/addressing. Complete this task to interoperate with endpoints that support other namespaces. This task specifically describes interoperation with endpoints that are hosted on a node that supports only the 2004/08 namespace: http://schemas.xmlsoap.org/ws/2004/08/addressing.

If you are using the standard JAX-WS API, ensure that you use the appropriate feature, annotation or endpoint reference class for the 2004/08 namespace.

If you are sending to or receiving messages from an endpoint that supports only the 2004/08 namespace, you do not have to undertake any additional steps for interoperability. This product recognizes and understands incoming WS-Addressing messages that conform to the 2004/08 specification, and outbound messages automatically adhere to the namespace of their destination endpoint reference. If you are sending a request, all WS-Addressing elements, such as reply endpoint or fault endpoint elements, must use the same namespace as the message. Any discrepancy results in a JAX-WS or JAX-RPC configuration error.

If you are interacting in a different way with an endpoint that supports only the 2004/08 namespace, such as exporting endpoint references in the message header or body, and you are not using the JAX-WS standard API, you must undertake additional steps as detailed later in this topic.

Procedure

  • If you are generating a web service for use by a client that supports only the 2004/08 specification, update the WS-Addressing namespace in the Web Services Description Language (WSDL) document for your web service, by changing https://www.w3.org/2006/05/addressing/wsdl to http://schemas.xmlsoap.org/ws/2004/08/addressing.
    Note: Only the WS-Addressing WSDL Action extensibility element is recognized by pre-W3C WS-Addressing clients.
  • If you are creating endpoint references at run time for export to an endpoint that supports the 2004/08 namespace only, perform the following steps:
    1. Create the endpoint reference to export.
    2. Associate the appropriate namespace with the endpoint reference, by using the setNamespace method.
      The following example illustrates the association of the 2004/08 namespace with an endpoint reference:
      import com.ibm.wsspi.wsaddressing.EndpointReference;
      import com.ibm.wsspi.wsaddressing.NamespaceNotSupportedException;
      import com.ibm.wsspi.wsaddressing.WSAConstants;
      
      : 
      
      EndpointReference epr = ...
      
      try
      {
          epr.setNamespace(WSAConstants.WSADDRESSING_NAMESPACE_2004_08);
      } catch (NamespaceNotSupportedException e)
      {
          // Error handling code here
      }
    When you pass the endpoint reference to the target endpoint, in either the SOAP body or the SOAP header of a message, the endpoint reference is appropriately serialized into SOAP elements according to its namespace.
  • To establish the namespace of an inbound request, use the IBM proprietary WS-Addressing system programming interface (SPI) to retrieve the WSADDRESSING_INBOUND_NAMESPACE property from the inbound message context.
    This property specifies the Core WS-Addressing specification namespace of the incoming message.
    Note: This procedure uses the IBM proprietary WS-Addressing API. There is no equivalent procedure in the JAX-WS API.
    You can retrieve the message context by, for example, using the session context of the endpoint enterprise bean. For more information about message contexts, refer to the JSR-109 specification. The following code example shows how you can establish the namespace of an incoming message on the receiving endpoint:
    import com.ibm.wsspi.wsaddressing.WSAConstants;
    import javax.xml.rpc.handler.MessageContext;
    
    : 
      // If the endpoint is implemented as an enterprise bean, you can use its session context
      // to obtain the message context
      private SessionContext sessionContext;
      MessageContext context = sessionContext.getMessageContext();
    
      try
      {
        String namespace = (String)msgContext.getProperty(WSAConstants.WSADDRESSING_INBOUND_NAMESPACE);
      } catch (IllegalArgumentException e)
      {
        // Error handling code here
      }