Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public static string web Request(string AuthoUserName, string AuthoPassword, string sUserID, string sUserName, string sPlateNo, string sPlateCat, string sPlateCode, string sEmirate, string sCountry, string sCity, string sChessisNo, string sFetchURL)
{
    string str = string.Empty;
    try
    {
        Uri requestUri = new Uri(sFetchURL);
        if (!(requestUri.Scheme == Uri.UriSchemeHttp))
        {
            return str;
        }
        HttpWebRequest request = null;
        request = (HttpWebRequest) WebRequest.Create(requestUri);
        request.Method = "GET";
        request.ContentType = "text/xml;charset=\"utf-8\"";
        string str2 = "<soapenv:envelope xmlns:soapenv="\"http://schemas.xmlsoap.org/soap/envelope/\"" xmlns:ae="\"http://ae.gov.trf.inq.ws.TrafficInquiryService\""><soapenv:header><ae:password>" + AuthoPassword + "</ae:password><ae:username>" + AuthoUserName + "</ae:username></soapenv:header><soapenv:body><ae:getvehicledetails><getvehicledetailsrequest><userid>" + sUserID + "</userid><username>" + sUserName + "</username><plate><plateno>" + sPlateNo + "</plateno><platecategory>" + sPlateCat + "</platecategory><platecode>" + sPlateCode + "</platecode><platesource><emirate>" + sEmirate + "</emirate><country>" + sCountry + "</country><city>" + sCity + "</city></platesource></plate><chassisno>" + sChessisNo + "</chassisno></getvehicledetailsrequest></ae:getvehicledetails></soapenv:body></soapenv:envelope>";
        request.Method = "POST";
        request.ContentType = "application/soap+xml; charset=utf-8";
        request.Headers.Add("SOAPAction:\"\"");
        request.ContentLength = str2.Length;
        StreamWriter writer = new StreamWriter(request.GetRequestStream());
        writer.Write(str2);
        writer.Close();
        StreamReader reader = new StreamReader(request.GetResponse().GetResponseStream());
        while (!reader.EndOfStream)
        {
            str = str + reader.ReadLine();
        }
    }
    catch (WebException exception)
    {
        HttpWebResponse response = null;
        response = (HttpWebResponse) exception.Response;
        StreamReader reader2 = new StreamReader(response.GetResponseStream());
        while (!reader2.EndOfStream)
        {
            str = str + reader2.ReadLine();
        }
    }
    return str;
}




it's return "the remote server returned an error (500) internal server error" This error
Posted
Updated 14-Nov-13 0:30am
v2

1 solution

see these Links
Link 1
Link 2
Link 3
 
Share this answer
 
Comments
ispiders 14-Nov-13 7:22am    
Thanks for your suggestion, since am new to this one. am not getting any idea from these links, can you give some other suggestion which can understand easily
ispiders 14-Nov-13 7:23am    
when i access this request through SOAP UI, It responds correctly

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