我正在尝试将HTTPWebRequest POST XML数据发送到我的WCF服务。 但是,当我在我的服务中设置断点时,它会被击中,但是当我尝试读取它时,我的widgetStream是空的。即使我从StreamReader中读取它。 这是我的XMl文件发送到WCF Rest Service中的HttpWebRequest ..
<UserInput xmlns="http://localhost/lms">
<City>Hyderabad</City>
<State>AP</State>
<ZipCode>500016</ZipCode>
<Country>Inida</Country>
<Telephone>9293225135</Telephone>
<Fax>9293225135</Fax>
<RegisteredOn>01/02/2012</RegisteredOn>
<ApprovedOn>03/03/2012</ApprovedOn>
<Status>1</Status>
</UserInput>
但是我得到了以下的反响......
<UserInput xmlns="http://localhost/lms" xmlns:i="http://www.w3.org/2001/XMLSchema"/>
这有什么问题...
string url = "http://localhost:2617/UserService.svc/user";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "PUT";
req.ContentType = "application/xml";
//req.context.ContextOptions.ProxyCreationEnabled = false;
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.XmlResolver = null;
xmlDoc.Load(Server.MapPath("test.xml"));
string sXML = xmlDoc.InnerXml;
req.ContentLength = sXML.Length;
System.IO.StreamWriter sw = new
sw.Write(sXML);
sw.Close();