移动MISC接口1.6程序[ASP]

原创 2006年06月21日 14:44:00
以下存为default.asp文件
<!--#include file = "conn.asp" -->
<%
    Rem -------------------------------------------
	Rem 文件名:SyncOrderRelationReq.asp
	Rem 作用:解析POST请求的XML,检测处理结果
	Rem 作者:
	Rem MSN :
	Rem -------------------------------------------
%>
<%
	function WriteLog(str)
		dim ofs,oFile,m_tempi
		sPath = "out_SyncOrderRelationReq.txt"
		set ofs = server.createobject("Scripting.FileSystemObject")
		sFileName = Server.MapPath(sPath)
		Set oFile = ofs.OpenTextFile(sFileName, 8 , true)
		oFile.WriteLine str
		set ofs = nothing
	end function
%>
<%
	Response.ContentType="text/xml"
	Response.CharSet="utf-8"
	
    dim ReceivedDoc,oResponseDom
	WriteLog "Synchro Request Begin"	'同步请求开始
	Set ReceivedDoc = server.CreateObject("MSXML2.DOMDocument") 
    ReceivedDoc.async=False 
	'是否同步
    ReceivedDoc.load Request
	'取得post请求
	'///////////////////////////////////
	
	If (ReceivedDoc.parseError.errorCode <> 0) Then
        Set myErr = ReceivedDoc.parseError
		set oResponseSoapBody = oResponseDom.selectSingleNode("//SyncOrderRelationResp")
		oResponseSoapBody.selectSingleNode("hRet").text = "9014"
		'无法解析SOAP和XML结构
		oResponseDom.save(Response)
	    WriteLog "Have error " & myErr.reason
		'response.End()
    End If
	if ReceivedDoc.childNodes.length=0 then
		set oResponseSoapBody = oResponseDom.selectSingleNode("//SyncOrderRelationResp")
		oResponseSoapBody.selectSingleNode("hRet").text = "9014"
		oResponseDom.save(Response)
		WriteLog "无法解析SOAP和XML结构。" 
		'response.End()
	end if
	
   '//////////////////////////////////////
    '得到POST过来的XML文档
	a= ReceivedDoc.selectSingleNode("//TransactionID").text 
	WriteLog "TransactionID="&a
	'消息编号
	b= ReceivedDoc.selectSingleNode("//Version").text
	WriteLog "Version="&b
	'该接口消息的版本号
	c= ReceivedDoc.selectSingleNode("//MsgType").text
	WriteLog "MsgType="&c
	'消息类型
	
    d= ReceivedDoc.selectSingleNode("//Send_Address/DeviceType").text
	WriteLog "DeviceType="&d
	e = ReceivedDoc.selectSingleNode("//Send_Address/DeviceID").text
	WriteLog "DeviceID="&e
	
	f= ReceivedDoc.selectSingleNode("//Dest_Address/DeviceType").text
	WriteLog "DeviceType="&f
	g= ReceivedDoc.selectSingleNode("//Dest_Address/DeviceID").text
	WriteLog "DeviceID="&g
	
	
    h= ReceivedDoc.selectSingleNode("//FeeUser_ID/UserIDType").text
	WriteLog "UserIDType="&h
	i= ReceivedDoc.selectSingleNode("//FeeUser_ID/MSISDN").text
	WriteLog "MSISDN="&i
	j = ReceivedDoc.selectSingleNode("//FeeUser_ID/PseudoCode").text
	WriteLog "PseudoCode="&j

	k= ReceivedDoc.selectSingleNode("//DestUser_ID/UserIDType").text
	WriteLog "UserIDType="&k
	l= ReceivedDoc.selectSingleNode("//DestUser_ID/MSISDN").text
	WriteLog "MSISDN="&l
	m= ReceivedDoc.selectSingleNode("//DestUser_ID/PseudoCode").text
	WriteLog "PseudoCode="&m
	
	n= ReceivedDoc.selectSingleNode("//LinkID").text
	WriteLog "LinkID="&n
	o= ReceivedDoc.selectSingleNode("//ActionID").text
	WriteLog "ActionID="&o
	p= ReceivedDoc.selectSingleNode("//ActionReasonID").text
	WriteLog "ActionReasonID="&p
	q= ReceivedDoc.selectSingleNode("//SPID").text
	WriteLog "SPID="&q
	r= ReceivedDoc.selectSingleNode("//SPServiceID").text
	WriteLog "SPServiceID="&r
	s= ReceivedDoc.selectSingleNode("//AccessMode").text
	WriteLog "AccessMode="&s
	t= ReceivedDoc.selectSingleNode("//FeatureStr").text
	WriteLog "FeatureStr="&t
	 Set ReceivedDoc =nothing	
   WriteLog "同步请求结束"&now()
    WriteLog ""
 
	if nRet<>0 then	'Rem ---------出错处理接口
		nRet = 1
		WriteLog "同步正向订购关系失败 "&now()
	else
		'Rem---------正确返回结果
		sql="select * from tb_test where  i='"&i &"'and  r='"&r&"'"
		rs.open sql,conn,1,3
		if (rs.eof and rs.bof )then '相同号码相同业务代码的不存在
			if  o=1 then
				logout="0"
				logindate=now()
				rs.addnew  '增加
				rs("logindate")=logindate
				rs("logout")=logout
				rs("a")=a
				rs("b")=b
				rs("c")=c
				rs("d")=d
				rs("e")=e
				rs("f")=f
				rs("g")=g
				rs("h")=h
				rs("i")=i
				rs("j")=j
				rs("k")=k
				rs("l")=l
				rs("m")=m
				rs("n")=n
				rs("o")=o
				rs("p")=p
				rs("q")=q
				rs("r")=r
				rs("s")=s
				rs("t")=t
				rs.update
			end if
		else'号码存在
			if  o=2 or o=4 then
				logout="1"
				logoutdate=now()
				rs("logout")=logout
				rs("logoutdate")=logoutdate
				rs.update
			else
				logout="0"
				rs("logout")=logout
				rs.update
			end if 
		end if 
		rs.close
		set rs=nothing
		conn.close
		set conn=nothing
	end if

	nRet=0
	WriteLog "同步应答开始"
	 Set oResponseDom = Server.CreateObject("MSXML2.DOMDocument")
    oResponseDom.async = false'是否同步
	oResponseDom.load(Server.MapPath("SyncOrderRelationResp.xml"))'取得回复格式
	
	oResponseDom.selectSingleNode("//TransactionID").text = a
	WriteLog "TransactionID="&a 
	oResponseDom.selectSingleNode("//hRet").text = nRet
	WriteLog "hRet="&nRet
    '--------------------------------------回送XML。
	oResponseDom.save(Response)
	Set oResponseDom =nothing
	WriteLog "同步应答结束"
	WriteLog "==================================="
	WriteLog ""
	WriteLog ""
