Consume Web Services with Lotuscript

Hi All,I am trying to consume web services with 8.5 designer.

  1. I have imported the wsdl file successfully using the new design element in 8.5 designer client.

Here the lotus cript code created by the designer.


%INCLUDE “lsxsd.lss”

Const n0 = “http://www.midasactionapisoaphandler.com/definitions/MidasActionAPISoapHandlerRemoteInterface

Class MidasActionAPISoapHandlerJavaPortType_n0 As PortTypeBase

Sub NEW

	Call Service.Initialize ("MidasActionAPISoapHandlerServiceWsdlMidasActionAPISoapHandlerService", _

	"MidasActionAPISoapHandlerService.MidasActionAPISoapHandlerPort", "http://localhost:8080/midassoapapi/servlet/rpcrouter", _

	"MidasActionAPISoapHandlerJavaPortType_n0")

	

End Sub



Function midasActionAPI(apiNames As XSD_ANYTYPE, zone As XSD_ANYTYPE, xml As XSD_ANYTYPE, _

returnFormat As XSD_ANYTYPE) As String

	Let midasActionAPI = Service.Invoke("midasActionAPI", apiNames, zone, xml, returnFormat)

End Function

End Class


I have written a agent were i call the above script.

Sub Initialize

Dim session As New NotesSession

Dim domParser As NotesDOMParser

Dim db As NotesDatabase

Dim item As NotesItem

Dim docNode As NotesDOMDocumentNode

Set db = session.CurrentDatabase

Set doc = New NotesDocument(db)

Dim chuck As Variant

Dim xml_in As NotesStream

Dim  outputStream As NotesStream

Dim zone As  XSD_ANYTYPE

Dim xmloutput  As New   XSD_ANYTYPE()

Dim APINAME As  XSD_ANYTYPE

filename$ = "c:\CUSD_INSERT_IT2.xml" 

outputFile = "c:\DOMtree.txt"

Set xml_in = session.CreateStream



xml_in.Open filename$,"ASCII"

xml_in.Position = 0

' = xml_in.ReadText()

’ call xmloutput.SetValueFromString =xml_in.ReadText()

’ APINAME= “SUSHANT”

'Messagebox XMLOUTPUTFINAL

'Set outputStream =session.CreateStream

'outputStream.Open (outputFile)

'outputStream.Truncate

'create DOM parser and process

'If Not xml_in.Open(filename$) Then

	'Msgbox "cannot open" & filename$, , "XML file error"

	'Exit Sub

'End If

xmlfile ="CUSD"

'Set domParser=session.CreateDOMParser(xml_in , outputStream)

'domParser.Process

'APINAME=

'get the document node

'Set docNode = domParser.Document

Dim result As String

'WRITE!MIDAS.CUST",  ,XMLOUTPUTFINAL,"0"

Set STUB = New 	MidasActionAPISoapHandlerJavaPortType_n0 ()



'Call stub.midasActionAPI("WRITE!MIDAS.CUST","NEWYORK",xmlfile,"0")

'Dim stub As New  MidasActionAPISoapHandlerJavaPortType_n0

’ result = thewebservice.midasActionAPI(“WRITE!MIDAS.CUST”, “NEW_YORK”,“”,“1”)

Call stub.midasActionAPI("WRITE!MIDAS.CUST", NEW_YORK,"<CUST>","1")

End Sub


Now I see that i have to define

Dim zone As XSD_ANYTYPE

Dim xmloutput  As New   XSD_ANYTYPE()

But how do i set the value of zone and get the value of Zone.

Please help.

Thanks

Sushant

Subject: Check out lsxsd.lss file.

The lsxsd.lss file contains the information you need. Should be in your notes or domino root folder.

For XSD_ANYTYPE is set as LS_PROXY_OBJECT.


PUBLIC CLASS LS_PROXY_OBJECT

PRIVATE ValueAsString As String



SUB setValueFromString (value As String)

	ValueAsString = value

END SUB



FUNCTION getValueAsString () As String

	getValueAsString = ValueAsString

END FUNCTION

END CLASS


Hope that helps.

Subject: I am now getting 404 error.

Hi ,Thanks a lot for the response .

I have made use of your pointers used .

Dim APINAME As New XSD_ANYTYPE()

Dim zone As New  XSD_ANYTYPE()

Dim returntype As New  XSD_ANYTYPE()

Call APINAME.setValueFromString("WRITE!MIDAS.CUST")

Call xmloutput .setValueFromString("CUST")

Call zone.setValueFromString("New_YORK")

Call returntype.setValueFromString("0")

To set the value and use

Call stub.midasActionAPI(APINAME, zone,xmloutput,returntype)

To call the web services method.

But now i am getting a 404 error.

the WSDL file creates web services which refer to the url.

http://localhost:8080/midassoapapi/servlet/rpcr

outer"

but my application is at

https://usnyabc2.abcfinance.net:9500/frwksoapapi/wsdl/MidasActionAPISoapHandler-service.wsdl

i have replaced http://localhost:8080 with

https://usnyabc2.abcfinance.net:9500

and i am getting 404 error .

What should i do to correct the error .

Please help.

Thanks

Sushant

Subject: Try SoapUI for debugging.

404 means the URL you have to making the SOAP call is not correct.

It will allow you to debug/test/loadtest your webservice to see what is going on.

Subject: Here is the log form SOAPUI

Hi ,Thank you for the response.

I had already down loaded the soapUI , few days before and imported the wsdl file.

I have tested in now and i get the following error

Any idea , what can be wrong.

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> “[\r][\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> "<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:com="Search - Microsoft Bing

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " soapenv:Header/[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " soapenv:Body[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " <com:midasActionAPI soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/“>[\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " “WRITE!MIDAS.CUST”[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " “NEW_YORK”[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " “”[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " “0”[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " </com:midasActionAPI>[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> " </soapenv:Body>[\n]"

Tue Apr 28 16:46:38 EDT 2009:DEBUG:>> “</soapenv:Envelope>”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:<< “HTTP/1.1 404 Not Found[\r][\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:<< “HTTP/1.1 404 Not Found[\r][\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:<< “Server: WebSphere Application Server/5.1[\r][\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:<< “Content-Type: text/html[\r][\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:<< “Content-Length: 172[\r][\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:<< “[\r][\n]”

Tue Apr 28 16:46:38 EDT 2009:DEBUG:<< “

Virtual Host or Web Application Not Found


The web group /midassoapapi/servlet/rpcrouter has not been defined


IBM WebSphere Application Server

Subject: Check your URL

If the URL is correct and your going through a proxy you will need to configure the proxy at the domino server configuration.

Subject: I am now getting INVALID SSL Message.

Hi All,I am getting invalid SSL message.

I am using the URL

https://usnyanc2.rzbfinance.net:80/midassoapapi/servlet/rpcrouter

What could be the issue?

Thanks

Sushant

Subject: Ok your into a different issue now.

I normally connect to the URL with firefox and get a breakdown of what the actual certificate error is.

What it might be is if you have a proxy, your connecting to one address and receiving a certificate for a different one.

Don’t have details on how to resolve this offhand but I’ll ask around.

Subject: Yes your correct. The problem is with the URL

Hi Simon,Thanks again for the response.

The problem is with the URL.

I have a question . The soap UI creates a URL as end point.

http:/localhost/midassoapapi/servlet/rpcrouter

But on my local machine there is no server.

So i must replace the URL Hostpart to the Server Port . Is that correct?

Also what does midassoapapi/servlet/rpcrouter mean.

Thanks

Sushant