user462166
user462166

Reputation: 4155

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?

Upvotes: 0

Views: 307

Answers (1)

Matthew Abbott
Matthew Abbott

Reputation: 61589

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.

Upvotes: 3

Related Questions