%> 



连接数据库文件conn.asp
<%  
dim conn,strconn
strconn ="Provider=SQLOLEDB;DATABASE=Provider;Persist Security Info=True;UID=sa;PWD=owen;Data Source=127.0.0.1"
set conn = server.createobject("adodb.connection")
conn.open strconn
set rs=server.createobject("adodb.recordset")
%>


在SQL中创建如下表

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tb_test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tb_test]
GO

CREATE TABLE [dbo].[tb_test] (
	[id] [decimal](18, 0) IDENTITY (1, 1) NOT NULL ,
	[logindate] [datetime] NULL ,
	[logout] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[logoutdate] [datetime] NULL ,
	[a] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[b] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[c] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[d] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[e] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[f] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[g] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[h] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[i] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[j] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[k] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[l] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[m] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[n] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[o] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[p] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[q] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[r] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[s] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[t] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO


同级目录下建立名为:out_SyncOrderRelationReq.txt文件

建立如下SyncOrderRelationResp.xml文件
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
	<SOAP-ENV:Header>
		<TransactionID xmlns="http://www.monternet.com/dsmp/schemas/"></TransactionID>
	</SOAP-ENV:Header>
	<SOAP-ENV:Body>
		<SyncOrderRelationResp xmlns="http://www.monternet.com/dsmp/schemas/">
			<Version>1.5.0</Version>
			<MsgType>SyncOrderRelationResp</MsgType>
			<hRet></hRet>
		</SyncOrderRelationResp>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

MISC SP 业务反向取消接口

  • 2008年07月03日 12:27
  • 235KB
  • 下载

ASP.NET后台为移动端提供接口

引言         最近公司交给我个任务,为IOS移动端写接口。现有公司的软件是ASP.NET做的,现在想把某些功能移植到IOS APP上。大多数对外接口会实现webservice方法,但经理...

移动MAS接口 ASP开发包

  • 2012年05月30日 09:53
  • 2.97MB
  • 下载

中国移动短信MISC割接

短信息中心错误与中国移动代码的对应关系。 MI::zzzz SMSC返回状态报告的状态值为EXPIRED MJ:zzzz SMSC返回状态报告的状态值为DELETED MK:zzzz...

移动支付misc

由于公司有想去做移动支付终端,所以学习了40多天PBOC(the People's Bank of China) 2.0 spec。后来由于种种原因而流产,在这里把自己学习的东西做个总结。此文主要...
  • rex_nie
  • rex_nie
  • 2012年12月15日 01:32
  • 783

MISC SP订购通知接口

第一步:接收MISC报文            string sXmlMessage = "";            // string Temp = "";            System.I...

支付宝接口程序、文档及解读(ASP.NET)

 支付宝接口程序、文档及解读(ASP.NET) 最近需要为网站加入支付宝的充值接口,而目前关于支付宝接口开发的资料比较杂乱,这里就我此次开发所用到的资料进行汇总整理,希望能够帮助需...
  • hyhyct
  • hyhyct
  • 2014年08月19日 23:21
  • 570

支付宝接口程序、文档及解读(ASP.NET)

最近需要为网站加入支付宝的充值接口,而目前关于支付宝接口开发的资料比较杂乱,这里就我此次开发所用到的资料进行汇总整理,希望能够帮助需要的朋友。 开发步骤: 1. 确定签约类型 支付宝...

支付宝接口程序、文档及解读(ASP.NET)

最近需要为网站加入支付宝的充值接口,而目前关于支付宝接口开发的资料比较杂乱,这里就我此次开发所用到的资料进行汇总整理,希望能够帮助需要的朋友。 开发步骤: 1. 确定签约类型 支付宝的接口有多种类型,...
  • xh16319
  • xh16319
  • 2012年10月09日 22:23
  • 2527
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:移动MISC接口1.6程序[ASP]
举报原因:
原因补充:

(最多只允许输入30个字)