public void Execute() { var url ="http://sun2205.daytonoh.ncr.com:7780/NCROMeOrderInterfaceApl- NCROMeOrderInterfaceproj-context-root/NCROMeOrderInterfaceWSSoapHttpPort"; HttpWebRequest request = CreateWebRequest(url); XmlDocument soapEnvelopeXml = new XmlDocument(); soapEnvelopeXml.LoadXml(@" <ns1:customerdataelement xmlns:ns1="#unknown"> <![CDATA[ <customer> <site> <customer_no>7435535</customer_no> <site_uses>DELIVER_TO</site_uses> <name>GREAT SCOTTS EATERY</name> <address>1551 CORTEZ ST</address> <city>DENVER</city> <state>CO</state> <zip>0221-6908</zip> <primary_flag></primary_flag> <primary_ship_flag></primary_ship_flag> </site> </customer> </ns1:customerdataelement> "); using (Stream stream = request.GetRequestStream()) { soapEnvelopeXml.Save(stream); } using (WebResponse response = request.GetResponse()) { using (StreamReader rd = new StreamReader(response.GetResponseStream())) { string soapResult = rd.ReadToEnd(); Console.WriteLine(soapResult); } } } public HttpWebRequest CreateWebRequest(String ASMXURL) { HttpWebRequest webRequest2 = null; try { String action = "\"http://ncrerpjndi/NCROMeOrderInterfaceWS.wsdl/customerData\""; webRequest2 = (HttpWebRequest)WebRequest.Create(ASMXURL); webRequest2.UserAgent = ".NET Framework Test Client"; webRequest2.Headers.Add("SOAPAction", action); //webRequest2.Headers.Add("Accept-Encoding", "gzip,deflate") ; webRequest2.ContentType = "text/xml;charset=UTF-8"; webRequest2.Method = "POST"; // return webRequest2; } catch (WebException wex) { var pageContent = new StreamReader(wex.Response.GetResponseStream()) .ReadToEnd(); Response.Write(pageContent); } return webRequest2; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)