I have an application where I am creating a SOAP request by hand and hitting a SharePoint instance. My problem is that the call returns the error: The remote server returned an error: (500) Internal Server Error. giving me little to go after as far as the cause of the error.

I've checked the ULS logs and Event logs on the target server, but nothing is showing up there. Suggestions on where to look for more info?

More info:

I cannot add a web reference or use wsdl.exe to create a class to make this request, I need to create the SOAP request by hand. Below is the code I am using to make the request:

string soapStr =
    @"<?xml version=""1.0"" encoding=""utf-8""?>
        <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
            <CopyIntoItems xmlns=""http://schemas.microsoft.com/sharepoint/soap/"">
                <FieldInformation Type=""Text"" DisplayName=""Title"" InternalName=""Title"" Value=""{0}"" Id=""{{bc91a437-52e7-49e1-8c4e-4698904b2b6d}}"" />

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
req.Headers.Add("SOAPAction", "\"http://tempuri.org/" + MethodName + "\"");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";

using (Stream stm = req.GetRequestStream())

    soapStr = string.Format(soapStr, "testFile.png", content);
    using (StreamWriter stmw = new StreamWriter(stm))

using (StreamReader responseReader = new StreamReader(req.GetResponse().GetResponseStream()))
    string result = responseReader.ReadToEnd();
    ResultXML = XDocument.Parse(result);
    ResultString = result;

3 Answers 3


You could user Fiddler. In my experience is the best tools to check what is going on behind the scene when the Browse talks with the SharePoint Server.


Also you could use the Developer Tool (F12) on the Internet Explorer 8+ and in the Script tab you can do some javascript debug.



This problem ended up being caused by the line:

req.Headers.Add("SOAPAction", "\"http://tempuri.org/" + MethodName + "\"");

when I changed it to:

req.Headers.Add("SOAPAction", "\"http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems\"");

the 500 error went away.

  • I ended up using fiddler to capture the SOAP request from a working call and from the broken call. After comparing the two I ended up changing the SOAPAction in my request and got past the 500 error. I have added the details of my fix to your answer in case anyone else comes across this. Thanks! Commented Aug 16, 2012 at 20:50
  • It worked for me Commented Jul 14, 2016 at 12:09

As I'd agree with Javier, I'd like to ask if you're using any proxies or firewalls?

The reason I ask is because you may need to configure your proxy settings accordingly otherwise. If so you'll want to update your code to utilize the system proxy, which pulls from your internet options (in the control panel) :

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
req.Headers.Add("SOAPAction", "\"http://tempuri.org/" + MethodName + "\"");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
req.Proxy = WebRequest.GetSystemWebProxy();

Hope this helps.


I might sound like a Noob, but I can't see any authentication happening in your piece of code or am i missing something ? I was once trying to use SOAP while coding a gadget for windows 7 to get data from a SharePoint list, but I couldn't by pass ISA server or could find a way.

  • 2
    That is an issue, but it would cause a 401 error not a 500 error. Commented Aug 16, 2012 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.