Title: RE: Accessing unparsed XML

I use a Handler to trace the Axis client stub, SOAP XML request and response to a file.

=========================================================================

  QName portName = stub.getPortName () ;

  Service service = stub._getService () ; // Axis 1.2 RC2

  HandlerRegistry handlerRegistry = service.getHandlerRegistry () ;

  List handlerChain = handlerRegistry.getHandlerChain ( portName ) ;

  MyHandlerInfo handlerInfo = new MyHandlerInfo () ;

  handlerInfo.setHandlerClass ( MyHandler.class ) ;

  handlerChain.add ( handlerInfo ) ;

  handlerRegistry.setHandlerChain ( portName, handlerChain ) ;

=========================================================================

  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 () ;

        return true ; // return true to continue processing
    }

    public boolean handleResponse ( MessageContext messageContext ) throws JAXRPCException
    {
        return true ; // return true to continue processing
    }


-----Original Message-----
From: QM [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 26 March 2005 11:05 AM
To: [email protected]
Subject: Re: Accessing unparsed XML


On Fri, Mar 25, 2005 at 07:36:54PM +0100, Rumm Nikolaus wrote:
: I am using Axis for a SOAP client in Java. We need both the parsed
: document (for storing parts of it in a database) and the unparsed XML
: document (for transforming it into a PDF file using FOP).
:
: Is there any way to access the raw XML response ?

Instead of raw XML, what about the DOM tree (which can easily be serialized
back into raw XML)?

Look into Axis Handlers.  These are not too unlike servlet filters: you
insert them between the request and the service endpoint object (via
server-config.wsdd) and they can inspect/alter the request/response data.

I don't have the exact method names in front of me, but look in the Axis
docs (or just Google) for "Handler."  Handler objects have access to the
MessageContext, which holds (IIRC) the SoapEnvelope object, which in turn
holds the SOAP headers/body.

-QM

--

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

Reply via email to