If you provide us an AAR file with (a dummy version of) the service and a Java program that reproduces this issue, we can have a look at it.
Andreas On Fri, Feb 27, 2009 at 17:19, Geuze, Marinus <[email protected]> wrote: > Hi Axis2 Users, > > Is there no one else who has an idea? > > I would really like to get this working. > > Kind regards, > Marinus > > -----Original Message----- > From: Sagara Gunathunga [mailto:[email protected]] > Sent: donderdag 26 februari 2009 14:13 > To: [email protected] > Subject: Re: Retry: Axis2 - Retrieving SOAPBody through MessageContext > versus OMException (WstxUnexpectedCharException) > > Hi Marinus, > > I don't have exact idea about the exception you got , may be input > stream is closed or in a invalid state when the time of you access > it using getLastOperationContext() method, someone more knowledgeable > will share his insights regarding this . > > Meanwhile try to access in coming SOAP message using the return object > (CancelBookingResponseDocument) as follows . > > output.getOMElement(null,null).serialize(System.out); > > Instead of System.out you can use any OutPutStream with serialize > method, Hope this will work with you. > > Thanks , > > On Thu, Feb 26, 2009 at 3:20 PM, Geuze, Marinus > <[email protected]> wrote: >>> Dear Axis2 Users, >>> >>> I hope you can help me with this problem. >>> >>> This is the situation. I use the Axis2 framework for accessing a >>> WebService. When I use the generated Stub then everything works perfectly >>> fine. However I want to obtain the actual message which is sent to and >>> received from the WebService. This is for logging reasons. Here the problem >>> starts. See my code example below. >>> >>> //Create Stub >>> QuickCarRentalServiceStub testStub = new QuickCarRentalServiceStub(url); >>> >>> //Set Stub options (only those who are needed) >>> Options options = testStub._getServiceClient().getOptions(); >>> >>> //Set http protocol version >>> options.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, >>> HTTPConstants.HEADER_PROTOCOL_11); >>> >>> //Set soap version (example: SOAP 1.1 (SOAP11Constants) or SOAP 1.2 >>> //(SOAP12Constants)) >>> options.setSoapVersionURI( >>> org.apache.axiom.soap.SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); >>> >>> //Set input of proxy method >>> CancelBookingDocument input = CancelBookingDocument.Factory.newInstance(); >>> CancelBookingDocument.CancelBooking secondInput = >>> CancelBookingDocument.CancelBooking.Factory.newInstance(); >>> secondInput.setBookingId("1"); >>> input.setCancelBooking(secondInput); >>> >>> //Execute Stub method >>> CancelBookingResponseDocument output = testStub.cancelBooking(input); >>> >>> //Get output of proxy method >>> String responseAsString = output.getCancelBookingResponse().getResponse(); >>> >>> //Till now everything is fine. The responseAsString contains a valid value. >>> >>> MessageContext msgContextIn = >>> testStub._getServiceClient().getLastOperationContext().getMessageContext("In"); >>> SOAPEnvelope soapEnvIn = msgContextIn.getEnvelope(); >>> SOAPBody soapBodyIn = soapEnvIn.getBody(); >>> return soapBodyIn.toString(); >>> >>> The soapBodyIn.toString() throws a OMException with the errormessage > '> >>> com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'V' >>> (code 86) in epilog; expected '<' at [row,col {unknown-source}]: [1,593]> '> >>> >>> The returned soap message is (obtained with use of TCPMON, and the message >>> seems valid): >>> >>> <SOAP-ENV:Envelope >>> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >>> xmlns:xs="http://www.w3.org/2001/XMLSchema" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> ><SOAP-ENV:Body><rpl:cancelBookingResponse >>> xmlns:rpl='urn:QuickCarRentalServiceVi'><Response>1 >>> cancelled.</Response></rpl:cancelBookingResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> >>> >>> My question is this: Why does the output object work and why does the >>> soapBodyIn.toString() fails? I really hope someone can help. >>> >>> I use Axis version 1.4.1 and Axiom version 1.2.8. >>> >>> Thanks in advantage. >>> >>> Kind regards, >>> Marinus >> > > > > -- > Sagara Gunathunga > > Blog - http://ssagara.blogspot.com > Web - http://sagaras.awardspace.com/ >
