public void Execute() { HttpWebRequest request = CreateWebRequest(); XmlDocument soapEnvelopeXml = new XmlDocument(); soapEnvelopeXml.LoadXml(@"<?xml version=""1.0"" encoding=""utf-8""?> <soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <soap:Body> <mergeprofiles xmlns=""http://127.0.0.1:90""> <Profile> <Member>278615</Member> <ExtRef>003D000001StY68IAF</ExtRef>zs <Name>LESCA</Name> <ChangedBy>user</ChangedBy> <FirstName>Paolo</FirstName> <Street1>via magnanina 3947</Street1> <Street2></Street2> <Street3></Street3> <City>VIGEVANO</City> <ZIP>27029</ZIP> <EMail>test@test.it</EMail> <Phone></Phone> <MobilePhone>+39331231233</MobilePhone> <Fax></Fax> <ISOLanguage>en</ISOLanguage> <Salut1>Mr</Salut1> <Homepage></Homepage> <VATNo1>0</VATNo1> </Profile> <EndOfMessage>@@@</EndOfMessage> </mergeprofiles> </soap:Body> </soap:Envelope>"); 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); } } } /// <summary> /// Create a soap webrequest to [Url] /// </summary> /// <returns></returns> public HttpWebRequest CreateWebRequest() { HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(@"http://127.0.0.1:90/"); webRequest.Headers.Add(@"SOAP:Action"); webRequest.ContentType = "text/xml;charset=\"utf-8\""; webRequest.Accept = "text/xml"; webRequest.Method = "POST"; return webRequest; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)