无法使用c#生成正确的soap响应描述

本文关键字:soap 响应 描述 | 更新日期: 2023-09-27 18:01:02

我已经构建了一个.net C#Web服务。我的一个方法应该返回一个带有搜索重结果的XML。

当我的方法返回XMLDocument类型时,我现在得到的当前soap描述是:

 SOAP 1.1
 The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
 POST /HARELCYBWS/HARELCYBWS.asmx HTTP/1.1
 Host: safemail-t.harel-ins.co.il
 Content-Type: text/xml; charset=utf-8
 Content-Length: length
 SOAPAction: "http://www.securenet.co.il/GetSafeActivitiesXML"
 <?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>
     <GetSafeActivitiesXML xmlns="http://www.securenet.co.il">
       <safename>string</safename>
       <days>int</days>
       <FileName>string</FileName>
     </GetSafeActivitiesXML>
   </soap:Body>
 </soap:Envelope>
 HTTP/1.1 200 OK
 Content-Type: text/xml; charset=utf-8
 Content-Length: length
 <?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>
     <GetSafeActivitiesXMLResponse xmlns="http://www.securenet.co.il">
       <GetSafeActivitiesXMLResult>xml</GetSafeActivitiesXMLResult>
     </GetSafeActivitiesXMLResponse>
   </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>
     <GetSafeActivitiesXMLResponse xmlns="http://www.securenet.co.il">
       <GetSafeActivitiesXMLResult>
 <results>
 <result>
       <safename>string</safename>
       <days>int</days>
       <username>string</username>
       <numberID>int</numberID>
       <comment>string</comment>
 </result>
 <result>
       <safename>string</safename>
       <days>int</days>
       <username>string</username>
       <numberID>int</numberID>
       <comment>string</comment>
 </result>
 <result>
       <safename>string</safename>
       <days>int</days>
       <username>string</username>
       <numberID>int</numberID>
       <comment>string</comment>
 </result>
 </results>
 </GetSafeActivitiesXMLResult>
     </GetSafeActivitiesXMLResponse>
   </soap:Body>
 </soap:Envelope>

我试着研究模式、系列化和所有其他东西,但我真的不知道我在那里做什么。我是xml的新手,不知道所有的细节。

我能做什么?另外,XMLDocument是正确的返回类型吗?

请帮忙,

谢谢。

David

无法使用c#生成正确的soap响应描述

返回类型是表示单个结果类列表的new类。为我工作。