getting response from webservice while sending request in querystring

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

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 = "http://www.sefl.com/webconnect/ratequotes?wantsToBeSecure=Y&Username=DEMO&Password=DEMO&CustomerAccount=016100361&returnX=Y&rateXML=Y&CustomerName=DEMO&CustomerStreet=DEMO+ADDR+%231&CustomerCity=ROME&CustomerState=GA&CustomerZip=30101&Option=S&PickupDateMM=09&PickupDateDD=04&PickupDateYYYY=2013&Terms=P&EmailAddress=uday%40estbizlab.com&OriginCity=ROME&OriginState=GA&OriginZip=30101&OrigCountry=U&DestinationCity=&DestinationState=&DestinationZip=29210&DestCountry=U&Class1=50&Weight1=555&Description1=Car+Parts&Class2=0&Weight2=&Description2=&Class3=0&Weight3=&Description3=&Class4=0&Weight4=&Description4=&Class5=0&Weight5=&Description5=&Class6=0&Weight6=&Description6=&Class7=0&Weight7=&Description7=&Class8=0&Weight8=&Description8=&Class9=0&Weight9=&Description9=&Class10=0&Weight10=&Description10=&Class11=0&Weight11=&Description11=&Class12=0&Weight12=&Description12=&Class13=0&Weight13=&Description13=&Class14=0&Weight14=&Description14=&Class15=0&Weight15=&Description15=&Class16=0&Weight16=&Description16=&Class17=0&Weight17=&Description17=&Class18=0&Weight18=&Description18=&Class19=0&Weight19=&Description19=&Class20=0&Weight20=&Description20=&ODLength=&ODWeight=&CODAmount=&FVInsuranceAmount=&SortNum=&OtherDesc=&Submit=Submit+Rate+Quote";

WebRequest webRequest = WebRequest.Create(strUrl );
HttpWebRequest httpRequest = (HttpWebRequest)webRequest;
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml; charset=utf-8";
//httpRequest.Headers.Add("SOAPAction: http://tempuri.org/login");
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=\"http://www.w3.org/2001/XMLSchema-instance\"");
soapRequest.Append(" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" ");
soapRequest.Append("xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body>");
soapRequest.Append(" <login xmlns=\"http://tempuri.org/\" />");
soapRequest.Append("</soap:Body></soap:Envelope>");
streamWriter.Write(soapRequest.ToString());
streamWriter.Close();
//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.
Uday

uday


Responses

(No response found.)

Login to post response