这个函数有一个类型转换错误请问如何修改。结贴加分!
private void SendWebRequest()
{
string msgid, srcid, destid, content;
string reqData = @ " <?xml version= " "1.0 " " encoding= " "GB2312 " "?>
<submit_sms>
<cp_id> ##CPID## </cp_id>
<cp_msg_id> ##MSGID## </cp_msg_id>
<SrcTermId> ##SRCID## </SrcTermId>
<DestTermId> ##DESTID## </DestTermId>
<FeeType> 101 </FeeType>
<content> <![CDATA[##Content##]]> </content>
</submit_sms>
";
reqData = reqData.Replace( "##CPID## ", "7777 ");
reqData = reqData.Replace( "##MSGID## ", msgid.ToString());
reqData = reqData.Replace( "##SRCID## ",srcid.ToString());
reqData = reqData.Replace( "##DESTID## ",destid.ToString());
reqData = reqData.Replace( "##Content## ", content.ToString());
HttpWebRequest req = (HttpWebRequest)WebRequest.Create( "http://www.test.com:8888/test ");
req.Method = "POST ";
req.Headers.Add( "Content-Type ", "application/x-www-form-urlencoded ");
StreamWriter reqStm = new StreamWriter(req.GetRequestStream());
reqStm.Write(reqData);
HttpWebResponse rsp = req.GetResponse();//错误出现在这行!!!!!
if (rsp.StatusCode != HttpStatusCode.OK)
{
//TODO:
}
else
{
StreamReader rspStm = new StreamReader(rsp.GetResponseStream(), Encoding.Default);
string retStr = rspStm.ReadToEnd();
XmlDocument xml;
try
{
xml = new XmlDocument();