Hi Andy,
I hope this helps.
I needed to trace the SOAP request / response payload to a file, so I added a handler.
The handler is called twice, once for the oubound request and again for the response.
I extended the HandlerInfo class so I could pass extra information.
http://java.sun.com/j2ee/1.4/docs/api/javax/xml/soap/SOAPMessage.html
I noticed that the SOAP request is missing the XML declaration.
This missing XML declaration was noticed by another axis user.
XML declaration no longer exists in Envelope
http://marc.theaimsgroup.com/?l=axis-user&m=110739322015013&w=2
==========================================================================================
QName portName = stub.getPortName () ;
Service service = stub._getService () ; // Axis 1.2 RC2
HandlerRegistry handlerRegistry = service.getHandlerRegistry () ;
List handlerChain = handlerRegistry.getHandlerChain ( portName ) ;
MyHandlerInfo handlerInfo = new MyMessageHandlerInfo () ;
handlerInfo.setHandlerClass ( com.lansa.jsm.service.SOAPAgentMessageHandler.class ) ;
handlerChain.add ( handlerInfo ) ;
handlerRegistry.setHandlerChain ( portName, handlerChain ) ;
==========================================================================================
public class MyHandlerInfo extends HandlerInfo
{
}
==========================================================================================
public class MyHandler implements Handler
{
public void init ( HandlerInfo handlerInfo ) throws JAXRPCException
{
if ( handlerInfo instanceof MyHandlerInfo )
{
}
}
public void destroy () throws JAXRPCException
{
}
public QName[] getHeaders ()
{
return new QName[0] ;
}
public boolean handleFault ( MessageContext messageContext ) throws JAXRPCException
{
return true ; // return true to continue processing
}
public boolean handleRequest ( MessageContext messageContext ) throws JAXRPCException
{
SOAPMessage message = ((SOAPMessageContext)messageContext).getMessage () ;
// message.writeTo ( outputStream ) ;
return true ; // return true to continue processing
}
public boolean handleResponse ( MessageContext messageContext ) throws JAXRPCException
{
return true ; // return true to continue processing
}
==========================================================================================
-----Original Message-----
From: Andy Dolbey [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 26 February 2005 2:49 PM
To: [email protected]
Subject: client-side access to request SOAP message, before submission
Does Axis offer any way for a client class to examine and perhaps
modify a SOAP request message immediately before the message is sent
across the wire? If so, this might offer me a chance to mend some
tricky interop problem cases I've been having with complex data types.
If anyone knows about this, and/or has had experiences with it, please
let me know.
Thanks!
Andy
