Hi,
I need to print the content of every request/response/fault that comes in or goes out
from my JAX-RPC web service, that runs under JBoss 4.0.4.
I created a hadler that extends javax.xml.rpc.handler.GenericHandler. I can intercept
every request / response / fault but I can't get the content of the SOAPBody as a text
in the xml format.
This is what I've tried:
| public class mywsLogHandler extends GenericHandler
| {
|
| ........
| public boolean handleRequest(MessageContext ctx)
| {
| if (ctx instanceof SOAPMessageContext)
| {
| try
| {
| SOAPMessageContext context = (SOAPMessageContext)ctx;
| SOAPEnvelope env = context.getMessage().getSOAPPart().getEnvelope();
| SOAPBody body = env.getBody();
| System.out.println(body.getTextContent());
| }
| catch (SOAPException ex)
| { }
| }
| }
|
| ..................
| }
|
I was expecting to see something like :
| <soapenv:Envelope
xmlns:myws='http://www.mycom.com/myws/'
|
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
| <soapenv:Header/>
| <soapenv:Body>
| <myws:QueryRequest>
| <Element1>this is a test</Element1>
| </myws:QueryRequest>
| </soapenv:Body>
| </soapenv:Envelope>
|
being printen, but instead I get the following Rintime exception:
| 10:16:48,908 WARN [HandlerWrapper] RuntimeException in handler method, transition to
DOES_NOT_EXIST
| 10:16:48,908 DEBUG [HandlerWrapper] destroy:
com.mycom.myws.ws.handler.mywsLogHandler@125e791
| 10:16:50,268 ERROR [HandlerChainBaseImpl] RuntimeException in request handler
| org.jboss.util.NotImplementedException: getTextContent
| at org.jboss.ws.soap.NodeImpl.getTextContent(NodeImpl.java:622)
| at com.mycom.myws.ws.handler.mywsLogHandler.handleRequest(mywsLogHandler.java:72)
| at org.jboss.ws.handler.HandlerWrapper.handleRequest(HandlerWrapper.java:121)
| at
org.jboss.ws.handler.HandlerChainBaseImpl.handleRequest(HandlerChainBaseImpl.java:254)
| at org.jboss.ws.handler.ServerHandlerChain.handleRequest(ServerHandlerChain.java:47)
| at
org.jboss.ws.server.ServiceEndpointInvoker.callRequestHandlerChain(ServiceEndpointInvoker.java:211)
| at
org.jboss.ws.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:104)
| at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:234)
| at
org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:120)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Unknown Source)
| 10:16:50,268 DEBUG [HandlerChainBaseImpl] Exit: handleRequest with status: false
| 10:16:50,283 DEBUG [SOAPFaultException] new SOAPFaultException
[
code={http://schemas.xmlsoap.org/soap/envelope/}Client,string=org.jboss.u...:
getTextContent,actor=null,detail=null]
| 10:16:50,283 ERROR [SOAPFaultExceptionHelper] SOAP request exception
| org.jboss.util.NotImplementedException: getTextContent
| at org.jboss.ws.soap.NodeImpl.getTextContent(NodeImpl.java:622)
| at com.mycom.myws.ws.handler.mywsLogHandler.handleRequest(mywsLogHandler.java:72)
| at org.jboss.ws.handler.HandlerWrapper.handleRequest(HandlerWrapper.java:121)
| at
org.jboss.ws.handler.HandlerChainBaseImpl.handleRequest(HandlerChainBaseImpl.java:254)
| at org.jboss.ws.handler.ServerHandlerChain.handleRequest(ServerHandlerChain.java:47)
| at
org.jboss.ws.server.ServiceEndpointInvoker.callRequestHandlerChain(ServiceEndpointInvoker.java:211)
| at
org.jboss.ws.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:104)
| at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:234)
| at
org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:120)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Unknown Source)
| 10:16:50,315 DEBUG [HandlerChainBaseImpl] Enter: handleFault
| 10:16:50,315 DEBUG [HandlerChainBaseImpl] Handle fault:
[state=DOES_NOT_EXIST,handler=com.mycom.myws.ws.handler.mywsLogHandler@125e791]
| 10:16:50,315 WARN [HandlerWrapper] Handler is in state DOES_NOT_EXIST, skipping
Handler.handleFault for: com.mycom.myws.ws.handler.mywsLogHandler@125e791
| 10:16:50,315 DEBUG [HandlerChainBaseImpl] Exit: handleFault with status: true
| 10:16:50,315 DEBUG [ServiceEndpoint] Outgoing SOAPMessage
| <env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
| <env:Header/>
| <env:Body>
| <env:Fault>
| <faultcode>env:Client</faultcode>
| <faultstring>org.jboss.util.NotImplementedException:
getTextContent</faultstring>
| </env:Fault>
| </env:Body>
| </env:Envelope>
| 10:16:50,315 DEBUG [ServiceEndpoint] END handleRequest:
jboss.ws:di=myws.war,service=mywsService,port=mywsSOAP
| 10:16:50,315 DEBUG [MessageContextAssociation] popMessageContext:
org.jboss.ws.soap.SOAPMessageContextImpl@da2610
|
Could anybody, please, tell me why this isn't working, could this possibly be a bug?
Thanks.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073899#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...