0

I have created a java web service consumer in domino designer 8.5.3 that calls a WS operation with a string parameter and gets a string response.

Now i want to create an XPage with 1 edit box, 1 computed field and 1 button. On button click i want to run server side javascript that uses my WS consumer (gets input from box and shows response in computed field).

At first, is it possible to call WS via XPages? Is there any tested solution?

I ve tried :

  1. http://www-10.lotus.com/ldd/ddwiki.nsf/dx/reuse_web_services_xpage.htm i got:-> Cannot find class org.apache.commons.discovery.tools.DiscoverSingleton in NSF

  2. i copied java source of consumer into Java code folder. then i created my own class that does the call, and from SSJS i called my class' method. i got:-> lotus.domino.axis.ConfigurationException: No engine configuration file - aborting!

  3. http://openntf.org/XSnippets.nsf/snippet.xsp?id=call-webservice-from-java-ssjs-xpages i got:-> printed null output variable in console

P.S: i was able to call and get result using Java agent, i was also able to create a Notes form and populate a computed field using lotusscript consumer.

What i want now is: Use a java consumer from XPage to set field value from WS.

4

2 回答 2

2

Mike X,

unfortunately you can't use the generated Web service consumer directly in the XPage (classloader and Java path are different for Java agents and XPages - but you figured that already). You have 2 possibilities:

  • Call an agent from your XPage and hand over an in-Memory document to transfer the result
  • Rebuild your consumer as a Java class/bean using CXF (see this instructions

Calling an agent comes with a performance penalty at runtime to spin up the agent runtime. Let us know how it goes

于 2013-09-25T21:58:06.737 回答
1

Solution found!!!

(open package explorer view and applications view) 1: create a java consumer 2: create packages in code/java folder and name them as generated by the consumer 3: export or copy java files to code/Java folder (into the correct packages)

so far it doesnt work and u ll get an error of axis configuration but do the following to make it work:

4: go to package explorer, open the consumer(.javalib) compile it, while still open right-click it and open with system editor. A window will pop up containing some jar files. Open this one "webserviceresource.jar" with (i used winrar) 5: copy .wsdd file (or all of the files if u want...), paste them into code/java (no new packages new folders etc, just paste them)

6: in javascript editor use importPackage to import these java packages and then write your code

the ws client is now ready. You can use it with your xpage.

于 2013-09-26T07:49:16.637 回答