 |
|
| I have just for educational purposes created a simple web service consumer with Lotus Domino Designer 8.5 Beta 2. So I thought I'd share and perhaps make someone happy. For this example I found a web service on which was kind of funny. It is called and let's you get biblic information by book, chapter and verse. The address to the WSDL-file can be found . 1. Create a web service consumer element. Name it and point to the WSDL-file either local or the url. The web service consumer gets created for you. Copy the class name that gets created, i.e. 'BibleWebserviceSoap_n0'. %INCLUDE "lsxsd.lss" Const n0 = "http://www.webserviceX.NET" Class BibleWebserviceSoap_n0 As PortTypeBase Sub NEW Call Service.Initialize ("HttpWwwWebserviceXNETBibleWebservice", _ "BibleWebservice.BibleWebserviceSoap", "http://www.webservicex.net/BibleWebservice.asmx", _ "BibleWebserviceSoap_n0") End Sub Function GetBibleWordsByChapterAndVerse(BookTitle As XSD_STRING, chapter As Long, _ Verse As Long) As XSD_STRING Set GetBibleWordsByChapterAndVerse = Service.Invoke("GetBibleWordsByChapterAndVerse", BookTitle, chapter, Verse) End Function Function GetBibleWordsbyKeyWord(BibleWords As XSD_STRING) As XSD_STRING Set GetBibleWordsbyKeyWord = Service.Invoke("GetBibleWordsbyKeyWord", BibleWords) End Function Function GetBookTitles() As XSD_STRING Set GetBookTitles = Service.Invoke("GetBookTitles") End Function Function GetBibleWordsByBookTitleAndChapter(BookTitle As XSD_STRING, chapter As Long) As XSD_STRING Set GetBibleWordsByBookTitleAndChapter = Service.Invoke("GetBibleWordsByBookTitleAndChapter", BookTitle, chapter) End Function End Class |
2. Create an agent. Add "Use 'web service consumer name' " in 'Options'. 3. Set target as 'None' in the agent properties, 4. Add this code in the 'initialize' section Dim bible As New BibleWebserviceSoap_n0 Dim bookTitles As XSD_STRING Dim session As New NotesSession Dim inputStream As NotesStream Dim domParser As NotesDOMParser Dim domDoc As NotesDOMDocumentNode Dim domNodeList As NotesDOMNodeList Dim domNode As NotesDOMNode Set inputStream = session.CreateStream Set bookTitles = bible.GetBookTitles() Call inputStream.WriteText(bookTitles.getValueAsString()) Set domParser = session.CreateDOMParser(inputStream) Call domParser.Process Set domDoc = domParser.Document Set domNodeList = domDoc.GetElementsByTagName("BookTitle") Set domNode = domNodeList.GetItem(1) ' Now get the text in the tag and prompt it to the user (or something else) msgbox domNode.FirstChild.NodeValue |
5. Run the agent So this agent will, when run, display the name of the first book in a message box to you which is 'Genesis'. |  |
| | Comments:
|
| | Comment posted 2009-01-20 22:22:30 by Mike Bryant
Thanks for the post. I didn't need all the code but for the lines I did, it was very helpful!
|
|
| | Comment posted 2009-01-20 22:51:27 by
Thank's for your comment Mike! Always appreciate feedback, especially good feedback
|
|
| | Comment posted 2009-02-26 18:21:47 by
Thanks, very informative. Two other questions occurred to me: 1) any ideas where work with both versions of WSDL; ie 1.x and 2.x? 2) many web services require authentication (that is, they need to produce a certificate) from the consumer ... any idea how that might work?
Paul Huntington Beach
|
|
| | Comment posted 2009-02-27 16:43:25 by
Hi Paul, Good questions. I will have to look closer into that. Don't know, sorry!
|
|
| | Comment posted 2009-03-02 14:51:35 by Peter Meuser
One of the few consumer examples on the net - Thanks a lot Niklas.
I am still figuring out how to get back a fault message from the called web service. Any ideas?
|
|
| | Comment posted 2009-03-02 16:38:36 by Peter Meuser
lsxsd.lss seems to be the only documentation about the ws implementation
[...] Dim fault As WS_Fault Set fault=service.getLastFault() FaultCode$=fault.GetFaultCode() FaultString$=fault.GetFaultString() [...]
|
|
| | Comment posted 2009-03-02 17:19:52 by
Peter, Glad you find it useful! I have not tried this out either. I took a quick look at lsxsd.lss as you suggested and the class 'WS_FAULT'. I will try this later on and add it to the code if it works.
Thanks!
|
|
| | Comment posted 2009-06-01 07:54:13 by Nitin
Hi All,
In my new project I have to consume a SharePoint WebService in Domino agent, Where I have to CheckOut/ChckIn the SharePoint document. I have written the code below to do so.... Dim client Dim wsDetails As String 'Dim theInstantV As Variant 'theInstantV = Now
Dim test As New soapclient("")
'Assigned a SharePoint WebService URL Const sWSDL = " 'Created a SOAP object to provide the webservice Set Client = CreateObject("MSSOAP.SoapClient") 'Initialise and call the webservice soap object Call Client.mssoapinit(sWSDL) 'CheckInFile function in sharepoint needs three parameter (PageURL, Comment, CheckInType) 'Called the CheckInFile function available in SharePoint lists.asmx webservice wsDetails = Client.CheckInFile(" Documents/icon-info.jpg", "Nitin to CheckIn", "1") Msgbox wsDetails The above code works fine when I run the agent manually, like right click on agent and say "RUN" but when I run this agent from Webbased notes form its giving an error as "Cannot create automation object". This error is coming on this line "Set Client = CreateObject("MSSOAP.SoapClient")".
I read on internet I found that the SOAPClient needs to be installed on domino server but my client are not allowing me to install. Is there any other option to consume the sharepoint webservice in domino? Yours help/guidance/views are very much appericiated.
|
|
| | Comment posted 2009-06-01 21:50:41 by
Hi Nitin, I took a quick look on the Internet to see if I could find anything for you. Unfortunately I have no experience myself on Sharepoint. I found no solutions, only two ideas that might help you or not.
1. 2.
Have you tried creating a web service consumer like the one I have demonstrated in this blogpost? The problem for you obviously is the creation of the Soap client object. If you use Domino's own SOAP client it might work? (which is what is done in this example).
Hope it works for you!
// Niklas
|
|
| | Comment posted 2009-06-02 09:18:57 by Nitin
Hi Niklas, Thanks for reply. I follow the process given in website below, this is an IBM website and they are saying about copying some soap files into our domino folders....plz have a look into it.
I have written this code in my lotus agent and this use to call on WebQuerySave agent, In Options, Option Public %INCLUDE "SoapConnect"
In Initialize,
'Assigned a SharePoint WebService URL Const sWSDL = "
Dim objBookingService
Set objBookingService = CreateObject("MSOSOAP.SoapClient30") 'Set Headers objBookingService.ClientProperty("ServerHTTPRequest") = True
'Load the WSDL locally, as the WSDL on the server needs a user name and password. objBookingService.mssoapinit(sWSDL)
Now I am getting different error, the error is, "WSDLReader: WSDLReader:XML Parser failed at linenumber 0, lineposition 0, reason is: System error: -2147012889. HRESULT=0x1: Incorrect function. - WSDLReader:Loading of the WSDL file failed HRESULT=0x80070057: The parameter is incorrect. - Client:One of the parameters supplied is invalid. HRESULT=0x80070057: The parameter is incorrect."
on line this, objBookingService.mssoapinit(sWSDL)
I browsed thorough lots of sites but didn't get proper answer, could you please check at your end.
Thanks, Nitin.
|
|
| | Comment posted 2009-06-06 20:51:20 by
Nitin, First I have a question before we start to analyze too deep. Which version of the Domino designer client do you have and which version is the Domino server on which the consumer is located?
|
|
| | Comment posted 2009-10-30 08:25:35 by
I tried this example but there is a problem.
Client : Lotus Notes 8.5.1 - Server : Domino 8.5
I tried your example.
WebService Consumer : %INCLUDE "lsxsd.lss" Const n0 = " Class TempConvertSoap_n0 As PortTypeBase Sub NEW Call Service.Initialize ("HttpTempuriOrgTempConvert", _ "TempConvert.TempConvertSoap", " _ "TempConvertSoap_n0") End Sub Function FahrenheitToCelsius(Fahrenheit As XSD_STRING) As XSD_STRING Set FahrenheitToCelsius = Service.Invoke("FahrenheitToCelsius", Fahrenheit) End Function Function CelsiusToFahrenheit(Celsius As XSD_STRING) As XSD_STRING Set CelsiusToFahrenheit = Service.Invoke("CelsiusToFahrenheit", Celsius) End Function End Class
Agent : %REM Agent getBible Created Oct 29, 2009 by Ferhat BULUT/BESTCODER Description: Comments for Agent %END REM Option Public Option Declare
Use "BibleWebservice" Sub Initialize() On Error GoTo ErrorHandler Dim bible As New BibleWebserviceSoap_n1 Dim bookTitles As XSD_STRING Dim session As New NotesSession Dim inputStream As NotesStream Dim domParser As NotesDOMParser Dim domDoc As NotesDOMDocumentNode Dim domNodeList As NotesDOMNodeList Dim domNode As NotesDOMNode Set inputStream = session.CreateStream Set bookTitles = bible.GetBookTitles() Call inputStream.WriteText(bookTitles.getValueAsString()) Set domParser = session.CreateDOMParser(inputStream) Call domParser.Process Set domDoc = domParser.Document Set domNodeList = domDoc.GetElementsByTagName("BookTitle") Set domNode = domNodeList.GetItem(1) ' Now get the text in the tag and prompt it to the user (or something else) MsgBox domNode.FirstChild.NodeValue Exit Sub ErrorHandler: MessageBox "Form : XXXX - Sub : XXXX" + Chr ( 13 ) + _ "Error No : " + Str ( Err ) + Chr ( 13 ) + _ "Description : " + Error$ + Chr ( 13 ) + _ "Error Line Number : " + CStr ( Erl ) End Sub
I got an error when i want to run this agent.
Error Code : 4746 Description : Web Service BibleWebserviceSoap_n1 method GetBookTitles error Web service BibleWebserviceSoap_n1 does not have specified service method GetBookTitles
I think, lotus doesn't get GetBookTitles function at BibleWebserviceSoap_n1 webservice. I don't understand why ?
In the server configuration : Internet Protocols -> Domino Web Engine -> Session authentication: Disabled
Internet Protocols -> Domino Web Engine -> Run web agents and web services concurrently? : Enabled
Internet Protocols -> Domino Web Engine -> Domino XML Services : Enabled
Any idea about this problem ?
Regards Ferhat
|
|
| | Comment posted 2009-10-30 09:28:06 by
nice article , i will try to my website servise customer
|
|
| | Comment posted 2009-11-01 12:48:57 by
Hi Ferhat,
The code in the web service consumer and the agent doesn't match. The web service consumer refers to some temp webservice and not webserviceX.net. Then class name is 'TempConvertSoap_n0' and the methods are some converting temperature methods.
In the agent however you are trying to create an instance of 'BibleWebserviceSoap_n1' to variable 'bible'. But first of all that class isn't defined anywhere from what I can see and hence the methods are not defined.
Maybe you attached the wrong web service consumer class?
// Niklas
|
|
| | Comment posted 2009-12-03 13:06:16 by
Cool,
Great example,
Thanks for writing about it
|
|
| | Comment posted 2009-12-16 19:08:48 by Bill Hanson
Hi Niklas,
Thanks for writing this article.
My current challenge is to integrate some Domino apps with our Salesforce.com instance. Have you had any success creating a consumer in Notes for the enterprise wsdl. Our enterprise WSDL imports without errors, but then there are duplicate classes (Manticore_Marketing_Activity_History_n2) and the 'EmailServicesAddress_n2' class is defined with a member named 'Function', which is a reserved word. Once I straightened those out manually(merged the manticore classes and renamed the 'Function' member), the script still would not save. The error message when saving was "The requested operation failed". I wonder if this is a problem with our instance or the enterprise wsdl in general.
What has been your experience (I noticed that you wrote a SFDC article, so I assumed you've already tried this)?
|
|
| | Comment posted 2009-12-16 19:42:47 by
Hi Bill, Glad you appreciate it!
I have not that much experience in Salesforce yet så unfortunately I don't know the answer to your question. However this has been in my todo list for a while now, so I will check this up and get back with my results.
Thanks for stopping by!
// Niklas
|
|
| | Comment posted 2009-12-23 07:47:18 by
Bill, I have tested this now and I have similar problems. I have no issues with the Manticore class but I have the same problem with the function in the EmailServicesAddress_n2 class.
When trying to get around this I also get 'The requested operation failed' when saving. Seems to be a general problem thus...
|
|
| | Comment posted 2010-01-04 18:36:41 by Bill Hanson
Thanks for checking. I still don't have a working solution for this. I'm currently using COM for my Domino to SFDC integration, but I would love to ditch the COM.
Recently, I tried using the partner.wsdl. It imports and saves properly, but now I am having problems setting the session ID in the soap object's session header. Do you know how this can be done? Is there a reference for the NotesWebServiceEngine class available somewhere? I'm hoping to find a 'setHeaderValue' method or maybe a way to set the header values via Invoke.
|
|
| | Comment posted 2010-01-11 04:06:58 by Damien Marshall
Bill & Niklas,
I really appreciate reading your experiences here... I am currently involved in migrating a Lotus Notes application to Salesforce.
I have been using Lotus Notes for years, but have never implemented any (complicated) "Domino" - so I don't know much about web services.
Do either of you know if it is possible to get Lotus Notes to connect to Salesforce and upsert data to Salesforce ?? My current plan is to invesigate using Web Services to do this - but if you can tell me it is not possible then that would save me some time - I am very surprised there isn't much documented on how to do this - which makes me think it can't be done...
Thanks in advance...
|
|
| | Comment posted 2010-01-11 08:40:17 by
Hi Damien, I might be able to help you here.
I have been responsible for a migration project where data from a Lotus Domino application involving several Notes databases were migrated to Salesforce. Salesforce themselves were also involved in the project although not in the actual migration. The recommendation from there side was to use the Data Loader ( which is a tool that can be used to extract or insert/upsert or delete data in Salesforce. You can download the tool for free (Setup -> Data Management -> Data Loader).
So this is way to go to upsert or insert data (migrate) and the idea very briefly (for a Sales application) is to start upserting data from the top to bottom. What that means is that first you need the top owners (User object), then Accounts, then the children to Accounts etc. Since each object need a reference to their parent if they have one this is the way to go.
Web services can then be used to integrate with other systems. Data Loader is also using web services but that is nothing we have to bother with really.
There are also several connectors but they are used for other purposes. One is for synchronizing email and calendar between Salesforce and Lotus Notes for example and another one is used for integrating Salesforce with Excel (
Hope that helps! If you need to I can probably assist with other migration tips since I have already been going through this journey once.
|
|
| | Comment posted 2010-01-12 01:24:27 by Damien Marshall
Niklas,
Thanks for that information.
We are already using CSV extracts from Notes to get the data into Salesforce using the DataLoader - for most of the 'migrated' data (Accounts, Contacts etc) this is great for a one off data transfer, but we also need to regularly synch users of SF with a HR database (in Notes).
At this stage we may be using a scheduled Data Loader batch job to process the CSV - but I was hoping to build something a bit more robust via Domino web service.
I will have a look at the Excel connector to see if I can learn how to get Domino to login to Salesforce and see where that takes me...
I am surprised not many people are integrating these two platforms - the only 'integration' seems to be from an email & calendar point of view - not generic Lotus Notes database to SF tables...
Thanks again...
|
|
| | Comment posted 2010-01-12 07:50:01 by
Damien, Ok, I see. We are using web services as well for several external systems that we need to integrate Salesforce with.
For two of the systems we call the Salesforce web services directly from Domino and one of them has Domino Web services implemented too. For most of the other external systems we have a middle layer which deals with all of the integration since not all systems are modern enough to communicate via web services. Anyway, this is working very well and the middle layer are using Web Methods.
My experience from this is also that there are not too many use cases with system integration between Salesforce and Domino.
|
|
| | Comment posted 2010-01-14 16:30:20 by Nicolas Reghem
Hello, I just tried this example and I got an error: 403 Forbidden. I don't understand why. I tried to create a very basic WS in another database and call it, but I got exactly the same error message.
I can't find any help on this... do you have an idea ?
Thanks a lot Nicolas
|
|
| | Comment posted 2010-01-14 17:14:24 by Nicolas Reghem
Additional information: I use a client version 8.0.2. I tried another test... instead of executing the agent on my local computer, I ran it on the server (by using another agent and the method "runonserver"). And it works with my own web service... so I assume the problem comes from the Notes client... any preferences is wrong or something else ? This test still doesn't work with your example, but the error message is not the same: error: Web Service BibleWebserviceSoap_n0 method GetBookTitles error Error connecting to 'www.webservicex.net' on port '80', The remote server is not a known TCP/IP host.
Whereas the website is available...
Thanks in advance for your help
|
|