webservice系列教学(5)-如何调用webservice(Jscript,vbscript)

80酷酷网    80kuku.com

  js|jscript|vbscript|web4. 3 在asp中使用Jscript调用
需下载msSoapToolkit20.exe
引用:MSSOAP.SoapClient
    例程:
    <% LANGUAGE = JScript %>
<HTML>
<HEAD>
<TITLE>webservice演示</TITLE>
</HEAD>
<BODY>
    <%
         var WSDL_URL = "http://server0/yundan/webservice1.asmx?WSDL"
           var a, b, res
           var soapclient
            a = 12
            b = 13    
        soapclient = Server.CreateObject("MSSOAP.SoapClient")
        soapclient.ClientProperty("ServerHTTPRequest") = true
‘在ASP中运行 需要设置ServerHTTPRequest选项
soapclient.mssoapinit("http://192.168.0.4/yundan/Service1.WSDL","Service1","Service1Soap","")
        res = soapclient.test(2,3)
%>
<h3>webservice 演示</h3>
<B>Result:</B> <%=res%><P><P>
</BODY>
</HTML>
4. 4在asp中使用vbscript调用
需下载msSoapToolkit20.exe
引用:MSSOAP.SoapClient
    例程:
<% LANGUAGE = VBScript %>
<HTML>
<HEAD>
<TITLE>webservie演示</TITLE>
</HEAD>
<BODY>
<%
Dim soapclient
Const WSDL_URL = "http://192.168.0.4/yundan/service1.wsdl"
    set soapclient = Server.CreateObject("MSSOAP.SoapClient")
    soapclient.ClientProperty("ServerHTTPRequest") = True
    soapclient.mssoapinit
http://192.168.0.4:8080/yundan/Service1.WSDL","Service1","Service1Soap",""
Dim res
        res = soapclient.test(23, 34)
%>
<h1>webservie演示</h1>
<B>Result:</B> <%=res%><P><P>
</BODY>
</HTML>

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