Post SOAP Envelope to WCF service?

Apr 4, 2011 at 7:10 AM
Edited Apr 4, 2011 at 10:14 AM

 

 

 

postData = null;

postData = "<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">\r\n <s:Header>\r\n <a:Action s:mustUnderstand=\"1\">http://schemas.devleap.com/OrderService/IOrderService/InsertOrder</a:Action>\r\n <a:MessageID>urn:uuid:4cb619b7-365b-4108-880f-b302029d03c2</a:MessageID>\r\n <a:ReplyTo>\r\n <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>\r\n </a:ReplyTo>\r\n </s:Header>\r\n <s:Body>\r\n <InsertOrder xmlns=\"http://schemas.devleap.com/OrderService\">\r\n <order xmlns:d4p1=\"http://schemas.devleap.com/OrderService/Order\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n <d4p1:IdCustomer>2</d4p1:IdCustomer>\r\n <d4p1:IdOrder>46</d4p1:IdOrder>\r\n <d4p1:OrderItems xmlns:d5p1=\"http://schemas.devleap.com/OrderService/OrderItems\" xmlns:d5p2=\"http://schemas.devleap.com/OrderService/OrderItem\">\r\n <d5p1:OrderItem>\r\n <d5p2:IdProduct>P01</d5p2:IdProduct>\r\n <d5p2:Quantity>5</d5p2:Quantity>\r\n <d5p2:EuroPrice>20</d5p2:EuroPrice>\r\n </d5p1:OrderItem>\r\n <d5p1:OrderItem>\r\n <d5p2:IdProduct>P01</d5p2:IdProduct>\r\n <d5p2:Quantity>5</d5p2:Quantity>\r\n <d5p2:EuroPrice>20</d5p2:EuroPrice>\r\n </d5p1:OrderItem>\r\n </d4p1:OrderItems>\r\n </order>\r\n </InsertOrder>\r\n </s:Body>\r\n</s:Envelope>";

 

WebClient myWebClient = new WebClient();

myWebClient.Headers.Add(

"Content-Type", "application/soap+xml; charset=utf-8");

 

byte[] byteArray = Encoding.ASCII.GetBytes(postData);

 

byte[] responseArray = myWebClient.UploadData("http://localhost/SoapService/", "POST", postData);

 

MessageBox.Show("\nResponse received was {0}", Encoding.ASCII.GetString(responseArray));

 

 

string

hi guys plz help me i want

 

to send direct request to server for envelope using below code without using proxy