Web Service Consumer

I have created a web service consumer that consumes the “Quote” web service provided by Tim Tripcony in this post on his blog:http://www.timtripcony.com/blog.nsf/d6plinks/TTRY-7D9KNJ

I created a LotusScript agent to use the web service consumer. If I run the agent in the Notes client it works OK. If I run the agent from a web browser I get “Error loading USE or USELSX module: WebServiceConsumer”.

Can anyone shed any light on what I’m doing wrong?

The agent is:

Option Public

Option Declare

Use “WebServiceConsumer”

Sub Initialize()

Dim Quotes As New Quotes()

Dim Quote As Quote

Set Quote = Quotes.getRandomQuote()

Print Quote.Content & Chr(13) & "- " & Quote.Source

End Sub

And the web service consumer:

%INCLUDE “lsxsd.lss”

Class QUOTE As XSD_ANYTYPE

Public SOURCE As String

Public CONTENT As String



Sub NEW

End Sub

End Class

Class Quotes As PortTypeBase

Sub NEW

	Call Service.Initialize ("UrnDefaultNamespaceQuotesService", _

	"QuotesService.Domino", "http://www.timtripcony.com:80/services.nsf/quotes?OpenWebService", _

	"Quotes")

	

End Sub



Function GETRANDOMQUOTE() As QUOTE

	Set GETRANDOMQUOTE = Service.Invoke("GETRANDOMQUOTE")

End Function

End Class

Thanks for any help.

Subject: USE needs to match the library.

The line: use “WebServiceConsumer”

The “WebServiceConsumer” should be the name of your Web Service Consumer library. Maybe a typo?

Tested the script and it works fine. The only thing to note when running on the server is that the agent needs to be set to run on schedule NEVER and no documents processed.

Then you can call it like:

tell amgr run “database.nsf” ‘agentName’

Subject: Not a typo…

Hi Simon,

Thanks for your response.

It’s not a typo as the same agent works fine if I run it from the Actions menu in the Notes client. “WebServiceConsumer” is the name of my web service consumer!

Maybe something to do with my understanding of how they can be used.

I am testing the agent in a web browser simply using

http://server/dbname.nsf/agentname?OpenAgent

I changed the agent to run on schedule never, with a target of “None”. In this instance I get the error “Unknown trigger and search type; agent may be corrupt”.

If I set the agent trigger to “Agent list selection” and a target of “none” I get the previously mentioned error “Error loading USE or USELSX module: WebServiceConsumer”

Any other ideas?

Subject: Corruption?

If it is corruption try creating a new agent with the same code.

If you are running from a URL set the agent to run as a web agent.

Subject: Possibly…

Started from scratch and it’s now OK.

Thx for your assistance!

Subject: Try Recompile All LotusScript…see if you get an error during the recompile.

Sometimes a client doesn’t get an updated design that’s broken, and continues running the older, working code.

You can ensure the client has the latest design by…

  1. deleting the db icon.

  2. open the cache.ndk db, select all docs, and delete

  3. open the db again.

If your client still works then there might be something internal to LotusScript that’s going wrong.