繁体   English   中英

C#+ XML序列化

[英]C# + XML Serialization

我有一个调用Web服务的方法。 调用此Web服务时,将调用以下方法:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute(
    "http://mydomain.com/services/DoSomething", 
    RequestNamespace = "http://mydomain.com/services", 
    ResponseNamespace = "http://mydomain.com/services", 
    Use = System.Web.Services.Description.SoapBindingUse.Literal, 
    ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("MyResponse")]

public MyResponse DoSomethingr(MyRequest myRequest)
{
    object[] results = this.Invoke("DoSomething", new object[] { myRequest});
    return ((MyResponse)(results[0]));
}

调用此方法时,我注意到XML包含以下内容:

<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>
    <!-- XML --!>
  </soap:Body>
</soap:Envelope>

如何从XML中删除<soap:>包装器?

我不会 肥皂是用于发布服务和访问远程数据的标准协议。 没有它,远程服务器将无法理解您的请求。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM