Hello
thank you for your reply but I already tried it, as follows:
****
SOAPBody sb = soapenv.getBody();
OMElement soapb = (OMElement) sb.getFirstElement();
****
but this time, I get the following exception :
****
[INFO] OMException in getSOAPBuilder
org.apache.axiom.soap.SOAPProcessingException: First Element must
contain the local name, Envelope , but found html
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:251)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:209)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:191)
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:172)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:156)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:105)
at
org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:677)
at
org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:182)
at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:112)
at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:88)
at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:353)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at doc.FlexServStub.say_hello(FlexServStub.java:198)
at doc.FlexServClient.main(FlexServClient.java:33)
[INFO] Remaining input stream :[]
org.apache.axis2.AxisFault: First Element must contain the local name,
Envelope , but found html
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:90)
at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:353)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at doc.FlexServStub.say_hello(FlexServStub.java:198)
at doc.FlexServClient.main(FlexServClient.java:33)
Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element
must contain the local name, Envelope , but found html
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:251)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:209)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:191)
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:172)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:156)
at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:105)
at
org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:677)
at
org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:182)
at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:112)
at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:88)
... 6 more
****
If you have any suggestion, don't hesitate to procure me, please
Amila Suriarachchi a écrit :
On Wed, Sep 23, 2009 at 8:17 PM, Asma Maalej <[email protected]
<mailto:[email protected]>> wrote:
Hello
Using Axis2.1.4.1, and in order to recover methods name of a web
service within a handler code, I tried to access to the SOAP
message and extract it from the SOAPBody. Then, I tried to use
"SOAPBodyElement" Class
as shown below :
*****
SOAPEnvelope soapenv = messageContext.getEnvelope();
SOAPBodyElement soapb = (SOAPBodyElement) soapenv.getFirstElement();
use soapenv.getBody().getFirstElement()
thanks,
Amila.
String methodname = soapb.getLocalName();
************
but when I invoke the web service to which I engaged the module
that contains the above-mentioned handler, an exception launch :
****
org.apache.axiom.soap.impl.llom.soap12.SOAP12HeaderImpl cannot be
cast to org.apache.axiom.soap.impl.llom.SOAPBodyElement ****
and when I tried to convert "SOAPBodyElement" to "SOAPBodyImpl" it
launch the same exception but this time
****
org.apache.axiom.soap.impl.llom.soap12.SOAP12HeaderImpl cannot be
cast to org.apache.axiom.soap.impl.llom.SOAPBodyImpl
****
If you have any idea, don't hesitate to help me with, please
thanks
--
Asma MĀALEJ BESBES
Laboratoire LAAS - CNRS
Toulouse - France
Tčl: +33 (0)5 61 33 62 63
Mobile: +33 (0)6 72 18 36 56
E-mail: [email protected] <mailto:[email protected]>
--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/
--
Asma MÂALEJ BESBES
Laboratoire LAAS - CNRS
Toulouse - France
Tèl: +33 (0)5 61 33 62 63
Mobile: +33 (0)6 72 18 36 56
E-mail: [email protected]