接口文件格式说明(asp+xmlhttp)

80酷酷网    80kuku.com

  asp+|xml接口xml文件格式<info><rec>       <depID>所属栏目</depID>       <smallClassID>所属信息单位</smallClassID>       <type>信息发布形式</type><keyWord>关键字</keyWord><title>新闻标题</title><author>作者</author><original>原出处</original><content>新闻内容</content></rec><rec>       <depID>所属栏目</depID>       <smallClassID>所属信息单位</smallClassID>       <type>信息发布形式</type><keyWord>关键字</keyWord><title>新闻标题</title><author>作者</author><original>原出处</original><content>新闻内容</content></rec></info> 注:接口类型和数据注意事项。  

字段名名称类型数据取值说明上传数据说明
depID所属栏目Int(4) 代码(不能为空)
smallClassID所属信息单位Nvarchar(25) 代码(不能为空)
type信息发布形式Nvarchar(7)重要信息=1弹出信息=2热点信息=3可复选多个,以“,”分隔如:1,2,3代码(多个用逗号分隔)
keyWord关键字Nvarchar(50)多个以“,”分隔 如:keyword1,keyowrd2文字(多个用逗号分隔)
title新闻标题Nvarchar(50)文字文字(不能为空)
author作者Nvarchar(20)文字文字
original原出处Nvarchar(20)文字文字
content新闻内容varChar (4000)文字文字(不能为空)
   举例:<info><rec>       <depID>1</depID>       <smallClassID>20040212200856429814</smallClassID>       <type>1,3</type><keyWord>关键字1, 关键字2</keyWord>  <title>新闻标题</title><author>作者</author><original>原出处</original><content>新闻内容</content></rec></info>  上传方法说明: 将上述产生的字符串发送到http://服务器IP:端口/receiveInfo.asp(必须用POST方式传送) 经测试通过代码如下: 发送端:sendInfo.asp <%set xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP") xmlstr="<info><rec><depID>1</depID><smallClassID>20040212200856429814</smallClassID><type>1,3</type><keyWord>关键字1, 关键字2</keyWord><title>新闻标题</title><author>作者</author><original>原出处</original><content>新闻内容</content></rec></info>" URL="http://192.168.1.5:9020/receiveInfo.asp"xmlhttp.open "POST",URL, Falsexmlhttp.send  xmlstrif  err.number=0 then       if xmlhttp.status <>"200" then              Response.Write "<font face="Times New Roman">:"&xmlhttp.status&" ;描述:"&xmlHttp.ResponseText&"</font>"       else              Response.Write "<font "&xmlHttp.ResponseText&"</font>"       end ifelse       Response.Write "<font face="Times New Roman">:"&xmlhttp.status&" ;描述:"&xmlHttp.ResponseText&"</font>"end if%>   接收端:receiveInfo.asp  <%codepage=936%><%Server.ScriptTimeOut=99999Response.Buffer =falseResponse.CharSet="gb2312"set xmldoc=Server.CreateObject("MSXML2.DOMDocument") xmldoc.load Request set root = xmldoc.DocumentElement for i=1 to xmldoc.documentelement.childNodes.length Set recnote = xmldoc.documentelement.childNodes(i-1) Set depIDnote = recnote.selectSingleNode("depID")Set smallClassIDnote = recnote.selectSingleNode("smallClassID")Set typenote = recnote.selectSingleNode("type")Set keyWordnote = recnote.selectSingleNode("keyWord")Set titlenote = recnote.selectSingleNode("title")Set authornote = recnote.selectSingleNode("author")Set originalnote = recnote.selectSingleNode("original")Set contentnote = recnote.selectSingleNode("content") response.Write depIDnote.text&"||"response.Write smallClassIDnote.text&"||"response.Write typenote.text&"||"response.Write keyWordnote.text&"||"response.Write titlenote.text&"||"response.Write authornote.text&"||"response.Write originalnote.text&"||"response.Write contentnote.text&"||"  next response.Write("0") %>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: