Class Communicator

java.lang.Object
com.sun.xml.ws.rx.util.Communicator

public final class Communicator extends Object
Transmits standalone protocol messages over the wire. Provides also some additional utility methods for creating and unmarshalling JAXWS Message and Header objects. WARNING: This class is a private utility class used by WS-RX implementation. Any usage outside the intended scope is strongly discouraged. The API exposed by this class may be changed, replaced or removed without any advance notice.
Author:
Marek Potociar (marek.potociar at oracle.com)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final QName
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
     
    com.sun.xml.ws.api.message.Packet
    createEmptyRequestPacket(boolean expectReply)
    Creates a new empty request packet
    com.sun.xml.ws.api.message.Packet
    createEmptyRequestPacket(String requestWsaAction, boolean expectReply)
    Creates a new empty request packet with an empty message that has WS-A action set
    com.sun.xml.ws.api.message.Packet
    createEmptyResponsePacket(com.sun.xml.ws.api.message.Packet requestPacket, String responseWsaAction)
    Creates an empty (no SOAP body payload) new response packet based for the supplied request packet with the provided response WS-Addressing action set.
    com.sun.xml.ws.api.message.Packet
    createNullResponsePacket(com.sun.xml.ws.api.message.Packet requestPacket)
    Creates a null (no message) response packet based for the supplied request packet.
    com.sun.xml.ws.api.message.Packet
    createRequestPacket(com.sun.xml.ws.api.message.Message message, String wsaAction, boolean expectReply)
     
    com.sun.xml.ws.api.message.Packet
    createRequestPacket(com.sun.xml.ws.api.message.Packet originalRequestPacket, Object jaxbElement, String wsaAction, boolean expectReply)
     
    com.sun.xml.ws.api.message.Packet
    createRequestPacket(Object jaxbElement, String wsaAction, boolean expectReply)
     
    com.sun.xml.ws.api.message.Packet
    createResponsePacket(com.sun.xml.ws.api.message.Packet requestPacket, com.sun.xml.ws.api.message.Message message, String responseWsaAction)
    Creates new response packet based for the supplied request packet with the provided response WS-Addressing action set.
    com.sun.xml.ws.api.message.Packet
    createResponsePacket(com.sun.xml.ws.api.message.Packet requestPacket, Object jaxbElement, String responseWsaAction, boolean isClientResponse)
    Creates new response packet based for the supplied request packet with the provided response WS-Addressing action set.
    com.sun.xml.ws.api.addressing.AddressingVersion
     
    com.sun.xml.ws.api.Component
     
    com.sun.xml.ws.api.EndpointAddress
    Provides the destination endpoint reference this Communicator is pointing to.
    com.sun.xml.ws.api.SOAPVersion
     
    getWsaAction(com.sun.xml.ws.api.message.Packet packet)
    Returns the value of WS-Addressing Action header of a message stored in the Packet.
    getWsaTo(com.sun.xml.ws.api.message.Packet packet)
    Returns the value of WS-Addressing To header of a message stored in the Packet.
    boolean
     
    com.sun.xml.ws.api.message.Packet
    send(com.sun.xml.ws.api.message.Packet request)
    Sends the request Packet and returns the corresponding response Packet.
    void
    sendAsync(com.sun.xml.ws.api.message.Packet request, com.sun.xml.ws.api.pipe.Fiber.CompletionCallback completionCallbackHandler)
    Asynchronously sends the request Packet
    void
    sendAsync(com.sun.xml.ws.api.message.Packet request, com.sun.xml.ws.api.pipe.Fiber.CompletionCallback completionCallbackHandler, com.sun.xml.ws.api.pipe.FiberContextSwitchInterceptor interceptor)
     
    void
    setDestinationAddress(com.sun.xml.ws.api.EndpointAddress newValue)
     
    void
    setDestinationAddressFrom(com.sun.xml.ws.api.message.Packet packet)
     
    com.sun.xml.ws.api.message.Packet
    setEmptyRequestMessage(com.sun.xml.ws.api.message.Packet request, String wsaAction)
    Creates a new JAX-WS Message object that doesn't have any payload and sets it as the current packet content as a request message.
    com.sun.xml.ws.api.message.Packet
    setEmptyResponseMessage(com.sun.xml.ws.api.message.Packet response, com.sun.xml.ws.api.message.Packet request, String wsaAction)
    Overwrites the Message of the response packet with a newly created empty Message instance.
    tryStartSecureConversation(com.sun.xml.ws.api.message.Packet request)
    If security is enabled, tries to initate secured conversation and obtain the security token reference.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • soapMustUnderstandAttributeName

      public final QName soapMustUnderstandAttributeName
  • Method Details

    • builder

      public static Communicator.Builder builder(String name)
    • createRequestPacket

      public com.sun.xml.ws.api.message.Packet createRequestPacket(Object jaxbElement, String wsaAction, boolean expectReply)
    • createRequestPacket

      public com.sun.xml.ws.api.message.Packet createRequestPacket(com.sun.xml.ws.api.message.Message message, String wsaAction, boolean expectReply)
    • createRequestPacket

      public com.sun.xml.ws.api.message.Packet createRequestPacket(com.sun.xml.ws.api.message.Packet originalRequestPacket, Object jaxbElement, String wsaAction, boolean expectReply)
    • createEmptyRequestPacket

      public com.sun.xml.ws.api.message.Packet createEmptyRequestPacket(boolean expectReply)
      Creates a new empty request packet
      Returns:
      a new empty request packet
    • createEmptyRequestPacket

      public com.sun.xml.ws.api.message.Packet createEmptyRequestPacket(String requestWsaAction, boolean expectReply)
      Creates a new empty request packet with an empty message that has WS-A action set
      Returns:
      a new empty request packet
    • createResponsePacket

      public com.sun.xml.ws.api.message.Packet createResponsePacket(@NotNull com.sun.xml.ws.api.message.Packet requestPacket, Object jaxbElement, String responseWsaAction, boolean isClientResponse)
      Creates new response packet based for the supplied request packet with the provided response WS-Addressing action set.
      Parameters:
      requestPacket - original request the newly created response belongs to
      responseWsaAction - WS-Addressing action header value to be set
      isClientResponse - determines whether the response is technically a client request
      Returns:
      newly created response packet
    • createResponsePacket

      public com.sun.xml.ws.api.message.Packet createResponsePacket(com.sun.xml.ws.api.message.Packet requestPacket, com.sun.xml.ws.api.message.Message message, String responseWsaAction)
      Creates new response packet based for the supplied request packet with the provided response WS-Addressing action set.
      Parameters:
      requestPacket - original request the newly created response belongs to
      responseWsaAction - WS-Addressing action header value to be set
      Returns:
      newly created response packet
    • createEmptyResponsePacket

      public com.sun.xml.ws.api.message.Packet createEmptyResponsePacket(com.sun.xml.ws.api.message.Packet requestPacket, String responseWsaAction)
      Creates an empty (no SOAP body payload) new response packet based for the supplied request packet with the provided response WS-Addressing action set.
      Parameters:
      requestPacket - original request the newly created response belongs to
      responseWsaAction - WS-Addressing action header value to be set
      Returns:
      newly created empty (no SOAP body payload) response packet
    • createNullResponsePacket

      public com.sun.xml.ws.api.message.Packet createNullResponsePacket(com.sun.xml.ws.api.message.Packet requestPacket)
      Creates a null (no message) response packet based for the supplied request packet.
      Parameters:
      requestPacket - original request the newly created response belongs to
      Returns:
      newly created null (no message) response packet
    • setEmptyRequestMessage

      public com.sun.xml.ws.api.message.Packet setEmptyRequestMessage(com.sun.xml.ws.api.message.Packet request, String wsaAction)
      Creates a new JAX-WS Message object that doesn't have any payload and sets it as the current packet content as a request message.
      Parameters:
      wsaAction - WS-Addressing action header to set
      Returns:
      the updated Packet instance
    • setEmptyResponseMessage

      public com.sun.xml.ws.api.message.Packet setEmptyResponseMessage(com.sun.xml.ws.api.message.Packet response, com.sun.xml.ws.api.message.Packet request, String wsaAction)
      Overwrites the Message of the response packet with a newly created empty Message instance. Unlike Packet.setMessage(Message), this method fills in the Message's WS-Addressing headers correctly, based on the provided request packet WS-Addressing headers.
    • getWsaAction

      public String getWsaAction(com.sun.xml.ws.api.message.Packet packet)
      Returns the value of WS-Addressing Action header of a message stored in the Packet.
      Parameters:
      packet - JAX-WS RI packet
      Returns:
      Value of WS-Addressing Action header, null if the header is not present
    • getWsaTo

      public String getWsaTo(com.sun.xml.ws.api.message.Packet packet)
      Returns the value of WS-Addressing To header of a message stored in the Packet.
      Parameters:
      packet - JAX-WS RI packet
      Returns:
      Value of WS-Addressing To header, null if the header is not present
    • tryStartSecureConversation

      public SecurityTokenReferenceType tryStartSecureConversation(com.sun.xml.ws.api.message.Packet request) throws WSTrustException
      If security is enabled, tries to initate secured conversation and obtain the security token reference.
      Returns:
      security token reference of the initiated secured conversation, or null if there is no SC configured
      Throws:
      WSTrustException
    • send

      public com.sun.xml.ws.api.message.Packet send(@NotNull com.sun.xml.ws.api.message.Packet request)
      Sends the request Packet and returns the corresponding response Packet. This method should be used for Req-Res MEP
      Parameters:
      request - Packet containing the message to be send
      Returns:
      response Message wrapped in a response Packet received
    • sendAsync

      public void sendAsync(@NotNull com.sun.xml.ws.api.message.Packet request, @Nullable com.sun.xml.ws.api.pipe.Fiber.CompletionCallback completionCallbackHandler)
      Asynchronously sends the request Packet
      Parameters:
      request - Packet containing the message to be send
      completionCallbackHandler - completion callback handler to process the response. May be null. In such case a generic completion callback handler will be used.
    • sendAsync

      public void sendAsync(@NotNull com.sun.xml.ws.api.message.Packet request, @Nullable com.sun.xml.ws.api.pipe.Fiber.CompletionCallback completionCallbackHandler, @Nullable com.sun.xml.ws.api.pipe.FiberContextSwitchInterceptor interceptor)
    • getDestinationAddress

      @Nullable public com.sun.xml.ws.api.EndpointAddress getDestinationAddress()
      Provides the destination endpoint reference this Communicator is pointing to. May return null (typically when used on the server side).
      Returns:
      destination endpoint reference or null in case the destination address has not been specified when constructing this Communicator instance.
    • setDestinationAddress

      public void setDestinationAddress(com.sun.xml.ws.api.EndpointAddress newValue)
    • setDestinationAddressFrom

      public void setDestinationAddressFrom(com.sun.xml.ws.api.message.Packet packet)
    • getAddressingVersion

      public com.sun.xml.ws.api.addressing.AddressingVersion getAddressingVersion()
    • getSoapVersion

      public com.sun.xml.ws.api.SOAPVersion getSoapVersion()
    • close

      public void close()
    • isClosed

      public boolean isClosed()
    • getContainer

      public com.sun.xml.ws.api.Component getContainer()