Search code examples
web-servicessoaplibxml2gsoap

XML+SOAP: are newlines permitted?


I'm working with SOAP and XML to interact with some web-services.

I noticed that gsoap-generated routines do not have newlines and they work correctly. I successively tried to write my own routines by using libxml2, which indents the XML with newlines.

While all the web-services that I tested were able to deal with the code generated by gsoap, not all of them where able to deal with my hand-written code, and the triggering error was the presence of the newlines.

So my question is: are newlines forbidden in XML+SOAP? Do I have to write all the code on a single line? Or did I just face some broken services?


Solution

  • Newlines aren't forbidden. The whole reason, why gSoap writes the messages into one line is because there is no need to structure the message (bring it into a human readable form), it would be an additional cost with no effect.

    There must be some other reason. Compare your XML Messages with those generated by gSoap, is the content really the same, the only differences the newlines?