Client code does not parse AxisFault correctly.
-----------------------------------------------
Key: AXIS2-1846
URL: http://issues.apache.org/jira/browse/AXIS2-1846
Project: Apache Axis 2.0 (Axis2)
Issue Type: Bug
Components: client-api, codegen
Affects Versions: 1.1
Environment: Linux.
Reporter: Sathija Pavuluri
I am investigating the exception handling capability of Axis and created a
sample web service.
My axis web service is throwing an exception wrapped inside an AxisFault. The
service uses rampart for security.
This is what is in the service class method:
if (devices == null) {
throw new AxisFault(new NullPointerException("No devices have been
rerieved"));
}
and the method throws AxisFault.
When i invoke this call and no exception is returned, the result is obtained
without a problem.
However, when I invoke the axis client which calls this service with parameters
in a way that I expect to get the NullPointerException above, I get the output
stack shown below.
org.apache.rampart.RampartException: Error in extracting message properties
at
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:281)
at org.apache.rampart.RampartEngine.process(RampartEngine.java:39)
at
org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:74)
at org.apache.axis2.engine.Phase.invoke(Phase.java:377)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:513)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:484)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:282)
at
com.emprisa.ena.ws.client.DeviceServiceStub.listDevices(DeviceServiceStub.java:157)
at
com.emprisa.ena.ws.client.DeviceServiceInvoker.invokeListDevices(DeviceServiceInvoker.java:83)
at
com.emprisa.ena.ws.client.DeviceServiceInvoker.main(DeviceServiceInvoker.java:66)
Caused by: org.apache.ws.security.WSSecurityException: Error in converting SOAP
Envelope to Document; nested exception is:
org.apache.axiom.om.OMException: java.lang.IllegalStateException:
Current state not START_ELEMENT
at
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:123)
at
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:145)
... 10 more
Caused by: org.apache.axiom.om.OMException: java.lang.IllegalStateException:
Current state not START_ELEMENT
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:199)
at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:316)
at
org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:620)
at
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:87)
... 11 more
Caused by: java.lang.IllegalStateException: Current state not START_ELEMENT
at
com.ctc.wstx.sr.BasicStreamReader.getAttributeCount(BasicStreamReader.java:582)
at
org.apache.axiom.om.impl.builder.StAXBuilder.processAttributes(StAXBuilder.java:130)
at
org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder.createOMElement(MTOMStAXSOAPModelBuilder.java:126)
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:125)
... 14 more
Given below is the soap response as seen in the tcp monitor. This response
looks as expected. I see the NullPointerException and the associated message.
--MIMEBoundaryurn_uuid_EFA4931C229F601AC111655076265521
content-type: application/xop+xml; charset=UTF-8; type="text/xml";
content-transfer-encoding: binary
content-id: <0.urn:uuid:[EMAIL PROTECTED]>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header />
<soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>No
devices have been rerieved; nested exception is:
java.lang.NullPointerException: No devices have been
rerieved</faultstring><detail>
<Exception>org.apache.axis2.AxisFault: No devices have been rerieved;
nested exception is:
java.lang.NullPointerException: No devices have been rerieved
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:184)
at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:493)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:324)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:234)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
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.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
</Exception></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
3b
--MIMEBoundaryurn_uuid_EFA4931C229F601AC111655076265521--
Something seems wrong with the way the client api is parsing the fault from the
soap body. And why do I see the RampartException anyway?
I've caught the AxisFault that is being thrown and it has no properties or the
NullPointerException, all is has is this:
org.apache.axis2.AxisFault: Error in extracting message properties; nested
exception is:
org.apache.rampart.RampartException: Error in extracting message
properties
I had posted the same on the user list and was asked to file a JIRA.
Thanks,
Sathija.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]