Hi Dragos,

i had this chunk in my services.xml for my service:

 <service>
    ....
    .....
   <inHandlers>
       <handler handlerClass="org.codehaus.xfire.util.dom.DOMInHandler"/>
       <handler handlerClass="org.codehaus.xfire.util.LoggingHandler"/>
   </inHandlers>
 </service>

and then the SOAP message was logged in my normal log4j file.

it was pretty straightforward.

regards
Ashok

On 4/27/07, Dragos Pavel <[EMAIL PROTECTED]> wrote:

I know this was asked before but there was not a concludent (conclusive)
answer to this question. Anyway I found only one relevant post to this:
http://www.mail-archive.com/[email protected]/msg02896.html
and personally I ran into the same problem as described in the post, no
SOAP content. More precise I created my own Handler etc as described on
the XFire website but the console output contains only
org.codehaus.xfire.handler.HandlerPipeline invocations but no SOAP
messages. I was trying to use the DOMInHandler and DOMOutHandler in
order to fetch the SOAP messages using XFire logging with no success.
FYI I was following and I read:
http://xfire.codehaus.org/MessageContext - getting at the xml
http://xfire.codehaus.org/FAQ - add custom handler


This is a simple custom handler that I used:
------------------------------------------------------
public class CustomHandler extends AbstractHandler
{
    //enable XFire logging
    private Log log = LogFactory.getLog(MDMHandler.class);

    public void invoke(MessageContext context)
    {
        log.info("invoke in MSMHandler was called");

        // get inbound and outbound messages
        Document inputDoc = (Document) context.getInMessage
().getProperty(org.codehaus.xfire.util.dom.DOMInHandler.DOM_MESSAGE);
        Document outputDoc = (Document) context.getOutMessage
().getProperty(org.codehaus.xfire.util.dom.DOMOutHandler.DOM_MESSAGE);


        System.out.println(inputDoc.toString());
        System.out.println(outputDoc.getXmlVersion());
        System.out.println(outputDoc.getLocalName());
        System.out.println(outputDoc.toString());

        log.info(inputDoc);
        log.info(outputDoc);

//        log.trace(inputDoc);
//        log.trace(outputDoc);
    }

}
------------------------------------------------------
and at the end of the client constructor I added this:
------------------------------------------------------
        //      Tell XFire to cache a DOM document for the various
in/out/fault flows
        service1.addInHandler(new
org.codehaus.xfire.util.dom.DOMInHandler());
        service1.addOutHandler(new
org.codehaus.xfire.util.dom.DOMOutHandler());
        service1.addFaultHandler(new
org.codehaus.xfire.util.dom.DOMOutHandler());

        //      Add a logging handler to each flow
        service1.addInHandler(new org.codehaus.xfire.util.LoggingHandler
());
        service1.addOutHandler(new
org.codehaus.xfire.util.LoggingHandler());
        service1.addFaultHandler(new
org.codehaus.xfire.util.LoggingHandler());
------------------------------------------------------
I don't think the CustomHandler's invoke method is called, or that it
intercepts the right MessageContext. How you get the proper context of a
web service developed with XFire? Because the rest of it (getting the
Document is clear). There is an XFire example available on the
internet ?


This is really important in order to test/ debug web services developed
in XFire.


Please let me know the right procedure in order to perform SOAP
tracing / monitoring using XFire. And last question: XFire logging will
work only for HTTP (exactly like TCOMON for example) or is it possible
to work as well for HTTPS endpoints ?

Thanks in advance,
Dragos


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to