如何修改Web服务代理,以获得原始XML原始、Web、XML

2023-09-03 21:26:10 作者:好久不见,我已胖若两人

下面是为Web服务,我试图访问已创建的代理方法。我怎么会去修改它来从Web服务调用的原始XML?

Here's the proxy method that was created for the web service I'm trying to access. How would I go about modifying it to get the raw XML from the web service call?

        /// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("CallOptionsValue")]
    [System.Web.Services.Protocols.SoapHeaderAttribute("MruHeaderValue")]
    [System.Web.Services.Protocols.SoapHeaderAttribute("SessionHeaderValue")]
    [System.Web.Services.Protocols.SoapHeaderAttribute("QueryOptionsValue")]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace = "urn:partner.soap.sforce.com", ResponseNamespace = "urn:partner.soap.sforce.com", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("result")]
    public QueryResult query(string queryString)
    {
        object[] results = this.Invoke("query", new object[] {
                    queryString});
        return ((QueryResult)(results[0]));
    }

感谢您的帮助!

Thanks for your help!

推荐答案

幸运的是有一个很好的办法做到这一点,只需要修改生成的代理类,以便从不同的基本继承。另一种方法执行来自Web服务增强3.0包:

Fortunately there is a nice way to do it, just modify the generated proxy class so it inherits from different base. The alternative implementation comes from Web Services Enhancements 3.0 pack:

Microsoft.Web.Services3.WebServicesClientProtocol

在类,你将有RequestSoapContext.Envelope.InnerXml和ResponseSoapContext.Envelope.InnerXml的范围内 - 这正是你需要的。

in the class you'll have RequestSoapContext.Envelope.InnerXml and ResponseSoapContext.Envelope.InnerXml in the scope - that's exactly what you need.