Kalde SOAP request
Jeg skal kalde en webservice via soap, men kan ikke få det til at fungere. Jeg bruger nedenstående kode.XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath(xmlfile));
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("URL");
if (proxy != null) req.Proxy = new WebProxy(proxy, true);
// if SOAPAction header is required, add it here...
req.Headers.Add("SOAPAction", "\"\"");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);
// process SOAP return doc here. For now, we'll just send the XML out to the browser ...
Response.Write(r.ReadToEnd());
Er det helt forkert eller hvad? Jeg får en fejl 500 (Intern serverfejl) tilbage.