Click here to Skip to main content
15,611,720 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here am getting solution
UploadStringCompleted: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmln
s:soap="" xmlns:xsi="
2001/XMLSchema-instance" xmlns:xsd=""><soap:Body
><HelloWorldResponse xmlns=""><HelloWorldResult>Hello Karthik

How can i get only Hello karthik as output from the called method
static void Main(string[] args)
           WebClient client = new WebClient();
           string request1 = "<soap:Envelope\r\n  xmlns:xsi=''\r\n  xmlns:xsd=''\r\n  xmlns:soap=''>\r\n <soap:Body><HelloWorld xmlns=\"\"><name>Karthik mushyam</name></HelloWorld></soap:Body></soap:Envelope>";
           client.Headers.Add(HttpRequestHeader.ContentType, "text/xml");
           client.Headers.Add("SOAPAction", "");
           client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
           client.UploadStringAsync(new Uri("http://localhost:52375/MyFirstWebService/Service.asmx"), request1);
       static void client_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
           Console.WriteLine("UploadStringCompleted: {0}", e.Result);
Updated 25-Sep-13 23:56pm

1 solution

As the result is in XML, so parse it and find the HelloWorldResult node value.

Refer - Parsing XML in C#[^] for one example.
Share this answer
karthik mushyam 26-Sep-13 6:20am    
I dont have seperate xml file ,how can i load xml file in my program
Okay then use XmlDocument.LoadXml Method[^].

XmlDocument doc = new XmlDocument();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900