I want to submit a utf-8 xml request to a servlet by the following coding.
it seesm that the servlet can't recognize it correctly.
can i just using string postData = "..... utf-8 data" and then save the
files at utf-8 encoded at the vs.net ide?
or if i use string, vs.net ide will conside it to be utf-16???
UTF8Encoding encoding = new UTF8Encoding();
string postData = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"urn:schem as-xmlsoap-org:envelope\"> " +
"<SOAP-ENV:Header>" +
"<SOAPActionVer sion>1.5.5</SOAPActionVersi on></SOAP-ENV:Header>" +
"<SOAP-ENV:Body>" +
"<cmEDMSCustome rContactPage transactionType =\"UPDT\">" +
"<cmEDMSCustome rContactPageSer vice>" +
"<cmEDMSCustome rContactPageHea der PageReadSW=\"fa lse\"
CustomerContact ID=\"8210710493 \"></cmEDMSCustomerC ontactPageHeade r>" +
"<cmEDMSCustome rContactPageDet ails>" +
"<LogEntry> " +
"<LogEntryHeade r CustomerContact ID=\"8210710493 \">" +
"</LogEntryHeader> " +
"<LogEntryR ow rowAction=\"ADD \" CustomerContact ID=\"8210710493 \" LogEntry=\"
utf-8 characters \">" +
"</LogEntryRow>" +
"</LogEntry>" +
"</cmEDMSCustomerC ontactPageDetai ls>" +
"</cmEDMSCustomerC ontactPageServi ce>" +
"</cmEDMSCustomerC ontactPage>" +
"</SOAP-ENV:Body >" +
"</SOAP-ENV:Envelope>";
Console.WriteLi ne(postData);
byte[] data = encoding.GetByt es(postData);
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest )WebRequest.Cre ate(http://172.18.2.1:7520/server);
myRequest.Metho d = "POST";
myRequest.Conte ntType="text/xml";
myRequest.Conte ntLength = data.Length;
myRequest.SendC hunked = true;
myRequest.Trans ferEncoding = "UTF8";
myRequest.Crede ntials = new NetworkCredenti al("CDX", "pwd");
Stream newStream=myReq uest.GetRequest Stream();
// Send the data.
newStream.Write (data,0,data.Le ngth);
newStream.Close ();