2010-11-29 81 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

我不會。肥皂是發佈服務和訪問遠程數據的標準協議。沒有它,遠程服務器將無法理解您的請求。