Search code examples
c#soapvisual-studio-2008.net-3.5sap-basis

XmlDocument - I want <Item></Item> and not <Item/>


I have to send an XML as a SOAP response to a SAP WAS.

SAP is quite fussy with what you are sending (special characters and stuff), and by now I want to exhaust all possibilities.

Is there a way when you make a myXMLDoc.LoadXml to specify something like "do not shorten tags when empty"?

Usually when you make this:

<item>
<Trkorr>TDEK978887</Trkorr>
<Sequence>0</Sequence>
<Solicit>cggaste</Solicit>
<Type></Type><Id></Id><Number></Number><Message></Message>
</item>

It transforms it to:

<item>
<Trkorr>TDEK978887</Trkorr>
<Sequence>0</Sequence>
<Solicit>cggaste</Solicit>
<Type/><Id/><Number/><Message/>
</item>

Any property I'm missing?


BTW (I don't think it's worth another question, so...)

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Body>
        <soap-env:Fault>
            <faultcode>soap-env:Server</faultcode>
            <faultstring xml:lang="en">SOAP processing failure, error id = 112</faultstring>
        </soap-env:Fault>
    </soap-env:Body>
</soap-env:Envelope>

This is the error sap's returning.

Thanks in advance!


Solution

  • No, there isn't another way without writing everything yourself.

    And even with that done, that's not the problem. The problem is something on the SAP Server and/or the SAP Parameters you were sending beside those you show.