axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Riadh BEN HALIMA" <riadh.ben.hal...@laas.fr>
Subject Re: [Axis14] Newbie: How to get XML data which is sent over network?
Date Wed, 21 Jun 2006 12:23:34 GMT
ok,

You put ClientHandler.java in the client folder, and add those lines to your client code:
java.util.List list = helloService.getHandlerRegistry().getHandlerChain(new QName(nameSpaceUri,
portName));

list.add(new javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null));


ClientHandler.java 

import javax.xml.rpc.handler.soap.*;

import javax.xml.soap.*;


public class ClientHandler implements javax.xml.rpc.handler.Handler { 

public ClientHandler() {

}


public boolean handleRequest(javax.xml.rpc.handler.MessageContext context) {

System.out.println("ClientHandler: In handleRequest");



if (context instanceof SOAPMessageContext) {

try {

SOAPMessageContext soapMsgCtx = (SOAPMessageContext)context;

SOAPMessage soapMsg = soapMsgCtx.getMessage();

SOAPPart sp = soapMsg.getSOAPPart();

SOAPEnvelope se = sp.getEnvelope();

SOAPBody sb = se.getBody();

SOAPHeader sh = se.getHeader();


System.out.println("SOAP in: ");

System.out.println(se.toString());



}

catch (SOAPException ex) {ex.printStackTrace();}

}




return true;

}


public boolean handleResponse(javax.xml.rpc.handler.MessageContext context) {

System.out.println("ClientHandler: In handleResponse");



if (context instanceof SOAPMessageContext) {

try {

SOAPMessageContext soapMsgCtx = (SOAPMessageContext)context;

SOAPMessage soapMsg = soapMsgCtx.getMessage();

SOAPPart sp = soapMsg.getSOAPPart();

SOAPEnvelope se = sp.getEnvelope();

SOAPBody sb = se.getBody();

SOAPHeader sh = se.getHeader();

System.out.println("SOAP in: "); 

System.out.println(se.toString());




}

catch (SOAPException ex) {ex.printStackTrace();}

}


//*******************************************************************/



return true;

}

public boolean handleFault(javax.xml.rpc.handler.MessageContext context) {

System.out.println("ClientHandler: In handleFault");

return true;

}

public void init(javax.xml.rpc.handler.HandlerInfo config) {

}

public void destroy() {

}

public javax.xml.namespace.QName[] getHeaders() {

return null;

}

}



Wi can also make a Handler in the server side.

Good luck

Riadh


  ----- Original Message ----- 
  From: Axel Bock 
  To: axis-user@ws.apache.org 
  Sent: Wednesday, June 21, 2006 12:37 PM
  Subject: Re: [Axis14] Newbie: How to get XML data which is sent over network?


  Hi Riadh, 

  that is a good hint, thank you, but without wanting you to do my work - could you maybe
provide a very minimum example? :-) that would be great!


  Greetings & thanks, 
  Axel.


  On 6/21/06, Riadh BEN HALIMA <riadh.ben.halima@laas.fr> wrote:
    Hi, 
    TrYou can use Axis Handlers!
    -------------------------------

    Riadh 
    ----- Original Message ----- 
      From: Axel Bock 
      To: axis-user@ws.apache.org 
      Sent: Wednesday, June 21, 2006 11:21 AM
      Subject: [Axis14] Newbie: How to get XML data which is sent over network?


      Hi all, 

      I am using Axis 1.4 with generated stubs to call some web services. Now I would really
like to get to the XML data which is sent by Axis over the network, but using a sniffer is
(1) cumbersome and (2) very hard, for the web service uses a HTTPS connection. 

      So I hope that maybe one of the gurus in here could hack in some lines of example code
about how I could achieve this :) . 

      That would be really great ... 


      Thanks in advance & greetings, 
      Axel. 



Mime
View raw message