小编Ras*_*feh的帖子

如何从 SOAP 响应中删除额外的结果标签

我知道这个问题以前曾被问过,但我在任何地方都找不到答案。

问题是我的 asmx 文件中有以下代码:

namespace IrancellSmsServer
{
    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
    [WebService(Namespace =   "http://www.csapi.org/schema/parlayx/data/sync/v1_0/local")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]

    public class SoapServer : System.Web.Services.WebService
    {
        [WebMethod]
        public syncOrderRelationResponse syncOrderRelation(
            Sync.UserID userID,
            string spID,
            string productID,
            string serviceID,
            string serviceList,
            int updateType,
            string updateTime,
            string updateDesc,
            string effectiveTime,
            string expiryTime,
            item[] extensionInfo
            )
        {    
            syncOrderRelationResponse a = new syncOrderRelationResponse();
            a.result = 0;
            a.resultDescription = "OK";         
            return a;
        }
     }
}
Run Code Online (Sandbox Code Playgroud)

这是结果:

<?xml version="1.0" encoding="utf-8"?>
<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>
    <syncOrderRelationResponse xmlns="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local">
      <syncOrderRelationResult>   //dont …
Run Code Online (Sandbox Code Playgroud)

.net c# xml soap asmx

6
推荐指数
1
解决办法
9254
查看次数

标签 统计

.net ×1

asmx ×1

c# ×1

soap ×1

xml ×1