NULL values in SOAP requests

Question: how to pass a NULL value in a SOAP envelope?
Answer: Use the xsi:nil=”true” attribute on the element, and don’t forget the xsi namespace in the envelope.

Example SOAP request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header/>
   <soapenv:Body>
      <TestService>
         <request>
            <PassNullHere xsi:nil="true" />
         </request>
      </TestService>
   </soapenv:Body>
</soapenv:Envelope>
This entry was posted in Work and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *