getting response from webservice while sending request in querystring

Posted by Udaysimha under Web Services, Remoting on 9/4/2013 | Points: 10 | Views : 1416 | Status : [Member] | Replies : 0

I am not getting a response in xml format from web service while sending request as query string.
My code as follows

private void GetRequest()
string strUrl =string .Empty ;
strUrl = "";

WebRequest webRequest = WebRequest.Create(strUrl );
HttpWebRequest httpRequest = (HttpWebRequest)webRequest;
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml; charset=utf-8";
httpRequest.ProtocolVersion = HttpVersion.Version11;
httpRequest.Credentials = CredentialCache.DefaultCredentials;
Stream requestStream = httpRequest.GetRequestStream();
StreamWriter streamWriter = new StreamWriter(requestStream, Encoding.ASCII);
StringBuilder soapRequest = new StringBuilder("<soap:Envelope xmlns:xsi=\"\"");
soapRequest.Append(" xmlns:xsd=\"\" ");
soapRequest.Append(" <login xmlns=\"\" />");
//Get the Response
HttpWebResponse wr = (HttpWebResponse)httpRequest.GetResponse();
StreamReader srd = new StreamReader(wr.GetResponseStream());
string resulXmlFromWebService = srd.ReadToEnd();
return resulXmlFromWebService;


from the above code i am not getting the actual response what i got while directly coping the query string.
If i put the query string(strUrl) directly in browser and hit enter i am getting response in xml format but through above code i am not getting the same.
Please help me to get this out. I am not what wrong i did in code.

Thanks in advance.



(No response found.)

Login to post response