2010-11-29 103 views
0

我有一个调用Web服务的方法。当这个Web服务调用,调用下面的方法:C#+ XML序列化

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

如何删除<soap:>从我的XML包装?

+2

为什么要删除那些XML命名空间前缀?这些是用于调用Web服务的SOAP标准的一部分 - 不要篡改它们,否则您的SOAP调用可能无法工作了。 – 2010-11-29 17:39:45

回答

3

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