Question

I created a Web Service Consumer. I want to call a method that is named setCredentials so I can pass my authentication information to the service.

I have two entities that import the web service consumer, an agent and a java library, meant to be called from LotusScript.

The strange thing is that on my agent everything works fine. Library compiles OK, but when it is executed from LotusScript and reaches that line stub.setCredentials("xxxx","ttttt"); Java throws a java.lang.nosuchmethod error. What can I be doing wrong?

Thank you so much in advance for your help.

Update:

Maybe I didn't explain fully. The action occurs fully inside java. This is sort of a test. On LotusScript I am just calling the constructor with the sequence GetClass/CreateObject. The code is inside the constructor (For test sake). And it looks precisely the same, both on my test agent and on java library. Answering your question, Jason, no , setCredentials is part of a certain lotus.domino.types.PortTypeBase Interface. When I consume the .wsdl to create a web service consumer, I can see from the generated .java files that my interface extends portTypeBase and Remote

Was it helpful?

Solution

It is not possible to call a Java Web Service consumer from LotusScript (LS2J). This is detailed in SPR SODY7UDKE8 / APAR LO42772. This also applies to calling a Java agent which in turn calls a Java consumer.

You will need to create a LotusScript consumer to access the web service in LotusScript. However there are known limitations in LotusScript which can prevent some web services from being consumed.

  • 40 character variable/method limit
  • Extremely large SOAP messages can cause performance/crash issues.
  • Reserved keywords mismatch in LS/WSDL/SOAP.

That said I created the following sample Provider.

Class wsClass 
    Function hello ( helloText As String) As String
        hello = "Hello " + helloText
    End Function
End Class

In the NSF it was stored I set it to only allow authenticated users.

I then created a LS consumer and Java Consumer libraries from the generated WSDL.

After that I created the following sample code.

LotusScript

Use "LsWebServiceConsumer"

Sub Initialize
    Dim stub As New Wsclass
    Dim answer As String

    Call stub.Setcredentials("testuser", "password")

    answer = stub.Hello("world")

    MsgBox answer   

End Sub

JAVA (added consumer library to agent)

import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {
      try {

          WsClass stub = new WsClassServiceLocator().getDomino();
          stub.setCredentials("testuser", "password");
          System.out.println(stub.HELLO("world"));

      } catch(Exception e) {
          e.printStackTrace();
       }
   }
}

Both of these worked as expected with their own respective consumer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top