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/"">
<soap:Body>
<CopyIntoItems xmlns=""http://schemas.microsoft.com/sharepoint/soap/"">
<SourceUrl>http://devint/a/ceo/Pages/BasePage.aspx<SourceUrl>
<DestinationUrls>
<string>http://sptestmnc.nevcounty.net/Resources/Images</string>
</DestinationUrls>
<Fields>
<FieldInformation Type=""Text"" DisplayName=""Title"" InternalName=""Title"" Value=""{0}"" Id=""{{bc91a437-52e7-49e1-8c4e-4698904b2b6d}}"" />
</Fields>
<Stream>{1}</Stream>
</CopyIntoItems>
</soap:Body>
</soap:Envelope>";
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))
{
stmw.Write(soapStr);
}
}
using (StreamReader responseReader = new StreamReader(req.GetResponse().GetResponseStream()))
{
string result = responseReader.ReadToEnd();
ResultXML = XDocument.Parse(result);
ResultString = result;
}