views:

668

answers:

3

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!

A: 

Well, as far as I remember, a buddy of mine that this once with regular ASMX webservices, and it was quite a hack....

How about just serializing the result you get back into XML? That might do the trick...

Something along the lines of (totally untested and from memory):

MemoryStream stm = new MemoryStream();
XmlSerializer xmlSer = new XmlSerializer(typeof(QueryResult));
xmlSer.Serialize(stm, queryResult);

Would that work?

Marc

marc_s
+2  A: 

If you want just make a dump using the Fiddler Web Debugging tools.

If you want to really retrive/process raw XML then proxy method will not help you. Create System.Net.HttpWebRequest for the web service, call it, and retrive pure XML response. Format/structure can be found at .ASPX page or web service documentation.

LicenseQ
Fiddler is fantastic, thanks for that!
Allon Guralnek
+1  A: 

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.

deadbeef