JAX-WS: There is no way to efficiently access the message as a String within a
handler
--------------------------------------------------------------------------------------
Key: AXIS2-4815
URL: https://issues.apache.org/jira/browse/AXIS2-4815
Project: Axis2
Issue Type: Improvement
Components: jaxws
Reporter: Rich Scheuerle
Assignee: Rich Scheuerle
Summary:
Customers use a JAX-WS application handler to query or modify the incoming or
outgoing message. Here is one common use cases:
1) A handler is used to log the incoming or outgoing
message.
Customers migrating an application from JAX-RPC will often use a JAX-WS
SOAPHandler (jaxws.xml.ws.handler.soap.SOAPHandler) because it supports the
same SAAJ data model as JAX-RPC.
The SAAJ data model is the only SOAP-aware data model supported by the JAX-WS
specification. However there are some drawbacks to the SAAJ model:
A) Accessing the message as an SAAJ SOAPMessage causes the entire XML
message to be rendered as an SAAJ SOAPElement graph. This transformation
increases the memory footprint and processing time.
B) After the handlers have completed, the message must be transformed back
into the data rendering required for the target method. For example, the SAAJ
SOAPElement graph is
converted into a JAXB bean. This transformation also increases the memory
footprint and processing time.
Solution:
A new property will be added to the JAX-WS runtime which can be queried by a
customer's hander to access the message as a String.
The property is associated with the
javax.xml.ws.handler.MessageContext object.
Property Name: "jaxws.message.accessor"
Property Value: null or Object
The customer can call the toString() method on the returned object to access
the message as a String.
Here is an example usage:
public myHandler implements SOAPHandler {
...
public boolean handleMessage(MessageContext mc) {
Object accessor = mc.getProperty(jaxws.message.accessor");
if (accessor != null) {
msgText = accessor.toString();
myLogger(msgText);
}
..
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]