Forum Discussion

jeffweaver25's avatar
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


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: ""
Content-length: 1159

Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <>


.... the rest deleted for brevity


This stack trace shows the classes doing the parsing.



Caused by: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'
 at [row,col {unknown-source}]: [2,1]



Input Buffer at point of error