Consume Web Service

I need to consume a web service called testStatus in lotuscript. There is a service called helloworld that needs no params and is called by setting up the client and then using:

client.helloWorld

this works fine however when i try to use the testStatus passing the three params eg

client.testStatus(1, 1, “Test”)

I get an automation object error. Any ide where im going wrong? I thought I may need to create some sort of xml object and pass that but ive not done it before? The code from the WSDL is below for the service im trying to use although ive changed the address

POST /TESTws/interface.asmx HTTP/1.1

Host: www.mywebsrvice.co.uk

Content-Type: text/xml; charset=utf-8

Content-Length: length

SOAPAction: “http://www.mywebsrvice.co.uk/webservices/TestStatus

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xmlns:xsd=“http://www.w3.org/2001/XMLSchema

xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/”>

soap:Body

<TestStatus xmlns="http://www.mywebsrvice.co.uk/webservices">

  <status>

    <OperationCompleted>boolean</OperationCompleted>

    <OperationSuccessful>boolean</OperationSuccessful>

    <ErrorMessage>string</ErrorMessage>

  </status>

</TestStatus>

</soap:Body>

</soap:Envelope>

Subject: Consume Web Service

Here is code that I have been using for yearsIt maybe easier to use

Dim db As NotesDatabase

Dim view As NotesView

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

Dim hMiles As String

Dim xmlapp As Variant

Dim sourceFile As Variant

Dim sZipCodes As Variant

Dim sDistance As Variant

Dim item As NotesItem

Sub Initialize

    'Web Serves URL information 

    'http://www.codebump.com/services/zipcodelookup.asmx?op=GetZipCodesWithin 

    Dim s As New notessession 

    

    Set db = s.CurrentDatabase 

    Set collection = db.unprocesseddocuments 

    Set doc = collection.GetFirstDocument 

    'Set View = db.GetView("LKNotRespondedTo") 

    'Set doc = View.GetFirstDocument 

    hMiles = "3" 

    

    While Not (doc Is Nothing ) 

            Dim gZipCodes As Variant 

            gZipCodes = doc.GetItemValue( "Zip" ) 

            sourceFile="http://www.codebump.com/services/zipcodelookup.asmx/GetZipCodesWithin?AuthenticationHeader=Vgt6lLkQq%2FdSYusIQ9qh%2FXxJnSvJdy9Fa98B7hIypsN8OY4bfPiL7IpLqypIFgbPnjmDG%2F%2BHOM0e7iPgPbvdWNENf%2FDAUp2m&zip=" + gZipCodes(0) + "&distance=" + hMiles 

            

            Set xmlapp = CreateObject("Microsoft.XMLDOM") 

            xmlapp.async = False

            xmlapp.load(sourceFile) 

            sZipCodes = ElementsByTagName(xmlapp,"ZipCode") 

            sDistance = ElementsByTagName(xmlapp,"Distance") 

            

            doc.Mile3 = sZipCodes 

            doc.Distance3 = sDistance 

            Call doc.Save(True,False) 

            

            Set doc = collection.GetNextDocument(doc)

            'Set doc = view.GetNextDocument(doc) 

    Wend 

End Sub

Function ElementsByTagName(xmlapp,Tag As String)As Variant

    Dim XMLList() As String 

    Dim x As Variant 

    Dim i As Integer 

    Set x=xmlapp.getElementsByTagName(Tag) 

    Redim XMLList(1 To x.length) 

    For i = 1 To x.length 

            XMLList(i)=(x.item(i-1).text) 

    Next 

    ElementsByTagName=XMLList 

End Function

Subject: RE: Consume Web Service

Thanks Michael,

The code you posted just returns a subscript out of range error on line 9 of the ElementsByTagName function.

Ive been searching and tried a couple of the other examples you have posted. I get these to work fine. I think the problem may be with the web service I am trying to consume. It seems that it is only allowed to run locally. If I type the service straight into the browser window I get

Runtime Error:

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Subject: RE: Consume Web Service

send me an e-mail with the web service that you are trying to use. I will see what I can do for you

Subject: RE: Consume Web Service

Thanks for the offer michael,

Its actually a secure connection so you wouldnt be able to access the web service without being on our network. I think its down to the fact that it needs to be a SOAP message thats sent and thats what I recieve back.

I just dont know how to create and subsequently call the service. the asmx is as follows but Im just reading up now on what it all means…

Test

The test form is only available for requests from the local machine.

SOAP 1.1

The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.

POST /TESTws/interface.asmx HTTP/1.1

Host: www.mywebservice.com

Content-Type: text/xml; charset=utf-8

Content-Length: length

SOAPAction: “http://www.mywebservice.com/webservices/TestStatus

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/”>

soap:Body

<TestStatus xmlns="http://www.mywebservice.com/webservices">

  <status>

    <OperationCompleted>boolean</OperationCompleted>

    <OperationSuccessful>boolean</OperationSuccessful>

    <ErrorMessage>string</ErrorMessage>

  </status>

</TestStatus>

</soap:Body>

</soap:Envelope>

HTTP/1.1 200 OK

Content-Type: text/xml; charset=utf-8

Content-Length: length

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/”>

soap:Body

<TestStatusResponse xmlns="http://www.mywebservice.com/webservices">

  <TestStatusResult>boolean</TestStatusResult>

  <status>

    <OperationCompleted>boolean</OperationCompleted>

    <OperationSuccessful>boolean</OperationSuccessful>

    <ErrorMessage>string</ErrorMessage>

  </status>

</TestStatusResponse>

</soap:Body>

</soap:Envelope>