Re: SOAP Managment/ intercept request and response
Don't think so. AFAIK, the response has to be after the web service has completed, and that only a request or a response can be handled during a phase - not both. You are correct in that the message context gets regenerated. HTH, Robert http://www.braziloutsource.com/On 4/14/06, Riadh BEN HALIMA < [EMAIL PROTECTED]> wrote: Thanks Robet. I'm already using 2 handlers, but I would like to set the "information" in the requesthandler, and to get it in the responsehandler. Can I do this with just one handler? So, I think that the server-response regenerates a new soap message and delete all "information" in the soap-request message. Is it right? Riadh. - Original Message - From: robert lazarski To: axis-user@ws.apache.org Sent: Friday, April 14, 2006 12:37 PM Subject: Re: SOAP Managment/ intercept request and response The way I do this is: Client side handler, handleRequest --> tweak request --> soapCtx.setMessage(soapMsg); --> send to web service --> service side handler, handleRequest --> evaluate tweaked request. So you have two handlers - one client side, other service side. Each tweak has to be put back into the SOAPContext. One tweak by a handler is read by another. So the first step is to verify with tcpmon or the soap monitor that your tweak is being put in properly. Then you have to decide where you want to use it. HTH, Robert http://www.braziloutsource.com/ On 4/14/06, Riadh BEN HALIMA < [EMAIL PROTECTED]> wrote: Hi, I'm using Handler to intercept SOAP message.I append "an information" to the soap message Request, but i can't find it in the response!!Can you help me? My Handler contains this: //public boolean handleRequest(javax.xml.rpc.handler.MessageContext context) { 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(); // soap message enrichment Name name = se.createName("Test"); SOAPHeaderElement hdr = sh.addHeaderElement(name); hdr.addTextNode("DATA"); }catch (SOAPException ex) {ex.printStackTrace();}}return true;} public boolean handleResponse(javax.xml.rpc.handler.MessageContext context) {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(); java.util.Iterator it= sh.examineAllHeaderElements();String tab[]=new String[10]; try{int i=0; while (it.hasNext()) { SOAPHeaderElement e =(SOAPHeaderElement)it.next(); tab[i] =e.getValue(); System.out.println(tab[i]); i++; // I can't find (int the table) the request enrichment (Test & DATA) } } catch (SOAPException ex) {ex.printStackTrace();} }return true;} // Thanks in advance. Riadh
Re: SOAP Managment/ intercept request and response
Thanks Robet. I'm already using 2 handlers, but I would like to set the "information" in the requesthandler, and to get it in the responsehandler. Can I do this with just one handler? So, I think that the server-response regenerates a new soap message and delete all information in the soap-request message. Is it right? Riadh. - Original Message - From: robert lazarski To: axis-user@ws.apache.org Sent: Friday, April 14, 2006 12:37 PM Subject: Re: SOAP Managment/ intercept request and response The way I do this is: Client side handler, handleRequest --> tweak request --> soapCtx.setMessage(soapMsg); --> send to web service --> service side handler, handleRequest --> evaluate tweaked request. So you have two handlers - one client side, other service side. Each tweak has to be put back into the SOAPContext. One tweak by a handler is read by another. So the first step is to verify with tcpmon or the soap monitor that your tweak is being put in properly. Then you have to decide where you want to use it. HTH, Robert http://www.braziloutsource.com/ On 4/14/06, Riadh BEN HALIMA < [EMAIL PROTECTED]> wrote: Hi, I'm using Handler to intercept SOAP message.I append "an information" to the soap message Request, but i can't find it in the response!!Can you help me? My Handler contains this: //public boolean handleRequest(javax.xml.rpc.handler.MessageContext context) { 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(); // soap message enrichment Name name = se.createName("Test"); SOAPHeaderElement hdr = sh.addHeaderElement(name); hdr.addTextNode("DATA"); }catch (SOAPException ex) {ex.printStackTrace();}}return true;} public boolean handleResponse(javax.xml.rpc.handler.MessageContext context) {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(); java.util.Iterator it= sh.examineAllHeaderElements();String tab[]=new String[10]; try{int i=0; while (it.hasNext()) { SOAPHeaderElement e =(SOAPHeaderElement)it.next(); tab[i] =e.getValue(); System.out.println(tab[i]); i++; // I can't find (int the table) the request enrichment (Test & DATA) } } catch (SOAPException ex) {ex.printStackTrace();} }return true;} // Thanks in advance. Riadh
Re: SOAP Managment/ intercept request and response
The way I do this is: Client side handler, handleRequest --> tweak request --> soapCtx.setMessage(soapMsg); --> send to web service --> service side handler, handleRequest --> evaluate tweaked request. So you have two handlers - one client side, other service side. Each tweak has to be put back into the SOAPContext. One tweak by a handler is read by another. So the first step is to verify with tcpmon or the soap monitor that your tweak is being put in properly. Then you have to decide where you want to use it. HTH, Robert http://www.braziloutsource.com/On 4/14/06, Riadh BEN HALIMA < [EMAIL PROTECTED]> wrote: Hi, I'm using Handler to intercept SOAP message.I append "an information" to the soap message Request, but i can't find it in the response!!Can you help me? My Handler contains this: //public boolean handleRequest(javax.xml.rpc.handler.MessageContext context) { 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(); // soap message enrichment Name name = se.createName("Test"); SOAPHeaderElement hdr = sh.addHeaderElement(name); hdr.addTextNode("DATA"); }catch (SOAPException ex) {ex.printStackTrace();}}return true;} public boolean handleResponse(javax.xml.rpc.handler.MessageContext context) {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(); java.util.Iterator it= sh.examineAllHeaderElements();String tab[]=new String[10]; try{int i=0; while (it.hasNext()) { SOAPHeaderElement e =(SOAPHeaderElement)it.next(); tab[i] =e.getValue(); System.out.println(tab[i]); i++; // I can't find (int the table) the request enrichment (Test & DATA) } } catch (SOAPException ex) {ex.printStackTrace();} }return true;} // Thanks in advance. Riadh
SOAP Managment/ intercept request and response
Hi, I'm using Handler to intercept SOAP message.I append "an information" to the soap message Request, but i can't find it in the response!!Can you help me? My Handler contains this: //public boolean handleRequest(javax.xml.rpc.handler.MessageContext context) { 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(); // soap message enrichment Name name = se.createName("Test"); SOAPHeaderElement hdr = sh.addHeaderElement(name); hdr.addTextNode("DATA"); }catch (SOAPException ex) {ex.printStackTrace();}}return true;} public boolean handleResponse(javax.xml.rpc.handler.MessageContext context) {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(); java.util.Iterator it= sh.examineAllHeaderElements();String tab[]=new String[10]; try{int i=0; while (it.hasNext()) { SOAPHeaderElement e =(SOAPHeaderElement)it.next(); tab[i] =e.getValue(); System.out.println(tab[i]); i++; // I can't find (int the table) the request enrichment (Test & DATA) } } catch (SOAPException ex) {ex.printStackTrace();} }return true;} // Thanks in advance. Riadh