如何在ASP中做出xml文件的响应? [英] How make response of xml file in asp?

查看:104
本文介绍了如何在ASP中做出xml文件的响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的ASP页面尝试xml请求/响应

Request.asp(来自客户端)

Below is my asp pages trying for xml request/response

Request.asp (from client)

<%
    pXML = "<XmlRequest><FileNo>123</FileNo></XmlRequest>"
    Set http = CreateObject("MSXML2.ServerXMLHTTP")
    http.open "GET", "http://test.com/response.asp?xml_request=" & pXML, 0
    http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    http.send ""
    http_response = http.responseText
%>



Response.asp(在服务器中)



Response.asp (in the server)

<%
xml_request = Request.QueryString("xml_request")

Set xd= Server.CreateObject("Msxml2.DOMDocument")
xd.async = False
xd.loadXML(Xml_Request)

FileNo = xd.getElementsByTagName("XmlRequest").item(0).getElementsByTagName("FileNo").item(0).text
''' here is the problem
%>



响应文件在此服务器路径`Server.MapPath("123.xml")`中(这是一个大文件)

1.如何将响应文件从"Response.asp"发送到"Request.asp"

2.我需要一个没有response.write
的解决方案
3.如何将响应xml文件发送到客户端?



Response file is in this server path `Server.MapPath("123.xml")` (this is a large file)

1.How i send response file to the "Request.asp" from "Response.asp"

2.i need a solution with out response.write

3.How send response xml file to the client ?

推荐答案

由于您无法使用Response.Write(为什么?)-为什么不将文件保存到服务器上的公共位置(或受保护的位置),然后通过表单中的隐藏字段将URL发送回该文件(以及任何必要的安全信息)(我假设您请求的页面中某处有一个?),然后将请求代码读取表单信息并分别请求XML文件.最后,您可以调用它的一个额外页面,该页面告诉您的服务器删除文件. (尽管为什么您请求的代码不能仅仅首先加载所需的XML文件,因为您似乎试图获取文件号并获取正确的文件,所以我不知道...:S)

希望这会有所帮助,
Ed
Since you can''t use Response.Write (why though?) - why not save your file to a public location on the server (or a secured one) then send back the URL to that file (and any necessary security information) through hidden fields in your form (I assume you have one in your requested page somewhere?) and then have the requesting code read the form information and request the XML file separately. Finally, you can have an extra page it calls that tells your server to delete the file. (Though why your requesting code couldn''t just load the wanted XML file in the first place since you appear to be trying to get a file number and get the correct file I have no idea... :S )

Hope this helps,
Ed


这篇关于如何在ASP中做出xml文件的响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