Package com.sun.xml.ws.rx.util
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 JAXWSMessage
andHeader
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 class
Communicator.Builder
-
Field Summary
Fields Modifier and Type Field Description QName
soapMustUnderstandAttributeName
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Communicator.Builder
builder(String name)
void
close()
Packet
createEmptyRequestPacket(boolean expectReply)
Creates a new empty request packetPacket
createEmptyRequestPacket(String requestWsaAction, boolean expectReply)
Creates a new empty request packet with an empty message that has WS-A action setPacket
createEmptyResponsePacket(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.Packet
createNullResponsePacket(Packet requestPacket)
Creates a null (no message) response packet based for the supplied request packet.Packet
createRequestPacket(Message message, String wsaAction, boolean expectReply)
Packet
createRequestPacket(Packet originalRequestPacket, Object jaxbElement, String wsaAction, boolean expectReply)
Packet
createRequestPacket(Object jaxbElement, String wsaAction, boolean expectReply)
Packet
createResponsePacket(Packet requestPacket, Message message, String responseWsaAction)
Creates new response packet based for the supplied request packet with the provided response WS-Addressing action set.Packet
createResponsePacket(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.AddressingVersion
getAddressingVersion()
Component
getContainer()
EndpointAddress
getDestinationAddress()
Provides the destination endpoint reference thisCommunicator
is pointing to.SOAPVersion
getSoapVersion()
String
getWsaAction(Packet packet)
Returns the value of WS-AddressingAction
header of a message stored in thePacket
.String
getWsaTo(Packet packet)
Returns the value of WS-AddressingTo
header of a message stored in thePacket
.boolean
isClosed()
Packet
send(Packet request)
void
sendAsync(Packet request, Fiber.CompletionCallback completionCallbackHandler)
Asynchronously sends the requestPacket
void
sendAsync(Packet request, Fiber.CompletionCallback completionCallbackHandler, FiberContextSwitchInterceptor interceptor)
void
setDestinationAddress(EndpointAddress newValue)
void
setDestinationAddressFrom(Packet packet)
Packet
setEmptyRequestMessage(Packet request, String wsaAction)
Creates a new JAX-WSMessage
object that doesn't have any payload and sets it as the current packet content as a request message.Packet
setEmptyResponseMessage(Packet response, Packet request, String wsaAction)
SecurityTokenReferenceType
tryStartSecureConversation(Packet request)
If security is enabled, tries to initate secured conversation and obtain the security token reference.
-
-
-
Field Detail
-
soapMustUnderstandAttributeName
public final QName soapMustUnderstandAttributeName
-
-
Method Detail
-
builder
public static Communicator.Builder builder(String name)
-
createRequestPacket
public final Packet createRequestPacket(Object jaxbElement, String wsaAction, boolean expectReply)
-
createRequestPacket
public final Packet createRequestPacket(Message message, String wsaAction, boolean expectReply)
-
createRequestPacket
public final Packet createRequestPacket(Packet originalRequestPacket, Object jaxbElement, String wsaAction, boolean expectReply)
-
createEmptyRequestPacket
public Packet createEmptyRequestPacket(boolean expectReply)
Creates a new empty request packet- Returns:
- a new empty request packet
-
createEmptyRequestPacket
public 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 Packet createResponsePacket(@NotNull 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 toresponseWsaAction
- WS-Addressing action header value to be setisClientResponse
- determines whether the response is technically a client request- Returns:
- newly created response packet
-
createResponsePacket
public Packet createResponsePacket(Packet requestPacket, 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 toresponseWsaAction
- WS-Addressing action header value to be set- Returns:
- newly created response packet
-
createEmptyResponsePacket
public Packet createEmptyResponsePacket(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 toresponseWsaAction
- WS-Addressing action header value to be set- Returns:
- newly created empty (no SOAP body payload) response packet
-
createNullResponsePacket
public Packet createNullResponsePacket(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 final Packet setEmptyRequestMessage(Packet request, String wsaAction)
Creates a new JAX-WSMessage
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 final Packet setEmptyResponseMessage(Packet response, Packet request, String wsaAction)
Overwrites theMessage
of the response packet with a newly created emptyMessage
instance. UnlikePacket.setMessage(Message)
, this method fills in theMessage
's WS-Addressing headers correctly, based on the provided request packet WS-Addressing headers.- Parameters:
request
-wsaAction
-- Returns:
-
getWsaAction
public String getWsaAction(Packet packet)
Returns the value of WS-AddressingAction
header of a message stored in thePacket
.- Parameters:
packet
- JAX-WS RI packet- Returns:
- Value of WS-Addressing
Action
header,null
if the header is not present
-
getWsaTo
public String getWsaTo(Packet packet)
Returns the value of WS-AddressingTo
header of a message stored in thePacket
.- Parameters:
packet
- JAX-WS RI packet- Returns:
- Value of WS-Addressing
To
header,null
if the header is not present
-
tryStartSecureConversation
public SecurityTokenReferenceType tryStartSecureConversation(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
-
sendAsync
public void sendAsync(@NotNull Packet request, @Nullable Fiber.CompletionCallback completionCallbackHandler)
Asynchronously sends the requestPacket
- Parameters:
request
-Packet
containing the message to be sendcompletionCallbackHandler
- completion callback handler to process the response. May benull
. In such case a generic completion callback handler will be used.
-
sendAsync
public void sendAsync(@NotNull Packet request, @Nullable Fiber.CompletionCallback completionCallbackHandler, @Nullable FiberContextSwitchInterceptor interceptor)
-
getDestinationAddress
@Nullable public EndpointAddress getDestinationAddress()
Provides the destination endpoint reference thisCommunicator
is pointing to. May returnnull
(typically when used on the server side).- Returns:
- destination endpoint reference or
null
in case the destination address has not been specified when constructing thisCommunicator
instance.
-
setDestinationAddress
public void setDestinationAddress(EndpointAddress newValue)
-
setDestinationAddressFrom
public void setDestinationAddressFrom(Packet packet)
-
getAddressingVersion
public AddressingVersion getAddressingVersion()
-
getSoapVersion
public SOAPVersion getSoapVersion()
-
close
public void close()
-
isClosed
public boolean isClosed()
-
getContainer
public Component getContainer()
-
-