在使用 Lotusscript 开发 webservice 的过程中,有时会提示以下错误信息:

Web Service 已经保存,但是无效。: Please specify which class exposes your web service interface(s), using the ‘PortType class’ field of the Web Service properties panel.

按照提示排查,发现在属性框中’PortType class’已经指定了对应的类名。既然不是这里的问题,那只能回头看代码了:

Class Test
Sub printDoc(doc As NotesDocument)

End Sub
End Class

代码足够简单:仅有一个空白方法的 Class。

这个方法没有声明权限,按帮助中说的默认是 Public。那么此方法就会暴露到 WSDL 中,可以通过 webservice 调用。

问题出来了:通过 webservice 调用时如何能传进来一个 NotesDocument 对象呢?这显然是不可能的。赶紧把方法改成 Private 或者把 doc 参数改为 String 类型,问题就解决了。

总结:暴露给 webservice 的方法/函数,不能以 Domino 对象作为参数。