SoapServer send response without envelope

2.5k views Asked by At

I would like to send a soap response which is pure xml i.e without a soap envelope. This is my current response

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
   <SOAP-ENV:Body>
      <ns1:getMemberResponse>
         <User>
            <ValidationErrors/>
            <IsDeleted>false</IsDeleted>
            <ID>1691</ID>......

However, this is the response I would like to send

<User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ValidationErrors />
  <IsDeleted>false</IsDeleted>
  <ID>1691</ID>.....

Does anyone have any suggestions?

Many thanks in advance

1

There are 1 answers

0
Bogdan On

SOAP is a protocol and as such defines the format of communication (which includes a message composed of an Envelope, Body and optional Header).

If you just send the response back with no Envelope, you are breaking the protocol. Your clients (who are expecting a properly formatted SOAP response) will fail.

If you use a SOAP web service then you must send the Envelope.

If this is cumbersome for you and you are only interested in the payload, then maybe a RESTful web service would be more appropriate instead of a SOAP one? It is for you to decide given your particular situation.