4.7使用vb.net调用
无需下载任何
组件
新建项目Visual Basic项目
windows应用程序。
在解决方案资源管理器中添加web引用,输入wsdl文件所在地址。
将web引用改名为yundan.
yundan.(service_name)即可引用
*需引用System.web.services*
例程:
- Public Class Form1
- Inherits System.Windows.Forms.Form
- #Region " Windows 窗体设计器生成的代码 "
- Public Sub New()
- MyBase.New()
- InitializeComponent()
- End Sub
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
- Private components As System.ComponentModel.IContainer
- Friend WithEvents Label1 As System.Windows.Forms.Label
- Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.Label1 = New System.Windows.Forms.Label()
- Me.TextBox1 = New System.Windows.Forms.TextBox()
- Me.SuspendLayout()
- Me.Label1.AutoSize = True
- Me.Label1.Location = New System.Drawing.Point(96, 40)
- Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(91, 14)
- Me.Label1.TabIndex = 0
- Me.Label1.Text = "Webservice演示"
- Me.TextBox1.Location = New System.Drawing.Point(88, 144)
- Me.TextBox1.Name = "TextBox1"
- Me.TextBox1.TabIndex = 1
- Me.TextBox1.Text = "TextBox1"
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(292, 273)
- Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Label1})
- Me.Name = "Form1"
- Me.Text = "VB.net webserive演示"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Dim cc As yundan.Service1 = New yundan.Service1()
- TextBox1.Text = cc.test(12, 123)
- End Sub
- End Class
4.8使用vb6.0调用
需下载msSoapToolkit20.exe
添加引用:Microsoft Soap Type Library
位置:”C:\Program Files\Common Files\MSSoap\Binaries\ MSSOAP1.dll”
调用方法:
Dim cc As New MSSOAPLib.SoapClient
例程:
新建工程标准EXE添加3个textbox
控件,text1,text2,text3添加一个button控件Command1
代码如下:
- Option Explicit
- Dim cc As New MSSOAPLib.SoapClient
- Private Sub Command1_Click()
- cc.mssoapinit "http://192.168.0.4/yundan/Service1.asmx?WSDL"
- Me.Text3.Text = cc.test(CInt(Text1.Text), CInt(Text2.Text))
- End Sub
4.9使用vbscript调用
需下载msSoapToolkit20.exe
引用:MSSOAP.SoapClient
例程:
- Option Explicit
- Const WSDL_URL = "http://192.168.0.4/yundan/service1.wsdl"
- WScript.echo "Connecting: " & WSDL_URL
- Dim Calc
- Set Calc = CreateObject("MSSOAP.SoapClient")
- Calc.mssoapinit WSDL_URL
- Dim Answer
- Answer = Calc.test(14,28)
- WScript.Echo "14+28=" & Answer
将其存成domo.vbs文件,直接双击运行。
4.10使用vc调用
需下载mssoaptoolkit20.exe
引用
#import "msxml3.dll"
using namespace msxml2;
#import "c:\program files\common files\mssoap\binaries\mssoap1.dll" exclude("istream", "isequentialstream", "_large_integer", "_ularge_integer", "tagstatstg", "_filetime") raw_interfaces_only
using namespace mssoaplib;
例程:
新建工程àmfc appwizard(exe)[ mclient]àstep1à基本对话à其他默认值即可
修改源文件:
- < stdafx.h>
- // stdafx.h : include file for standard system include files,
- // or project specific include files that are used frequently, but
- // are changed infrequently
- //
-
- #if !defined(afx_stdafx_h__045cd307_9518_4af1_8ce3_8ffe38d1acb2__included_)
- #define afx_stdafx_h__045cd307_9518_4af1_8ce3_8ffe38d1acb2__included_
-
- #if _msc_ver > 1000
- #pragma once
- #endif // _msc_ver > 1000
-
- #define vc_extralean // exclude rarely-used stuff from windows headers
-
- #include <afxwin.h> // mfc core and standard components
- #include <afxext.h> // mfc extensions
- #include <afxdisp.h> // mfc automation classes
- #include <afxdtctl.h> // mfc support for internet explorer 4 common controls
- #ifndef _afx_no_afxcmn_support
- #include <afxcmn.h> // mfc support for windows common controls
- #endif // _afx_no_afxcmn_support
-
-
-
- #import "msxml3.dll"
- using namespace msxml2;
-
- #import "c:\program files\common files\mssoap\binaries\mssoap1.dll" exclude("istream", "isequentialstream", "_large_integer", "_ularge_integer", "tagstatstg", "_filetime") raw_interfaces_only
- using namespace mssoaplib;
-
-
- #define msg(message) \
- { \
- ::messagebox(null,_t(message),null,mb_ok | mb_iconexclamation| mb_applmodal);\
- goto cleanup; \
- }
-
-
- #define check_hresult(hr, message) \
- if (failed(hr)) \
- { \
- msg(message); \
- }
-
-
- //{{afx_insert_location}}
- // microsoft visual c++ will insert additional declarations immediately before the previous line.
-
- #endif // !defined(afx_stdafx_h__045cd307_9518_4af1_8ce3_8ffe38d1acb2__included_)
- <mclient.h>
- // mclient.h : main header file for the mclient application
- //
-
- #if !defined(afx_mclient_h__9a397da6_5a62_4aef_be5e_6c7629322ecc__included_)
- #define afx_mclient_h__9a397da6_5a62_4aef_be5e_6c7629322ecc__included_
-
- #if _msc_ver > 1000
- #pragma once
- #endif // _msc_ver > 1000
-
- #ifndef __afxwin_h__
- #error include 'stdafx.h' before including this file for pch
- #endif
-
- #include "resource.h" // main symbols
-
- /////////////////////////////////////////////////////////////////////////////
- // cmclientapp:
- // see mclient.cpp for the implementation of this class
- //
-
- class cmclientapp : public cwinapp
- {
- public:
- cmclientapp();
-
- // overrides
- // classwizard generated virtual function overrides
- //{{afx_virtual(cmclientapp)
- public:
- virtual bool initinstance();
- //}}afx_virtual
-
- // implementation
-
- //{{afx_msg(cmclientapp)
- // note - the classwizard will add and remove member functions here.
- // do not edit what you see in these blocks of generated code !
- //}}afx_msg
- declare_message_map()
- };
-
-
- /////////////////////////////////////////////////////////////////////////////
-
- //{{afx_insert_location}}
- // microsoft visual c++ will insert additional declarations immediately before the previous line.
-
- #endif // !defined(afx_mclient_h__9a397da6_5a62_4aef_be5e_6c7629322ecc__included_)
分享到:
相关推荐
详细解析webservice的原理和使用,帮助新手快速上手。
Webservice教学
webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录webservice摘录质
Java_WebService开发系列.ppt ,希望有帮助
ASP.NET & WebService教学ppt(上),非常实用!
webservice的入门概念及java的开发webservice框架
springboot+webservice搭建webservice服务端及使用java客户端两种方式进行调用
WebService是一个新概念,它的系统架构、实现技术是现有应用的面向Internet的一个延伸。Web是为了程序到用户的交互,而Web Service是为程序到程序的交互作准备,Web Service已成为IT产业近几年来探索的热点课题之一...
其他业务系统数据,传输到EAS系统服务器,通过凭证引入“webservice接口”,转化为EAS数据。 其他业务系统内的资金流动信息,实时地、非人工干预的传递到EAS系统,以财务凭证的形式,转化为EAS系统内的财务信息。 ...
webService 开发
[尚硅谷]_张晓飞_Webservice教学课件
测试webService;webservice测试调用工具WebserviceStudio20
WebService练习WebService练习WebService练习WebService练习
webservice视频教学,里面包括了源代码和视频文件,
调用WebService,最简单的办法当然是直接添加WEB引用,然后自动产生代理类,但是在调用JAVA的WebService时并没有这么简单,特别是对于SoapHeader的处理,通过C#添加Web引用方式访问JavaWebService的方法,除了string...
通过idea实现webservice
webservice测试调用工具 WebserviceStudio20 测试调用webservice