0

Recently i came across a requirement where a SOAP based web service without having a root node has to be consumed. Below is the request payload which works using SOAPUI

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <ID>123</ID>
        <Currency>USD</Currency>
    </soapenv:Body>
</soapenv:Envelope>

org.springframework.ws.client.WebServiceTransformerException exception is thrown while passing the above payload to the Apache Camel's ProducerTemplate Body(Which internally leverages on spring-ws).

org.springframework.ws.client.WebServiceTransformerException: Transformation error: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 32; The markup in the document following the root element must be well-formed.; nested exception is javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 32; The markup in the document following the root element must be well-formed.

Would like to get some clarity on below

  1. Is it a standard practice to have XML payload without root node?
  2. SOAPUI manages to process the request and response and Spring Webservices fails, is it a limitation in Spring WS framework?
  3. What is the recommended solution for the same?
Red Boy
  • 5,429
  • 3
  • 28
  • 41
Samy
  • 2,387
  • 2
  • 17
  • 31
  • It must have a root node which is a standard. – Rao Jul 25 '19 at 04:26
  • @Rao Yes i agree that it should have a root node. The above WSDL is what shared as a service and the same is getting parsed and processed using SOAPUI. I am really unsure how could it manage to do it. – Samy Jul 25 '19 at 10:50
  • That is becuase it is wrapped under SOAP BODY. – Rao Jul 26 '19 at 10:56
  • If my understanding is right, the request payload under SOAP body should be a well formed XML. Correct me if I am incorrect. – Samy Jul 26 '19 at 12:58
  • That's why you getting error. Check with service provider or with your team to resolve the issue. – Rao Jul 26 '19 at 14:25
  • it’s provided by a different provider and their point is that as long as it works in SOAPUI its a valid service to be consumed. – Samy Jul 27 '19 at 16:49
  • Just as if the message (without SOAP blocks), is being validated against the xml schema definition. – Rao Jul 29 '19 at 09:50
  • Yes, and not all SOAP messages are strictly validated against XML schema definition. Its optional! – Samy Jul 29 '19 at 09:52

0 Answers0