Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

Getting The remote server returned an error: (500) Internal Server Error

$
0
0

I have written below code to send the SOAP XML request

XmlDocument objSoapXML = new XmlDocument();

objSoapXML.LoadXml(sSoapXML);

HttpWebRequest objHttpWebRequest = (HttpWebRequest)WebRequest.Create(productURL);

objHttpWebRequest.ContentType = "text/xml;charset=\"utf-8\"";

objHttpWebRequest.Accept ="text/xml";

objHttpWebRequest.Method ="POST";

using (Stream objReqStream = objHttpWebRequest.GetRequestStream())

{

objSoapXML.Save(objReqStream);

}

// begin async call to web request.

IAsyncResult objAsyncResult = objHttpWebRequest.BeginGetResponse(null, null);

objAsyncResult.AsyncWaitHandle.WaitOne();

string soapXMLResult;

// get the response from the completed web request

using (WebResponse objWebResponse = objHttpWebRequest.EndGetResponse(objAsyncResult))

using (StreamReader objSteamReader = new StreamReader(objWebResponse.GetResponseStream())){

soapXMLResult = objSteamReader.ReadToEnd();}

 When posting request for above service URL it is throwing "The remote server returned an error (500) internal server error". For the same URL from same machine it works fine from SOAPUI application. I could get successful response but above .NET code doesn't work. So what could be the issue. Any help will be apperciated.


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>