| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 438 人关注过本帖
标题:问 xml 解析失败的问题
只看楼主 加入收藏
gaoshuli12
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2011-6-27
结帖率:20%
收藏
 问题点数:0 回复次数:2 
问 xml 解析失败的问题
帮我看下错哪里了
用上面的HTML,页面点按钮,就能返回正确的结果

为什么用C#做的页面就解析错误呢?错误代码-1072896680



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>test</title>
</HEAD>
<BODY>
<form method="post" action="http://192.168.0.11/trans_api/QueryOrdertest.asp">
<INPUT TYPE="submit" value="submit" id="Submit"><br />   
    XML:<br />
    &nbsp;<textarea name="FK" style="width: 451px; height: 133px"><?xml version="1.0" encoding="UTF-8"?>
<root>
  <QueryOrder version="2.0">
    <mailNo>864356040</mailNo>
  </QueryOrder>
</root>
</textarea><br />
    <br />
</form>   
</BODY>
</HTML>

---------------------------

using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Web;
using
using
using System.Text.RegularExpressions;
using System.Security.Cryptography;
namespace XML
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string url = @"http://192.168.0.11/trans_api/QueryOrdertest.asp";



            string xml = "";
            xml = @"<?xml version=""1.0"" encoding=""UTF-8""?>";
            xml = xml + @"<root>";
            xml = xml + @"<QueryOrder version=""2.0"">";
            xml = xml + @"<mailNo>864356040</mailNo>";
            xml = xml + @"</QueryOrder>";
            xml = xml + @"</root>";

           // Post(url, xml);


            HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
            myRequest.Method = "POST";
            myRequest.ContentType = "Content-type,text/xml;charset=UTF-8";
            myRequest.ContentLength = xml.Length;
            Stream newStream = myRequest.GetRequestStream();
            // Send the data. 13.           
            ASCIIEncoding encoding = new ASCIIEncoding();
            byte[] postdata = encoding.GetBytes(xml);
            newStream.Write(postdata, 0, xml.Length);
            newStream.Close();
            // Get response 18.            
            HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
            StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);


            string content = reader.ReadToEnd();//得到结果

            richTextBox1.Text = content;
            richTextBox2.Text = xml;
        }

    }
}
搜索更多相关主题的帖子: content 错误代码 PUBLIC action method 
2011-07-20 17:11
gaoshuli12
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2011-6-27
收藏
得分:0 
补充:
找到原因了,服务器端用这个接收,
interface = request("FK")
客户端没有发送这个参数信息,
现在的问题是我客户端如何提交"FK"这个参数?

2011-07-25 15:08
gaoshuli12
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2011-6-27
收藏
得分:0 
哇咔咔,知道了,结贴
2011-07-25 15:16
快速回复:问 xml 解析失败的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034198 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved