I tried to POST xml by HttpWebRequest, and write following code.
But the code is not work. I confirm the net packet, and I found
this http post packet. But this packet don't have xml datas.
So I think Stream.Write is not work correctly.
Content-Type and Content-Length is correct in the packet.
Could you tell me what is wrong Thank you.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "text/xml; charset=utf-8";UTF8Encoding encoder = new UTF8Encoding();
byte[] data = encoder.GetBytes(postbody); //postbody is plain string of xml
req.ContentLength = data.Length;Stream reqStream = req.GetRequestStream();
reqStream.Write(data,0,data.Length);
reqStream.Close();
regards.

How can I post the xml data by using HttpWebRequest?
SHBEHM
I checked out the network packet by sniffer as follows.
Hypertext Transfer Protocol
POST /********/********.asmx HTTP/1.1\r\n
Request Method: POST
Request URI: /********/********.asmx
Request Version: HTTP/1.1
Content-Type: text/xml; charset=utf-8\r\n
SOAPAction: "urn:**********"\r\n
Content-Length: 517\r\n
Expect: 100-continue\r\n
Connection: Keep-Alive\r\n
Host: 10.36.154.42\r\n
\r\n
By rights, "eXtensible Markup Language" is sent after the above header.
However in my case, this transaction doesn't include xml data.
And a checksum of this transaction is incorrect.
It may be caused bacause xml data is not included.
adi151478
Then are you expecting a FORM type POST on the server
What does the netmon say
Get a trace from system.net using http://blogs.msdn.com/dgorti
Michael Wilkinson
This definitely looks strange.
Please send the system.net trace and the network monitor trace