Using of SOAP and/or Web Service Costumers via LotusScript

Dear All,i wish to use a web service costumers.

Before the Domino 8.5.1 with my server 7.0.x i used call my WebService with the following LotusScript instructions in web Agent:

Set Serializer = CreateObject(“MSSOAP.SoapSerializer30”)

Set Connector = CreateObject(“MSSOAP.HttpConnector30”)

Set SOAPReader = CreateObject(“MSSOAP.SoapReader30”)

and the i call my webservice with method:

SOAPReader.Load Connector.OutputStream

with my actual domino 8.5.1 server the CreateObject instruction reaise the error:

Cannot create automation object

Server administrators tell me that there are some problems with Windows 2003 64bit with MSSOAP client 3.0 toolkit 32bit… than in necessary to use a “integrated LN 8.5.1 SOAP client” (???).

I think that the other solutions to call my WebService via LotusScript Agent (as do it correctly with 7.0.x server) is to use Web Service Consumer.

What is the correct way to use this web service consumer ? so far i have only import my web service (provider) WSDL in a web service consumer that i called “testWSC”. What do I do next?

Subject: Creating a Web Service consumer.

Hi,

The details are at the following link.

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.main.doc/H_INCORPORATING_WEB_SERVICES_LIBRARY.html

Short answer. Create Web Service consumer library (LotusScript). Point to your WSDL.

This will create a class of a particular name with methods pointing to each Web service call.

Then create a new agent, reference the consumer library and create the object and call the methods.

Subject: Re: Creating a Web Service consumer

Simon,

Thank you for your post and your recommendation. We resolved our problem, by essentially doing what you recommended. A code sample of our solution is shown below.

Thanks again,

KC

Code Sample:

Declarations

Dim gSession As NotesSession

Dim profsession As NotesSession

Dim profdb As NotesDatabase

Dim gDb As NotesDatabase

Dim profdoc As NotesDocument

Dim globalprofile As NotesDocument

Dim gUserProfile As NotesDocument

Dim profnam As NotesName

Dim client As Variant

Dim curid As String

Dim curdept As String

Dim curdeptvp As String

Dim curdeptsrvp As String

Dim curdepartmentmanagerid As String

Dim curdepartmentvpid As String

Dim curdepartmentsrvpid As String

Dim sessionXML As NotesSession

Dim gDomParser As NotesDOMParser

Dim domDoc As NotesDOMDocumentNode

Dim nodelist As NotesDOMNodeList

Dim parent As NotesDOMNode, child As NotesDOMNode

Dim value As String

Dim j As Integer, k As Integer

Dim qSoapRequest2 As String, qSoapResponse2 As String

Dim tempunderid As Variant

Dim tempunder1id As Variant

Dim undername As String

Dim under1name As String

Dim tempundername As String

Dim tempunder1name As String

Dim temp() As Variant

Dim tempcount As Integer

Dim tempA() As Variant

Dim tempAcount As Integer

Dim temp1() As Variant

Dim temp1count As Integer

Dim temp1A() As Variant

Dim temp1Acount As Integer

Dim adminid()As Variant

Dim adminidcount As Integer

Dim adminidexec()As Variant

Dim adminidexeccount As Integer

Dim prof_session As NotesSession

Dim prof_db As NotesDatabase

Dim prof_profdoc As NotesDocument

Dim profileswitch As String

'Profile Forms

Const gUserSettings = “UserSettings”

Sub Initialize

Set gSession = New NotesSession

Set gDb = gSession.CurrentDatabase

Set gUserProfile = gDb.GetProfileDocument(gUserSettings, gSession.UserName)

End Sub

Sub GetCurUserIDandDept()

On Error Resume Next



Dim rep1 As String, rep2 As String

Dim tmpResponse As String

Dim value As String

Dim j As Integer, k As Integer

Dim gItem As New NotesItem(gUserProfile, "DirectReportsIds", "")



'Get handle to DirectReportsIds and reset values	

gItem.Values = ""



'Create Soap Client

On Error Goto errorHandler



Dim objHttp As Variant

Set objHttp = CreateObject("MSXML2.XMLHTTP.6.0")



qSoapRequest2 = {<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:DefaultNamespace">

soapenv:Header/

soapenv:Body

  <urn:GETEMPLOYEEID soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

     <NOTESNAME xsi:type="xsd:string">} & profnam.Canonical & {</NOTESNAME>

  </urn:GETEMPLOYEEID>

</soapenv:Body>

</soapenv:Envelope>}

objHttp.open "POST", globalprofile.Endpoint1(0) + "?OpenWebService", False

objHttp.setRequestHeader "Content-Type", "text/xml; charset=UTF-8"

objHttp.send(qSoapRequest2)



qSoapResponse2 = objHttp.responseXML.xml



objHttp = Null

	

rep1 = Replace(qSoapResponse2, "&lt;", "<")

rep2 = Replace(rep1, "&gt;", ">")

tmpResponse = rep2



'Call web service and parse response

Set gDomParser = gSession.createDOMParser(tmpResponse)

Call gDomParser.Parse

Set domDoc = gDomParser.Document

Set nodeList = domDoc.GetElementsByTagName("Employee")



	'Error handling if nodeList is empty

If (nodeList.NumberOfEntries = 0) Then

	Msgbox "No employee data was found.", 0, "Error"

	End 'Stop all processing immediately		

End If

For j = 1 To nodeList.NumberOfEntries

	Set parent = nodeList.GetItem(j)

	For k = 1 To parent.NumberOfChildNodes

		If k = 1 Then

			Set child = parent.FirstChild	

		Else

			Set child = child.NextSibling

		End If			

'Allow for null values

		If child.FirstChild.IsNull Then

			value = ""

		Else

			value = child.FirstChild.NodeValue

		End If

		Select Case child.NodeName

		Case "empid"

			curid= value	

		Case "deptid"

			curdept= value

		End Select				

	Next k

Next j

errorHandler:

objHttp = Null	

Resume Next

End Sub

Subject: Thanks!

Hi! Thanks, I am trying to learn from this. However, I am not getting any response after sending the objHttp object…No errors nothing!! If sucessful, The objHttp.responseXML.xml should be automatically populated, right? Any clues?

Subject: Using MSSOAP with Notes 8.5.1 on Windows 7

Dadoo,

I read your post and was wondering if you found a solution. I am working with a client who will be upgrading to Notes 8.5.1 and Windows 7. In our testing we are experiencing the “Cannot create automation object” error message when we execute the following line of code:

Set Client = CreateObject(“MSSOAP.SoapClient”)

If you have any suggestions they would be greatly appreciated.

Thanks…