Code won't work under mono, any ideas whats wrong?
Posted
by JL
on Server Fault
See other posts from Server Fault
or by JL
Published on 2009-08-07T12:56:03Z
Indexed on
2010/03/13
19:25 UTC
Read the original article
Hit count: 451
Mono won't fire the following code: I get internal server error 500, error writing request error. Code works perfectly under normal .net.... any ideas why its broken and how to fix it?
[WebServiceBinding]
public class testService : System.Web.Services.Protocols.SoapHttpClientProtocol
{
private string DummySoapRequest = @"<?xml version=""1.0"" encoding=""utf-8""?>
<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<soap:Body>
<DummyOperation xmlns=""http://mynamespace.com"">
</DummyOperation>
</soap:Body>
</soap:Envelope>";
public void SendDummyRequest()
{
System.Net.WebRequest req = GetWebRequest(new Uri(Url));
req.Headers.Add("SOAPAction", "");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Method = "POST";
using (Stream stm = req.GetRequestStream())
{
using (StreamWriter stmw = new StreamWriter(stm))
{
stmw.Write(DummySoapRequest);
}
}
System.Net.WebResponse response = req.GetResponse();
}
}
© Server Fault or respective owner