Domino R8+版本编写及调用webservice



【背景】

随着web系统业务的深入开发,与第三方系统集成的需求越来越多,系统之间集成的方法也比较多,如通过jdbcodbc直接与关系数据库进行增、删、改操作,本文主要介绍通过webservice与第三方系统集成方法。

 

【基础要求】

        1Webservice提供者(designer7版本web服务)

        domino服务器:7以上版本

        designer客户端:7以上版本

        2webservice使用者

        domino服务器:8以上版本

        designer客户端:8以上版本

 

webservice提供者】

        供第三方系统调用与domino系统集成的webservice接口。

        新建步骤如下:

        Designer客户端-->数据库-->代码-->Web Service提供者-->新建

        WebService属性见截图:

 

 

        参考代码:

 

Class OAType
	Public sTypeID As String		'类型编码
	Public sTypeName As String	'类型名称
End Class


Class ImportOAType
	Private session As NotesSession
	Private db As NotesDatabase
	
	Sub new
		Set session = New NotesSession
		Set db = session.CurrentDatabase
	End Sub
	
	Public Function createType(arrType() As OAType) As Boolean
		On Error Goto errHandle
		Dim i As Integer
		Dim doc As NotesDocument
		createType = False
		For i=0 To Ubound(arrType)
			Set doc = db.CreateDocument()			
			doc.Form = "WebserviceEmpForm"
			
			doc.StTypeID = arrType(i).sTypeID
			doc.StTypeName = arrType(i).sTypeName
			
			Call doc.Save(True,False)
		Next
		createType = True
		Exit Function
errhandle:
		Msgbox "createType函数出错,出错信息:" & Error & ",出错行:" & Cstr(Erl())
		Exit Function
	End Function
End Class

webservice地址:http://<服务器地址>/<数据库路径>/<webservice提供者>?wsdl

建议数据库ACL支持anonymous,否则调用时还需提供用户名、密码。

webservice使用者】

        domino调用第三方系统的webservice接口。

        新建步骤如下:

        1Designer客户端-->数据库-->代码-->Web Service使用者-->新建

        2、选择指向WSDL文件的URL”,并输入webservicewsdl地址

        点击确定,生成Web Service使用者的设计元素,可直接在代理中引用,类似于脚本库的功能,参见下面调用webservice代码:Use "testweb3"。

 

【调用webservice代码】

%REM
	Agent ExecuteWebservice
	Created 2012-6-13
	Description: Comments for Agent
%END REM
Option Public
Option Declare
Use "testweb3"

Sub Initialize
	On Error GoTo errhandle
	Dim ss As New NotesSession
	Dim i As Integer
	Dim arrOaType(1) As Oatype
	
	For i=0 To UBound(arrOaType)
		Set arrOaType(i) = New Oatype
		
		arrOaType(i).Stypeid = "000" & i
		arrOaType(i).Stypename = "类型" & i
		MsgBox "i==" & i
	Next
	
	Dim createType As New Importoatype
	Dim bReturn As Boolean
	Call createType.Createtype(arrOaType)
	'bReturn = createType.Createtype(arrOaType)	
	
	MsgBox "成功!"
	
	
	Exit Sub
errhandle:	
	MsgBox ss.CurrentDatabase.FilePath + "数据库中的"+ ss.CurrentAgent.name+"代理的 Initialize 方法发生错误:"+Error + ", 错误行号:" + CStr(Erl())
	Exit sub
End Sub


这样子看来,是不是webservice也没有那么神秘了?


数据库下载链接:点击打开链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值