首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

asp 调用webservice,该如何处理

2012-05-27 
asp 调用webservicehttp://221.204.249.205:8080/veSWScn/veSWScn.dll?HandlerGenveSWScnWSDL这个地址用a

asp 调用webservice
http://221.204.249.205:8080/veSWScn/veSWScn.dll?Handler=GenveSWScnWSDL

这个地址用asp如何调用获取返回数据

[解决办法]

VBScript code
<%Public Function SendHTTP(Method, URL, SendData,sCharset)    On Error ReSume Next    Dim HTTP        Set HTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")                HTTP.setTimeouts 10000,10000,10000,30000         HTTP.Open Method, URL, false, "", ""        Http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"        HTTP.send SendData            If Err.Number = 0 then        If HTTP.Readystate = 4 then            If HTTP.Status = 200 Then                SendHTTP = BytesToBSTR(HTTP.ResponseBody,sCharset)            Else                SendHTTP = ""            End If        Else            SendHTTP = ""        End If    Else        SendHTTP = ""    End If    Err.Clear    Set HTTP = nothingEnd FunctionPublic Function BytesToBSTR(Body,nCharset)    If Not LenB(Body) = 0 then        Dim ObjStream        Set ObjStream = Server.CreateObject("Adodb.Stream")        ObjStream.Type = 1        ObjStream.Mode = 3        ObjStream.Open        ObjStream.Write body        ObjStream.Position = 0        ObjStream.Type = 2        ObjStream.Charset = nCharset        BytesToBSTR = ObjStream.ReadText         ObjStream.Close        set ObjStream = Nothing    Else        BytesToBSTR = ""    End IFEnd FunctionDim ReturnValue,SendUrlSendUrl="http://221.204.249.205:8080/veSWScn/veSWScn.dll?Handler=GenveSWScnWSDL"ReturnValue = SendHTTP("GET",SendURL,null,"utf-8")Dim YouWantDaTa,tiaojiantiaojian="RtPnrIn"If not ReturnValue="" Then    dim XmlDoc,InfoXmlData                            Set XmlDoc = Server.CreateObject("msxml2.FreeThreadedDOMDocument.3.0")    XmlDoc.ASYNC = False            XmlDoc.loadxml(ReturnValue)    IF Not XmlDoc Is Nothing then                            set InfoXmlData=XmlDoc.selectSingleNode("//definitions")                IF not InfoXmlData is nothing then                                        YouWantDaTa=InfoXmlData.selectSingleNode("......")  '这里你自己查怎么,获取节点                    response.Write(YouWantDaTa)                    response.End()                Else                    RemoteADGetData = ""                End if    Else        RemoteADGetData = ""    End IfElse    RemoteADGetData = ""End If%>
[解决办法]
要递交SOAP头才可以
XML code
<S:Envelope    xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"    xmlns:XS="http://www.w3.org/2001/XMLSchema"    xmlns:XI="http://www.w3.org/2001/XMLSchema-instance"    xmlns:a="urn:veSWScnService"><S:Body><a:PAT S:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><a:bstrSS XI:type="XS:string">test</a:bstrSS><a:bstrPAT XI:type="XS:string">test</a:bstrPAT><a:strUser XI:type="XS:string">test</a:strUser></a:PAT></S:Body></S:Envelope> 

热点排行