'“com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'H' (code 72) in prolog; expected '<' ”.

I have a soap service for uploading documents through which I upload multiple documents. The service works fine but once in a while it fails giving the following error - “com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'H' (code 72) in prolog; expected '<' ”. I am not able to find the reason behind this issue. Can anybody tell me the reason this error occurs and the solution for the same. Following is the soap envelope and the server error.

SOAP ENVELOPE :

2017-05-31T11:54:13:440080+01:00N0.0000Avondale Financial [email protected]. Sayne wWard26372638716100014ACCEPTANCEwbroknet011824993OSBLENDINGWRESPONSEWEBGENER.CSDWEBR.PNG0SYSTEMCREATEDSYSTEM99902017-05-31T11:54:13:471080+01:00OSBLENDINGACCEPTANCESRCXMPLAUTHORISATIO0AFT00NT729000000223207290000002232017-05-31-11.54.13.471000N0HUBUSERHUBUSER

SERVER ERROR :

11:54:13,547 WARN [org.apache.cxf.phase.PhaseInterceptorChain] (default-workqueue-3) Interceptor for {http://endpoint.consumer.ws.ihub.osb.com/}AWDSoapEndpointService#{http://endpoint.consumer.ws.ihub.osb.com/}createObjects has thrown exception, unwinding now: org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader: Unexpected character 'H' (code 72) in prolog; expected '<' at [row,col {unknown-source}]: [1,1] at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:259) [cxf-rt-bindings-soap-3.0.4.jar:3.0.4] at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:65) [cxf-rt-bindings-soap-3.0.4.jar:3.0.4] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) [cxf-core-3.0.5.jar:3.0.5] at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:784) [cxf-core-3.0.5.jar:3.0.5] at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1645) [cxf-rt-transports-http-3.0.5.jar:3.0.5] at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1156) [cxf-rt-transports-http-3.0.5.jar:3.0.5] at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428) [cxf-core-3.0.5.jar:3.0.5] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_73] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_73] at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353) [cxf-core-3.0.5.jar:3.0.5] at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_73] Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'H' (code 72) in prolog; expected '<' at [row,col {unknown-source}]: [1,1] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:647) [woodstox-core-asl-4.4.1.jar:4.4.1] at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2054) [woodstox-core-asl-4.4.1.jar:4.4.1] at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1131) [woodstox-core-asl-4.4.1.jar:4.4.1] at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1154) [woodstox-core-asl-4.4.1.jar:4.4.1] at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:161) [cxf-rt-bindings-soap-3.0.4.jar:3.0.4]

Thank you,

Siddharth Patil



Solution 1:[1]

I had similar issue. Your error says that your message don't start with prolog which must be appear before the root element of your xml.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcin Wi?niewski