rmartony, here's what I ended up doing to log my full SOAP message. It's based
heavily on the example handlers included with JBossWS.
| public class ProtocolHandler extends GenericSOAPHandler
| {
| /**
| * The [EMAIL PROTECTED] Logger} used for writing logging messages.
| */
| private static Logger log = Logger.getLogger(ProtocolHandler.class);
|
| /* (non-Javadoc)
| * @see
org.jboss.ws.core.jaxws.handler.GenericSOAPHandler#handleOutbound(javax.xml.ws.handler.MessageContext)
| */
| @Override
| public boolean handleOutbound(final MessageContext msgContext)
| {
| if (log.isInfoEnabled())
| {
| return logMessage(msgContext);
| }
| return true;
| }
|
| /* (non-Javadoc)
| * @see
org.jboss.ws.core.jaxws.handler.GenericSOAPHandler#handleInbound(javax.xml.ws.handler.MessageContext)
| */
| @Override
| public boolean handleInbound(final MessageContext msgContext)
| {
| if (log.isInfoEnabled())
| {
| return logMessage(msgContext);
| }
| return true;
| }
|
| /**
| * Logs the full SOAP message.
| *
| * @param messageContext The message context containing the SOAP
message to be handled.
| * @return True if handler processing should continue, false otherwise.
| * @throws WebServiceException If the SOAP message is malformed.
| */
| private boolean logMessage(final MessageContext messageContext)
| {
| try
| {
| SOAPMessage soapMessage = ((SOAPMessageContext)
messageContext).getMessage();
| if
(soapMessage.getSOAPBody().getChildElements().hasNext())
| {
| SOAPElement soapElement = (SOAPElement)
soapMessage.getSOAPBody().getChildElements().next();
| if (soapElement.getChildElements().hasNext())
| {
| soapElement = (SOAPElement)
soapElement.getChildElements().next();
|
| ByteArrayOutputStream xmlStream = new
ByteArrayOutputStream();
| soapMessage.writeTo(xmlStream);
| log.info(new
String(xmlStream.toByteArray()));
| }
| }
|
| return true;
| }
| catch (SOAPException ex)
| {
| throw new WebServiceException(ex);
| }
| catch (IOException ex)
| {
| throw new WebServiceException(ex);
| }
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035389#4035389
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035389
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user