0

是否可以从响应中删除看似自动的notificationRequestResponse节点?

<?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>

我需要返回以下内容:

<?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>

我希望 notificationResponse 成为响应的根!

WebMethod 当前没有逻辑,但是:

return new notificationResponse()

notificationRequestResponse 来自哪里?我可以使用 WebMethod SoapDocumentMethod(ResponseElementName="new name") 重命名它,但我希望它消失。按照提供的规范工作,别无选择。

赞赏。

4

1 回答 1

2

找到了答案...

SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare )

于 2013-08-22T14:15:02.660 回答