You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Charitha Kankanamge <ch...@wso2.com> on 2007/11/28 10:04:02 UTC
[Axis2] How can I access response SOAP envelope?
Folks,
I tried to access the response soap envelope using Axis2 client API as
follows.
OperationContext operationContext =
stub._getServiceClient().getLastOperationContext();
MessageContext messageContext =
operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
System.out.println(messageContext.getEnvelope().toString());
However, the following exception was thrown when running the client.
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'v'
(code 118) in epilog; expected '<'
at [row,col {unknown-source}]: [1,425]
at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:623)
at
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1071)
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153)
I'm not sure if the above is the correct way of accessing soap response
at client side. Can someone please check the above and let me know? I'm
using Axis2-1.3 in winxp.
regards
Charitha
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] How can I access response SOAP envelope?
Posted by Charitha Kankanamge <ch...@wso2.com>.
I was able to resolve the problem by using serviceClient directly
without generating it through stub._getServiceClient(). Hence, if you
want to access the soap response, make sure to use serviceClient as follows.
ServiceClient serviceclient = new ServiceClient();
OperationContext operationContext = serviceclient.getLastOperationContext();
MessageContext messageContext =
operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
System.out.println(messageContext.getEnvelope().toString());
regards
Charitha
Charitha Kankanamge wrote:
> Folks,
>
> I tried to access the response soap envelope using Axis2 client API as
> follows.
>
> OperationContext operationContext =
> stub._getServiceClient().getLastOperationContext();
> MessageContext messageContext =
> operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> System.out.println(messageContext.getEnvelope().toString());
>
> However, the following exception was thrown when running the client.
>
> com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'v'
> (code 118) in epilog; expected '<'
> at [row,col {unknown-source}]: [1,425]
> at
> com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:623)
> at
> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
>
> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1071)
> at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153)
>
>
> I'm not sure if the above is the correct way of accessing soap
> response at client side. Can someone please check the above and let me
> know? I'm using Axis2-1.3 in winxp.
>
> regards
> Charitha
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
--
Charitha Kankanamge
WSO2 inc.
Flower Road, Colombo 07
+94 714268070
A bug in the hand is better than one as yet undetected
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] How can I access response SOAP envelope?
Posted by Antonio Manuel Muñiz Martín <am...@gmail.com>.
If you are using XMLBenas as data binding, try:
YourOperationResponseDocument respose = stub.yourOperation();
String xmlSoap = response.toString();
I don´t know if ADB offers toString method.
Bye.
2007/11/28, Charitha Kankanamge <ch...@wso2.com>:
>
> Folks,
>
> I tried to access the response soap envelope using Axis2 client API as
> follows.
>
> OperationContext operationContext =
> stub._getServiceClient().getLastOperationContext();
> MessageContext messageContext =
> operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> System.out.println(messageContext.getEnvelope().toString());
>
> However, the following exception was thrown when running the client.
>
> com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'v'
> (code 118) in epilog; expected '<'
> at [row,col {unknown-source}]: [1,425]
> at
> com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:623)
> at
> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java
> :2047)
> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1071)
> at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java
> :153)
>
> I'm not sure if the above is the correct way of accessing soap response
> at client side. Can someone please check the above and let me know? I'm
> using Axis2-1.3 in winxp.
>
> regards
> Charitha
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>