简体   繁体   中英

C# + XML Serialization

I have a method that is calling a web service. When this web service is called, the following method is called:

[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]));
}

When this method is called, I've noticed that the XML includes the following:

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

How do I remove the <soap:> wrappers from my XML?

I wouldn't. Soap is a standard protocol for publishing services and accessing remote data. Without it the remote server won't understand your request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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