4. 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>
4. 5使用C#调用
无需下载任何
组件
新建项目Visual C#项目
windows应用程序。
在解决方案资源管理器中添加web引用,输入wsdl文件所在地址。
将web引用改名.
yundan.(service_name)即可引用
*需引用System.web.services*
例程:
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data;
- namespace csharp
- {
- public class Form1 : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox textBox1;
- private System.ComponentModel.Container components = null;
- public Form1()
- {
- InitializeComponent();
- }
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if (components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows Form Designer generated code
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.SuspendLayout();
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(88, 48);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(91, 14);
- this.label1.TabIndex = 0;
- this.label1.Text = "Webservice演示";
- this.textBox1.Location = new System.Drawing.Point(88, 128);
- this.textBox1.Name = "textBox1";
- this.textBox1.TabIndex = 1;
- this.textBox1.Text = "textBox1";
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(292, 273);
- this.Controls.AddRange(new System.Windows.Forms.Control[]
- {
- this.textBox1,
- this.label1
- });
- this.Name = "Form1";
- this.Text = "C#Webservie演示";
- this.Load += new System.EventHandler(this.Form1_Load);
- this.ResumeLayout(false);
- }
- #endregion
- [STAThread]
- static void Main()
- {
- Application.Run(new Form1());
- }
-
- private void Form1_Load(object sender, System.EventArgs e)
- {
- int str;
- 你的web引用的名字.Service1 cc=new 你的web引用的名字.Service1();
- str=cc.test(123,324);
- textBox1.Text=str.ToString();
- }
- }
- }
需下载msSoapToolkit20.exe
引用:MSSOAP.SoapClient
例程:
- var WSDL_URL = "http://192.168.0.4/yundan/service1.wsdl"
- WScript.echo("Connecting: " + WSDL_URL)
- var Calc = WScript.CreateObject("MSSOAP.SoapClient")
- Calc.mssoapinit(WSDL_URL, "", "", "")
- var Answer
- Answer = Calc.test(14,28)
- WScript.Echo("14+28=" + Answer)
将其存成domo.js文件,直接双击运行。
分享到:
相关推荐
详细解析webservice的原理和使用,帮助新手快速上手。
Webservice教学
webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录质
axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例
简单例子:axis2整合spring发布webservice,以及session的管理
本案例实现使用Axis2生成.arr包发布WebService服务,并使用Axis2生成客户端代码方式调用WebService
Java_WebService开发系列.ppt ,希望有帮助
ASP.NET & WebService教学ppt(上),非常实用!
Axis2是目前比较流行的WebService引擎。WebService被应用在很多不同的场景。例如,可以使用WebService来发布服务端 Java类的方法,以便使用不同的客户端进行调用。这样可以有效地集成多种不同的技术来完成应用系统。...
Axis2WebService源码。本地测试通过。
webservice的入门概念及java的开发webservice框架
springboot+webservice搭建webservice服务端及使用java客户端两种方式进行调用
Axis2创建WebService
WebService是一个新概念,它的系统架构、实现技术是现有应用的面向Internet的一个延伸。Web是为了程序到用户的交互,而Web Service是为程序到程序的交互作准备,Web Service已成为IT产业近几年来探索的热点课题之一...
webservice eclipse插件1
Axis2 webservice 服务端插件 用于集成MyEclipse
webService 开发
[尚硅谷]_张晓飞_Webservice教学课件