axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yskm <sanatmas...@gmail.com>
Subject Re: How to change Axis2 response character encoding
Date Thu, 12 Mar 2009 05:15:17 GMT

Hi Andreas,

Thanks for your response, is there any way that we can get response stream
alone?

Thanks,
Sanat

=============
Sanat,

It is the responsibility of the service to choose the encoding it
wants to use in its response, and the service is expected to indicate
the encoding in the Content-Type and then to use that encoding in the
response. In your case the service fails to do so (unless you have
discovered a very rare bug in Axis2) and violates the SOAP specs. You
should collect the evidence for this by inspecting the response using
TCPMon or Wireshark and tell the people who developed this service to
fix it.

Andreas





yskm wrote:
> 
> Hi,
> 
> i am consuming a webservice (dont know the implementation of the service)
> for this i have written my client using axis2 1.4 and rampart 1.4, this
> client is working fine under normal response payload, if response contains
> any special characters like "Hello world ai?" i.e invalid UTF-8
> characters myclient is breaking... following is the stacktrace....
> 
> org.apache.axis2.AxisFault: Error in extracting message properties
> 	at
> org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:166)
> 	at
> org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
> 	at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
> 	at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
> 	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
> 	at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:363)
> 	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
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)
> 	at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
> 	at
> com.paypal.sparta.inbox.ws.OmnitureWSClient.callService(OmnitureWSClient.java:152)
> 	at
> com.paypal.sparta.inbox.ws.OmnitureWSClient.call2(OmnitureWSClient.java:88)
> 	at com.paypal.sparta.inbox.ws.OmnitureReport.main(OmnitureReport.java:35)
> Caused by: org.apache.rampart.RampartException: Error in extracting
> message properties
> 	at
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:322)
> 	at org.apache.rampart.RampartEngine.process(RampartEngine.java:70)
> 	at
> org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
> 	... 12 more
> Caused by: org.apache.ws.security.WSSecurityException: Error in converting
> SOAP Envelope to Document; nested exception is: 
> 	org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxIOException:
> Invalid UTF-8 middle byte 0x66 (at char #57163, byte #56398)
> 	at
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:161)
> 	at
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:158)
> 	... 14 more
> Caused by: org.apache.axiom.om.OMException:
> com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte 0x66 (at char
> #57163, byte #56398)
> 	at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:327)
> 	at
> org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:706)
> 	at
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:96)
> 	... 15 more
> Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte
> 0x66 (at char #57163, byte #56398)
> 	at com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:683)
> 	at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1086)
> 	at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:506)
> 	at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:161)
> 	... 18 more
> Caused by: java.io.CharConversionException: Invalid UTF-8 middle byte 0x66
> (at char #57163, byte #56398)
> 	at com.ctc.wstx.io.UTF8Reader.reportInvalidOther(UTF8Reader.java:313)
> 	at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:204)
> 	at com.ctc.wstx.io.MergedReader.read(MergedReader.java:101)
> 	at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:84)
> 	at
> com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
> 	at
> com.ctc.wstx.sr.StreamScanner.loadMoreFromCurrent(StreamScanner.java:1021)
> 	at com.ctc.wstx.sr.StreamScanner.parseLocalName2(StreamScanner.java:1771)
> 	at com.ctc.wstx.sr.StreamScanner.parseLocalName(StreamScanner.java:1731)
> 	at
> com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2912)
> 	at
> com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2846)
> 	at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
> 	... 20 more
> 
> 
> I tried different ways to change the character encoding of the response
> input stream 
> 
> 1) by adding following options before calling the service method, this
> didn't worked. 
> 
> options.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,"UTF-16");
> at what circumstance does this statement work??
> 
> 2) I tried adding a handler in the InFlow phase inside Transport and
> Addressing and with in the handler i added following statements 
> 
> 		SOAPEnvelope se = msgContext.getEnvelope();
>                 System.out.println(se);
> Here :) fortunately sysout is printing entire response payload , but the
> problem is it is printing up to valid UTF-8 characters, 
> 
> inspite of all these i didnt succeed in getting a response stream, 
> 
> i have two questions
> 1) can we change the response character encoding? before response stream
> is converted in to reader.
> 2) if not can we get raw response stream alone? later i will be parsing it
> in my program?
> 
> This is very urgent requirement any help would be highly appreciated.
> 
> Thanks
> Sanat.
> 

-- 
View this message in context: http://www.nabble.com/How-to-change-Axis2-response-character-encoding-tp22460000p22470003.html
Sent from the Axis - User mailing list archive at Nabble.com.


Mime
View raw message