Forum Discussion

jeffweaver25's avatar
jeffweaver25
New Contributor
8 years ago

Error parsing HTTP request using SOAP 1.2 with MTOM (using SOAP UI 5.3)

When the server receives the request, I get a parse exception: Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'

 

After quite a bit of tracing and debugging (see picture at bottom), the problem is that SoapUI is adding a CRLF after the headers and before the first part of the request. That is, in the trace below, the CRLF located after the Content-Length:1159 and the first part beginning with ----- is causing the problem, and from what I have read, a CRLF at this location is not strictly legal/valid. While many parsers may ignore this, mine will not and I don't seem to have a way to configure around it. The server is running in a JVM using JAX-WS and an endpoint implementation that implements Provider<SOAPMessage>.

 

The actual error occurs in method nextFromProlog(boolean) in class com.ctc.wstx.sr.BasicStreamReader

 

If I don't add any attachments, it works fine (the extra CRLF is not there). (The whole message is also a lot simpler).

 

Has anyone else had this problem and found a way around it?

 

 


---[HTTP request]---
Accept-encoding: gzip,deflate
Connection: Keep-Alive
Host: us161wstj01qb3h:9999
User-agent: Apache-HttpClient/4.1.1 (java 1.5)
Content-type: application/soap+xml
Mime-version: 1.0
Soapaction: "http://dmtec.tycoelectronics.com/GenericJAXBAPI/Ping/invoke"
Content-length: 1159

------=_Part_39_1148751092.1484058815359
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@soapui.org>

 

.... the rest deleted for brevity

 

This stack trace shows the classes doing the parsing.

 

 

Caused by: com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'
 at [row,col {unknown-source}]: [2,1]
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:326)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:99)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:169)
    at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:104)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:215)
    at com.oracle.webservices.impl.encoding.StreamDecoderImpl.decode(StreamDecoderImpl.java:64)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:249)
    at com.sun.xml.ws.encoding.StreamSOAP12Codec.decode(StreamSOAP12Codec.java:103)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:166)
    at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:314)

 

 

Input Buffer at point of error