-- 作者:lmt_2000
-- 发布时间:8/16/2005 12:17:00 PM
-- 关于接受远程soap封装得数据?
请问各位大虾们,怎么接受一个远程用soap封装得数据啊? '+================XmlTranslate(XMLStr,XMLCommand)========================= 'Name: XmlTranslate(XMLStr,XMLCommand) 'Function: Translate the XML code to string 'Paramete: XMLStr string which will be translate ' XMLCommand The command code will be find '------------------------------------------------------------------------- Function XmlTranslate(XMLStr,XMLCommand) if len(trim(XMLStr))<1 or len(trim(XMLCommand))<1 then XmlTranslate="" exit function End if dim staXML,endXML,strPo,endPo,lenstr,Ltempstr staXML="<"&trim(XMLCommand)&">" endXML="</"&trim(XMLCommand)&">" strPO=instr(trim(XMLStr),staXML)+len(trim(staXML)) endPo=instr(trim(XMLStr),endXML) lenstr=endPo-strPo if len(xmlstr)>strPo then Ltempstr=right(XMLStr,len(XMLStr)-strPo+1) end if if lenstr>=0 then XmlTranslate=left(Ltempstr,lenstr) else XmlTranslate="" end if End Function '--------------------------------------------------------------------------- '+===================GetValue()============================================= 'Name GetValue() 'Function: This function will help the server side receive and decode the ' data from client side,and it only suit to the request way of post 'Return: It will return a string with XML format 'Relative Function: XmlTranslate used to get the special value by tagname 'Author: dave '---------------------------------------------------------------------------- function GetValue() dim strv strv="False" if Request.ServerVariables("REQUEST_METHOD") = "POST" then if Request.ServerVariables("CONTENT_TYPE")="application/x-www-form-urlencoded" then '如果是常规数据,让CGI来处理 strv="<root>" i=0 for each name in request.form strv=strv&"<"&name&">"&request.form(name)&"</"&name&">" i=i+1 next if i=0 then '如果请求值为空返回False strv="False" else strv=strv&"</root>" end if else '如果是XMLHTTP连接,将Request对象转载入XML解释器 dim lngCount '客户传来的数据和 dim vntPostedData '客户传来得数据 lngCount = Request.TotalBytes vntPostedData = Request.BinaryRead(lngCount) vntPostedData = bytes2BSTR(vntPostedData) strv=vntPostedData end if end if GetValue=strv end function '------------------------------------------------------------------------- '---------------bytes2BSTR(vIn)------------------------------------------- 'Name: bytes2BSTR(vIn) 'Function: Translate the bytes character into string type 'Para: vIn The variable which will be translate '------------------------------------------------------------------------- Function bytes2BSTR(vIn) rem * Translate the bytes character into string character strReturn = "" For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode < &H80 Then strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) i = i + 1 End If Next bytes2BSTR = strReturn End Function '------------------------------------------------------------------------- %> <!--#include file="./common/funs.asp"--> <!--#include file="./common/conn.asp"--> <% rem ** =============================================================== rem ** FileName: Total_ledgerRes.asp rem ** Function: To Verify whether balance of the ledger equal to the rem ** each other or not according to the request message rem ** of chinaVnet. rem ** Author: Dave date:13th.Aug.2003 rem ** =============================================================== dim SenderID,TimeStamp,SPID,LedgerType,StartDate,EndDate,Result dim TotalCount,TotalFee dim getstr getstr=GetValue() if trim(getstr)="" then response.write "现在还没有返回信息" response.end else SenderID=XmlTranslate(getstr,"SenderID") TimeStamp=XmlTranslate(getstr,"TimeStamp") SPID=XmlTranslate(getstr,"SPID") LedgerType=XmlTranslate(getstr,"LedgerType") StartDate=XmlTranslate(getstr,"StartDate") EndDate=XmlTranslate(getstr,"EndDate") TotalCount=XmlTranslate(getstr,"TotalCount") TotalFee=XmlTranslate(getstr,"TotalFee") Result=XmlTranslate(getstr,"Result") select case Result case 0 resultid=0 rem ** 对账成功,金额相同 rem ** 对账成功,老蚌进行一定的处理 ErrorDescription="联接成功" case 1 resultid=0 rem ** 对账成功,误差在定义范围内!" rem ** 对账成功,老蚌进行一定的处理 ErrorDescription="联接成功" case -1001 rem ** 对账不平 ErrorDescription="联接成功" case -1002 resultid=0 rem ** 还不能对该日期进行对账! ErrorDescription="联接成功" rem ** 是否传明细账 case -1003 resultid=0 rem ** 对账已经过期,不能进行该日期进行对账 ErrorDescription="联接成功" case -1004 resultid=0 ErrorDescription="联接成功" case else resultid=-1001 'ErrorDescription="联接失败" end select end if if trim(TotalCount)<>"" and trim(TotalFee)<>"" then sql="insert into TAB_Total_ledger (SenderID,STimeStamp,LedgerType,StartDate,EndDate,Result,TotalCount,TotalFee,cdate) values" sql=sql&"('"&SenderID&"','"&TimeStamp&"','"&LedgerType&"','"&StartDate&"','"&EndDate&"','"&Result&"','"&TotalCount&"','"&TotalFee&"',getdate())" conn.execute sql resultid=0 ErrorDescription="接收成功!" else resultid=-1001 ErrorDescription="接收失败" end if response.write "<? xml version=""1.0"" encoding=""utf-8""?>" response.write "<GeneralLedgerFeedbackResponse>" response.write "<GeneralLedgerFeedbackResult>" response.write "<SenderID>"&SenderID&"</SenderID>" response.write "<Result>"&resultid&"</Result>" response.write "<ErrorDescription>"&ErrorDescription&"</ErrorDescription>" response.write "</GeneralLedgerFeedbackResult>" response.write "</GeneralLedgerFeedbackResponse>" %> 请问这个例子可以 接受远程得数据嘛?还有远程发来得数据,我在什么时间内接受有效啊!
|