编辑soap响应c#

本文关键字:响应 soap 编辑 | 更新日期: 2023-09-27 18:11:42

我有一个visual studio web服务,其中一个[WebMethod]返回一个像这样的数组对象:

        public createSerial[] Create(string inputSerial)
    {
        Bus bus = new Bus();
        return bus.CreateOperation()
    }

当我调用它时,它会生成以下响应:

        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CreateSerial xmlns="http://london.com/v1/">
         <CreateSerialRequestResult>
            <CreateSerialResponse>
               <serial xmlns="urn:microsoft-dynamics-schemas/ve">57</serial>
            </CreateSerialResponse>
         </CreateSerialRequestResult>
      </CreateSerial>
   </soap:Body>
</soap:Envelope>

但我只想要这个:

        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CreateSerial xmlns="http://london.com/v1/">
               <serial>57</serial>
      </CreateSerial>
   </soap:Body>
</soap:Envelope>

编辑soap响应c#

ParameterStyle = SoapParameterStyle.Bare