Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

c# how to process soap response

Status
Not open for further replies.

darylbewise

Programmer
Jan 5, 2009
16
0
0
GB
Hi All,

I have the following code that sends a soap request to a web service and receives a soap response back,

Code:
void HttpSOAPRequest(String xmlfile, string proxy)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(Server.MapPath(xmlfile));
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create("[URL unfurl="true"]http://api.affiliatewindow.com/v3/AffiliateService");[/URL]
        if (proxy != null) req.Proxy = new WebProxy(proxy, true);

        req.ContentType = "text/xml;charset=\"utf-8\"";
        req.Accept = "text/xml";
        req.Method = "POST";
        Stream stm = req.GetRequestStream();
        doc.Save(stm);
        stm.Close();
        WebResponse resp = req.GetResponse();
        stm = resp.GetResponseStream();
        StreamReader r = new StreamReader(stm);
    }

What is the best way to actually process the soap response? e.g. should I be tryingto convert the streadreader into an xmldocument and process that way?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top