Tezza
Tezza

Reputation: 282

Remove the response wrapper from web service response?

Is it possible to remove the what appears to be automatic notificationRequestResponse node from the response?

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  ...
  <soap:Body>
    <notificationRequestResponse xmlns="...">
      <notificationResponse xmlns="...">
        <success xmlns="">boolean</success>
        <fault xmlns="">
          ...
        </fault>
      </notificationResponse>
    </notificationRequestResponse>
  </soap:Body>
</soap:Envelope>

I need to return the below:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  ...
  <soap:Body>
    <notificationResponse xmlns="...">
      <success xmlns="">boolean</success>
      <fault xmlns="">
        ...          
      </fault>
    </notificationResponse>
  </soap:Body>
</soap:Envelope>

I want the notificationResponse to be the root of the response!

The WebMethod currently has no logic but:

return new notificationResponse()

Where is the notificationRequestResponse coming from? I can rename it using WebMethod SoapDocumentMethod(ResponseElementName="new name") but I want it gone. Working to a provided spec and have no choice.

Appreciated.

Upvotes: 0

Views: 1932

Answers (1)

Tezza
Tezza

Reputation: 282

Found the answer...

SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare)

Upvotes: 2

Related Questions