|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.transporthandlers.TransportHandlerBase
org.osesb.transporthandlers.soap.ejb20.SOAPXMLMessageTransportHandlerBean
public class SOAPXMLMessageTransportHandlerBean
Out of the box, osESB supports document style interactions where service consumers invoke services using XML messages.
Transport handlers are entry points for messages sent to osESB. SOAPXMLMessageTransportHandlerBean is a transport handler that extends TransportHandlerBase for processing messages sent over SOAP. SOAPXMLMessageTransportHandlerBean is a SessionBean configured as a SOAP end point that exposes two methods, which both take XML text as the only parameter:<wsa:ReplyTo> or
<wsa:FaultTo> tags in the incoming SOAPHeader. <wsa:ReplyTo> or <wsa:ReplyTo> tags in the incoming SOAPHeader.
receiveSynchronousMessage() processes the incoming message and always sends a reply to the
SOAP client that invoked the service. In this case, if message processing does not produce
a result, then depending on the setting for the 'echoMessageAsAcknowledgement'
environment property either a BrokerAcknowledgementMessage or the original XML message
is returned to the SOAP client that invoked the service.
Attachments are processed by server-side attachment handlers such as
org.osesb.connectors.jaxrpc.attachments.JAXRPCServerAttachmentHandler.
SOAPXMLMessageTransportHandlerBean can be configured as a document-literal or rpc-encoded
SOAP end point because document-based web services, as a paradigm, are orthogonal to the
formatting and the representation of the SOAP message on the wire. This means that the choice
of the formatting defined in the WSDL for the transport handler end point is transparent
to SOAP clients. For example, the SOAP clients in the org.osesb.connectors.jaxrpc;
behave identically for document-literal and rpc-encoded SOAP end points.<wsa:MessageID> entry
in the SOAPHeader of the incoming message, if any.<wsa:ReplyTo> SOAPHeader entry, if any.<wsa:ReplyTo> and <wsa:FaultTo> tags in the SOAPHeader of the incoming message,
whether or not MessageRouter#routeEAIMessage() returns a result, and the setting of the
'onExceptionSendBrokerErrorMessage' environment property. The rules for sending
replies from SOAP transport handlers are as follows:
<wsa:ReplyTo>
entry, then unless an Exception occurs, a reply is always sent to the specified end-point
irrespective of the method that was invoked. So, if message processing does not
produce a result, then depending on the setting for the 'echoMessageAsAcknowledgement'
environment property either a BrokerAcknowledgementMessage or the original XML message
is sent to the end-point specified by <wsa:ReplyTo>. If message processing produces
a result, then the result is sent to the end-point specified by <wsa:ReplyTo>,
even if receiveAsynchronousMessage() was invoked. Note that if processing produces a result
and receiveSynchronousMessage() was invoked and if <wsa:ReplyTo> is set in the
SOAPHeader then a response is returned to the SOAP client and a reply is sent to the end
point specified by <wsa:ReplyTo>.<wsa:FaultTo>
entry in the SOAPHeader of the incoming message is set, then either a SoapFault or a
BrokerErrorMessage is sent to the end point specified by <wsa:FaultTo>, depending
on the setting of the 'onExceptionSendBrokerErrorMessage' environment property.
| Field Summary | |
|---|---|
protected JAXRPCWSAddressingConfiguration |
jaxrpcWSAddressingConfiguration
Initialized and populated by receiveMessage() this is the JAXRPCWSAddressingConfiguration, which encapsulates the ws-addressing SOAPHeader entries in the incoming SOAPMessage. |
protected java.lang.String |
messageFactoryClassName
From the environment, the name of the javax.xml.soap.MessageFactory class that is used to create SOAPMessages. |
protected boolean |
onExceptionSendBrokerErrorMessage
From the 'onExceptionSendBrokerErrorMessage' environment property, which determines whether a SOAPFault or a org.osesb.msgrouting.BrokerErrorMessage is returned from receiveSynchronousMessage() when an error occurs. |
protected boolean |
propagateSecurityCredentials
From the 'propagateSecurityCredentials' environment property. |
protected javax.xml.namespace.QName |
requestMessageType
Initialized and populated by receiveMessage() this is messageType (QName) of the incoming XML message as determined by the MessageRouter when routeEAIMessage() is invoked. |
protected WSSSecurityProfile |
securityProfile
Initialized and populated by receiveMessage() this is the WSSSecurityProfile, which encapsulates the ws-security SOAPHeader entries in the incoming SOAPMessage. |
protected java.lang.String |
serviceFactoryClassName
From the environment, the name of the javax.xml.rpc.ServiceFactory class that is used to invoke Web Services, such as those specified by <wsa:ReplyTo>
SOAPHeader entries. |
protected javax.ejb.SessionContext |
sessionContext
Our SessionContext. |
protected java.lang.String |
soapConnectionFactoryClassName
From the javax.xml.soap.SOAPConnectionFactory environment property, the name of the javax.xml.soap.SOAPConnectionFactory class. |
protected java.lang.String |
soapFactoryClassName
From the environment, the name of the javax.xml.soap.SOAPFactory class that is used to create SOAPMessages. |
| Fields inherited from class org.osesb.transporthandlers.TransportHandlerBase |
|---|
debugFlag, echoMessageAsAcknowledgement, log, messageRouterPoolInstance, transportHandlerMessageType, transportHandlerName, verbose |
| Constructor Summary | |
|---|---|
SOAPXMLMessageTransportHandlerBean()
|
|
| Method Summary | |
|---|---|
BrokerAcknowledgementMessage |
constructBrokerAcknowledgementMessage(java.lang.String message,
javax.xml.namespace.QName relatesToMessageType,
java.lang.String relatesToMessageID)
Constructs a BrokerAcknowledgementMessage that can be returned to a SOAP client or sent to the destination specified by a ws-addressing <wsa:ReplyTo> entry in the SOAPHeader of an incoming SOAPMessage. |
BrokerErrorMessage |
constructBrokerErrorMessage(java.lang.String message,
javax.xml.namespace.QName relatesToMessageType,
java.lang.String relatesToMessageID)
Constructs a BrokerErrorMessage that can be returned to a SOAP client or sent to the destination specified by a ws-addressing <wsa:FaultTo> entry in the SOAPHeader of an incoming SOAPMessage. |
void |
ejbActivate()
|
void |
ejbCreate()
ejbCreate(). |
void |
ejbPassivate()
|
void |
ejbRemove()
ejbRemove() |
protected EAIXMLMessageWithAttachments |
getMessagePipelineResult(EAIMessage messagePipelineResult)
Returns a EAIXMLMessageWithAttachments for a given MessagePipeline result. |
javax.ejb.SessionContext |
getSessionContext()
|
java.util.List |
getSOAPRequestAttachments()
Retrieves attachments sent with the request SOAPMessage, if any. |
JAXRPCWSAddressingConfiguration |
getWSAddressingSOAPHeaderEntries()
Retrieves the JAXRPCWSAddressingConfiguration, which encapsulates ws-addressing SOAPHeader entries. |
WSSSecurityProfile |
getWSSecuritySOAPHeaderEntries()
Retrieves the WSSSecurityProfile, which encapsulates ws-security SOAPHeader entries. |
protected void |
logMessage(java.lang.String messageID,
java.lang.String xmlMessageText,
int numberOfAttachments)
Log a message. |
void |
receiveAsynchronousMessage(java.lang.String xmlMessageText)
Invoke receiveMessage() to process an asynchronous XML message transported over SOAP, possibly with attachments, as follows: The return from receiveAsynchronousMessage() is void, so a reply is not sent to the SOAP client. If the SOAPHeader of the incoming message includes a ws-addressing <wsa:ReplyTo>
entry, then unless an Exception occurs, the result of MessagePipeline processing is sent to
the specified end-point. |
protected EAIMessage |
receiveMessage(java.lang.String xmlMessageText)
Process a XML message transported over SOAP, possibly with attachments, as follows: Retrieve the message ID from the <wsa:MessageID> entry
in the SOAPHeader of the incoming message, if any.
Retrieve attachments sent with the SOAPMessage, if any.
Retrieve security credentials, if any, from ws-security SOAPHeader
entries as a WSSSecurityProfile instance. |
java.lang.String |
receiveSynchronousMessage(java.lang.String xmlMessageText)
Invoke receiveMessage() to process an Synchronous XML message transported over SOAP, possibly with attachments, as follows: Unless an Exception occurs, the result of MessagePipeline processing is returned to the client. |
protected java.lang.String |
sendReply(java.lang.String originatingXMLMessage,
EAIMessage messagePipelineResult,
java.lang.Throwable receiveMessageException)
Send replies, including SOAP faults, to the end points specified by the <wsa:ReplyTo> or <wsa:FaultTo> tags in the
SOAPHeader of the incoming message. |
protected java.lang.String |
sendReplyUsingJAXRPCClient(java.lang.String originatingXMLMessage,
EAIMessage messagePipelineResult,
java.lang.Throwable receiveMessageException)
Use a org.osesb.connectors.jaxrpc.JAXRPCDynamicSendMessageClient to send replies, including SOAP faults, to the end points specified by the <wsa:ReplyTo> or <wsa:FaultTo> tags in the
SOAPHeader of the incoming message. |
protected java.lang.String |
sendReplyUsingSOAPConnection(java.lang.String originatingXMLMessage,
EAIMessage messagePipelineResult,
java.lang.Throwable receiveMessageException)
Use a javax.xml.soap.SOAPConnection to send replies, including SOAP faults, to the end points specified by the <wsa:ReplyTo>
or <wsa:FaultTo> tags in the SOAPHeader of the incoming
message. |
void |
setSessionContext(javax.ejb.SessionContext sessionContext)
|
void |
testWSAddressingReplyReceiver(java.lang.String xmlMessageText)
testWSAddressingReplyReceiver() is a test method, not an operational method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.ejb.SessionContext sessionContext
protected JAXRPCWSAddressingConfiguration jaxrpcWSAddressingConfiguration
protected WSSSecurityProfile securityProfile
protected javax.xml.namespace.QName requestMessageType
protected java.lang.String serviceFactoryClassName
<wsa:ReplyTo>
SOAPHeader entries. Set the
ServiceFactory entry when using
a SOAP engine that is not native to the
container, like Axis in Weblogic.
ejbCreate()protected java.lang.String soapFactoryClassName
ejbCreate()protected java.lang.String messageFactoryClassName
ejbCreate()protected java.lang.String soapConnectionFactoryClassName
ejbCreate()protected boolean onExceptionSendBrokerErrorMessage
ejbCreate()protected boolean propagateSecurityCredentials
<wsa:ReplyTo> entry in
the SOAPHeader of the incoming message.<wsa:FaultTo>
entry in the SOAPHeader of the incoming message.
ejbCreate()| Constructor Detail |
|---|
public SOAPXMLMessageTransportHandlerBean()
| Method Detail |
|---|
public void receiveAsynchronousMessage(java.lang.String xmlMessageText)
throws java.lang.Exception
<wsa:ReplyTo>
entry, then unless an Exception occurs, the result of MessagePipeline processing is sent to
the specified end-point. The result of MessagePipeline processing must be XML or XML with
attachments. If message processing does not produce a result, then depending on the setting
for the 'echoMessageAsAcknowledgement' environment property either a BrokerAcknowledgementMessage
or the original XML message is sent to the end-point specified by <wsa:ReplyTo>.<wsa:FaultTo>
entry in the SOAPHeader of the incoming message is set, then either a SoapFault or a
BrokerErrorMessage is sent to the end point specified by <wsa:FaultTo>, depending
on the setting of the 'onExceptionSendBrokerErrorMessage' environment property.
xmlMessageText - The received XML message.
java.lang.Exception - if an error occurs during message processing.
public java.lang.String receiveSynchronousMessage(java.lang.String xmlMessageText)
throws java.lang.Exception
<wsa:ReplyTo>
entry, then unless an Exception occurs, the result of MessagePipeline processing is sent to
the specified end-point. The result of MessagePipeline processing must be XML or XML with
attachments. If message processing does not produce a result, then depending on the setting
for the 'echoMessageAsAcknowledgement' environment property either a BrokerAcknowledgementMessage
or the original XML message is sent to the end-point specified by <wsa:ReplyTo>.<wsa:FaultTo>
entry in the SOAPHeader of the incoming message is set, then either a SoapFault or a
BrokerErrorMessage is sent to the end point specified by <wsa:FaultTo>, depending
on the setting of the 'onExceptionSendBrokerErrorMessage' environment property.
xmlMessageText - The received XML message.
java.lang.Exception - if an error occurs during message processing.public void testWSAddressingReplyReceiver(java.lang.String xmlMessageText)
<wsa:ReplyTo> and/or <wsa:FaultTo> entries in
the SOAPHeader of the incoming message.
xmlMessageText - The received XML message.
protected EAIMessage receiveMessage(java.lang.String xmlMessageText)
throws java.lang.Exception
<wsa:MessageID> entry
in the SOAPHeader of the incoming message, if any.<wsa:ReplyTo> SOAPHeader entry, if any.<wsa:FaultTo> SOAPHeader entry, if any.
xmlMessageText - The received XML message.
java.lang.Exception - if an error occurs during message processing.
protected java.lang.String sendReply(java.lang.String originatingXMLMessage,
EAIMessage messagePipelineResult,
java.lang.Throwable receiveMessageException)
throws java.lang.Exception
<wsa:ReplyTo> or <wsa:FaultTo> tags in the
SOAPHeader of the incoming message.
How replies and faults are returned from SOAP transport handlers
is determined by a combination of factors, including the receiveXXX()
method that is invoked, the ws-addressing <wsa:ReplyTo> and
<wsa:FaultTo> tags in the SOAPHeader of the incoming message,
whether or not MessageRouter#routeEAIMessage() returns a result,
and the setting of the 'onExceptionSendBrokerErrorMessage' environment
property. The rules for sending replies from SOAP transport handlers
are as follows:
<wsa:ReplyTo> SOAPHeader entry is set and if the
MessagePipeline result is not null, then a reply is sent to the end
point specified by <wsa:ReplyTo>. Note that the MessagePipeline
result must be a EAIXMLMessage or a EAIXMLMessageWithAttachments.<wsa:ReplyTo> SOAPHeader entry is set and if the
MessagePipeline result is null, then a BrokerAcknowledgement Message
is sent to the end point specified by <wsa:ReplyTo>.<wsa:FaultTo> SOAPHeader entry of the incoming message is set,
then the environment property 'onExceptionSendBrokerErrorMessage'
determines whether a SOAPFault or a org.osesb.msgrouting.BrokerErrorMessage
is sent to the end point specified by <wsa:FaultTo>. If an error
occurred during message processing then the 'receiveMessageException'
is not null.<wsa:ReplyTo>, they are only returned to <wsa:FaultTo>.<wsa:ReplyTo>
or a <wsa:FaultTo> end point, depending on the entries in the
<wsa:MetaData> tag of the <wsa:ReplyTo> or <wsa:FaultTo>
EndpointReferences. The approaches are implemented by seperate methods, namely
sendReplyUsingJAXRPCClient() and sendReplyUsingSOAPConnection().
<MetaData> tag of the
destination EndpointReference to carry JAXRPCConfiguration, which
is used to construct a JAXRPCDynamicClient to send the reply. The problem
with this approach is that JAXRPCDynamicClient sets properties on the jax-rpc
Call object and some SOAP engines, like WLS 8.1.x, do not support programmer-defined
Call object properties. So in order to use this approach in WLS 8.1.x, Axis
has to be configured as the SOAP client and this involves the adding Axis
jars to the front of the class path that WLS is loaded with. This effects
all applications in that server instance and is unacceptable solution for
WLS 8.1.x. The advantages to this approach are 1) the WSDL of the target
end point is used to send the reply, 2) JAXRPCDynamicClient(s) can be pooled
and 3) the jax-rpc client pool configurations can include jax-rpc handlers.<operationName> and
<targetNamespace> elements in the <wsa:MetaData> tag of the
destination EndpointReference to construct the reply SOAPMessage using
rpc-style invocation. Then a SOAPConnectionFactory is used to create a
SOAPConnection and invoke it's call() method passing the <wsa:Address> and
the reply SOAPMessage. The advantage to this approach is that
it does not require any special features and should be universally supported
by SOAP engines.
originatingXMLMessage - The XML message for which a reply is being sent.messagePipelineResult - The result, if any, from the target MessagePipeline that will
be sent as the reply.receiveMessageException - An Exception thrown by the receiveMessage method, if any.
<wsa:ReplyTo> or
<wsa:FaultTo>.
java.lang.Exception - if there is a problem sending the reply.
protected java.lang.String sendReplyUsingJAXRPCClient(java.lang.String originatingXMLMessage,
EAIMessage messagePipelineResult,
java.lang.Throwable receiveMessageException)
throws java.lang.Exception
<wsa:ReplyTo> or <wsa:FaultTo> tags in the
SOAPHeader of the incoming message.
How replies and faults are returned from SOAP transport handlers
is determined by a combination of factors, including the receiveXXX()
method that is invoked, the ws-addressing <wsa:ReplyTo> and
<wsa:FaultTo> tags in the SOAPHeader of the incoming message,
whether or not MessageRouter#routeEAIMessage() returns a result,
and the setting of the 'onExceptionSendBrokerErrorMessage' environment
property. The rules for sending replies from SOAP transport handlers
are as follows:
<wsa:ReplyTo> SOAPHeader entry is set and if the
MessagePipeline result is not null, then a reply is sent to the end
point specified by <wsa:ReplyTo>. Note that the MessagePipeline
result must be a EAIXMLMessage or a EAIXMLMessageWithAttachments.<wsa:ReplyTo> SOAPHeader entry is set and if the
MessagePipeline result is null, then a BrokerAcknowledgement Message
is sent to the end point specified by <wsa:ReplyTo>.<wsa:FaultTo> SOAPHeader entry of the incoming message is set,
then the environment property 'onExceptionSendBrokerErrorMessage'
determines whether a SOAPFault or a org.osesb.msgrouting.BrokerErrorMessage
is sent to the end point specified by <wsa:FaultTo>. If an error
occurred during message processing then the 'receiveMessageException'
is not null.<wsa:ReplyTo>, they are only returned to <wsa:FaultTo>.
originatingXMLMessage - The XML message for which a reply is being sent.messagePipelineResult - The result, if any, from the target MessagePipeline that will
be sent as the reply.receiveMessageException - An Exception thrown by the receiveMessage method, if any.
<wsa:ReplyTo> or
<wsa:FaultTo>.
java.lang.Exception - if there is a problem sending the reply.
protected java.lang.String sendReplyUsingSOAPConnection(java.lang.String originatingXMLMessage,
EAIMessage messagePipelineResult,
java.lang.Throwable receiveMessageException)
throws java.lang.Exception
<wsa:ReplyTo>
or <wsa:FaultTo> tags in the SOAPHeader of the incoming
message.
How replies and faults are returned from SOAP transport handlers
is determined by a combination of factors, including the receiveXXX()
method that is invoked, the ws-addressing <wsa:ReplyTo> and
<wsa:FaultTo> tags in the SOAPHeader of the incoming message,
whether or not MessageRouter#routeEAIMessage() returns a result,
and the setting of the 'onExceptionSendBrokerErrorMessage' environment
property. The rules for sending replies from SOAP transport handlers
are as follows:
<wsa:ReplyTo> SOAPHeader entry is set and if the
MessagePipeline result is not null, then a reply is sent to the end
point specified by <wsa:ReplyTo>. Note that the MessagePipeline
result must be a EAIXMLMessage or a EAIXMLMessageWithAttachments.<wsa:ReplyTo> SOAPHeader entry is set and if the
MessagePipeline result is null, then a BrokerAcknowledgement Message
is sent to the end point specified by <wsa:ReplyTo>.<wsa:FaultTo> SOAPHeader entry of the incoming message is set,
then the environment property 'onExceptionSendBrokerErrorMessage'
determines whether a SOAPFault or a org.osesb.msgrouting.BrokerErrorMessage
is sent to the end point specified by <wsa:FaultTo>. If an error
occurred during message processing then the 'receiveMessageException'
is not null.<wsa:ReplyTo>, they are only returned to <wsa:FaultTo>.
originatingXMLMessage - The XML message for which a reply is being sent.messagePipelineResult - The result, if any, from the target MessagePipeline that will
be sent as the reply.receiveMessageException - An Exception thrown by the receiveMessage method, if any.
<wsa:ReplyTo> or
<wsa:FaultTo>.
java.lang.Exception - if there is a problem sending the reply.
protected EAIXMLMessageWithAttachments getMessagePipelineResult(EAIMessage messagePipelineResult)
throws java.lang.Exception
messagePipelineResult - The result of MessagePipeline processing.
java.lang.Exception - If messagePipelineResult is not null and is not a
EAIXMLMessage or a EAIXMLMessageWithAttachments or if the XML portion
of the messagePipelineResult is empty.
public BrokerAcknowledgementMessage constructBrokerAcknowledgementMessage(java.lang.String message,
javax.xml.namespace.QName relatesToMessageType,
java.lang.String relatesToMessageID)
<wsa:ReplyTo> entry in the SOAPHeader of an incoming SOAPMessage.
If MessagePipeline processing of an incoming message does not produce
a result, then:
<wsa:ReplyTo> entry in the SOAPHeader
is set for an incoming SOAPMessage, then a BrokerAcknowledgementMessage
is sent to the specified destination.
public BrokerErrorMessage constructBrokerErrorMessage(java.lang.String message,
javax.xml.namespace.QName relatesToMessageType,
java.lang.String relatesToMessageID)
<wsa:FaultTo> entry in the SOAPHeader of an incoming SOAPMessage.
If an error occurs during MessagePipeline processing of an incoming
message, then:
<wsa:FaultTo> entry in the SOAPHeader of the incoming
message is set, then either a SoapFault or a BrokerErrorMessage is sent to the end
point specified by <wsa:FaultTo>, depending on the setting of the
'onExceptionSendBrokerErrorMessage' environment property.
public java.util.List getSOAPRequestAttachments()
public JAXRPCWSAddressingConfiguration getWSAddressingSOAPHeaderEntries()
public WSSSecurityProfile getWSSecuritySOAPHeaderEntries()
protected void logMessage(java.lang.String messageID,
java.lang.String xmlMessageText,
int numberOfAttachments)
messageID - The ID of the incoming message from the
<wsa:MessageID> entry in the SOAPHeader,
if any.xmlMessageText - The incoming XML message.numberOfAttachments - The number of attachments in the incoming message.
public void ejbCreate()
throws javax.ejb.CreateException
ejbCreate in class TransportHandlerBasejavax.ejb.CreateExceptionpublic void ejbRemove()
TransportHandlerBase
ejbRemove in interface javax.ejb.SessionBeanejbRemove in class TransportHandlerBasepublic void ejbActivate()
ejbActivate in interface javax.ejb.SessionBeanpublic void ejbPassivate()
ejbPassivate in interface javax.ejb.SessionBeanpublic javax.ejb.SessionContext getSessionContext()
public void setSessionContext(javax.ejb.SessionContext sessionContext)
setSessionContext in interface javax.ejb.SessionBean
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||