2 Replies Latest reply on Jun 12, 2011 7:24 PM by nafees sharif

    Debug web services request/response

    miragpl Newbie

      Hi everyone,

      Is there any way to turn on traces that would show request/response of webservice call?

      If so please please write also the the place where the log should be enabled.


      Thanks in advance

        • 1. Re: Debug web services request/response
          Miklós Kasza Newbie



          are you looking for this: JBossWS - Log4j? Btw. as of AS 4.x and 5.x, you can find jboss-log4j.xml in



          directory. As of AS 6, the file



          can be used similarly.


          I hope it helped.

          • 2. Re: Debug web services request/response
            nafees sharif Newbie

            Hello MK,


            We used a handler chain to log our outgoing and incoming messages. This is a three step process, which is as follows:


            1- Annotate the Service class with the handler configuration file.

                 Example: @HandlerChain (file="handlers.xml")


            2- Define the handlers.xml file as follows (this file needs to be on classpath):

                 Example: see below

                 <handler-chains xmlns="http://java.sun.com/xml/ns/javaee"> 








            3- Create LoggingHandler java file

                 Example: see attached!


                public class LoggingHandler implements SOAPHandler<SOAPMessageContext> {


                    public Set<QName> getHeaders() {

                        return null;



                    public void close(MessageContext context) {



                    public boolean handleFault(SOAPMessageContext context) {


                        return true;



                    public boolean handleMessage(SOAPMessageContext context) {


                        return true;



                    private void logToSystemOut(SOAPMessageContext smc) {

                        Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

                        try {


                        } catch (SOAPException e1) {



                        SOAPMessage message = smc.getMessage();

                        String header = "";

                        if (outboundProperty.booleanValue()) {

                            header = "Outgoing Message: ";

                        } else {

                            header = "Incoming Message: ";


                        try {

                            ByteArrayOutputStream baos = new ByteArrayOutputStream();

                            message.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);


                            System.out.println(header + baos.toString());

                        } catch (Exception e) {