Last post Nov 07, 2014 05:47 PM by avix_s
Apr 13, 2011 04:16 PM|kmc5117|LINK
I built the following SOAP Request method and am trying to find out the best way to parse out just the relevant result data from the response below.
protected void Test_Click(object sender, EventArgs e)
string oRequest = "";
oRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:com=\"http://com.remp.web.sas.tubeorder.type\">";
oRequest = oRequest + "<soapenv:Header/>";
oRequest = oRequest + "<soapenv:Body>";
oRequest = oRequest + "<com:beginTransaction>";
oRequest = oRequest + "<Long_1>10</Long_1>";
oRequest = oRequest + "<String_2>BARCODE</String_2>";
oRequest = oRequest + "<String_3>TUBEFIXRACKVAR</String_3>";
oRequest = oRequest + "</com:beginTransaction>";
oRequest = oRequest + "</soapenv:Body>";
oRequest = oRequest + "</soapenv:Envelope>";
//Builds the connection to the WebService.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://xxx.xxx.xxx.xxx:8080/tubeorder-service/jse?wsdl");
req.ContentType = "text/xml; charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
//Passes the SoapRequest String to the WebService
using (Stream stm = req.GetRequestStream())
using (StreamWriter stmw = new StreamWriter(stm))
//Gets the response for the Transaction #
WebResponse response = req.GetResponse();
//Writes the Response
Stream responseStream = response.GetResponseStream();
StreamReader sr = new StreamReader(responseStream);
string s = sr.ReadToEnd();
txtLayout.Text = s.ToString();
The final result stores the response in string s. However on inspection the entire envelope response is stored
<ns1:beginTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://com.remp.web.sas.tubeorder.type">
Is there an easy, modern method to parse out just the result string of numbers from the response? If not what is the best course of action? I've googled for some responses but I'm not sure if they are what I am looking for.
Thanks in advance.
Apr 14, 2011 10:01 PM|Peter pi - MSFT|LINK
Your problem has been resloved? if your problem has already been resolved, for the benefit of others, could you show your solution?
Nov 07, 2014 05:47 PM|avix_s|LINK
I need help with this, can you please assist.