Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify webservice proxy to get Raw 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!

like image 825
CodeMonkey Avatar asked Dec 30 '25 22:12

CodeMonkey


1 Answers

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

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

like image 128
aaimnr Avatar answered Jan 02 '26 11:01

aaimnr