0
votes

I need to use webservice client in xPages.

I found a simple ws to test, called CurrencyConverter. WSDL is here: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL

  1. First of all, I created a java classes using wsimport tool in JDK6.
  2. I made sure that my project uses Java 1.6
  3. Then I created a new java project in my Eclipse Juno and imported those files into src folder
  4. Then I created a simple class to test it:

CurrencyConvertor service = new CurrencyConvertor();

CurrencyConvertorSoap msg = service.getCurrencyConvertorSoap();

double rate = msg.conversionRate(Currency.USD, Currency.CZK);

System.out.println("USD to CZK rate = " + rate);

It worked perfectly.

Then I wanted to use the same approach in xPages.

  1. First of all, I created a new Domino Application
  2. Then I made sure that it uses Java 1.6
  3. Then in Package Explorer I created a new folder called src and added it to Build Path
  4. Then I imported those java files, made by wsimport tool into this folder
  5. Then I created a new class called TestBean and in it I created a new method getCurrency() with the same code as above
  6. Then I registered this TestBean in faces-config.xml as 'service' using a view scope
  7. Then I created a new xPage called home
  8. Then I put a new ComputedField into this xpage:

value="#{service.currency}"

And you know what? It doesn't work. It throws a WebServiceException with a message: class net.webservicex.ConversionRate do not have a property of the name {http://www.webserviceX.NET/}FromCurrency

So, am I doing anything wrong, or is it just typical IBM Notes/Domino issue?

EDIT: I created a typical project on Domino 9 server. Can someone check and try it, please? Maybe I'm just doing something wrong. Here is the test application.

2

2 Answers

2
votes

I suggest you try it without a managed bean first.

The Java version that your Eclipse uses probably differs from Domino java version. There might be a bug in Domino Java version (version has been updated in 9.0.1) or you may need different wsimport options (like -p) for that version.

Another approach which has worked for me is to use Apache CXF wsdl2java. I've used it starting from from Domino 8.5.3. I made a JAR from the generated code and called it from Java code in Code/Java-elements.

Here are some of my experiences about it.

2
votes

Version 9.0.1 has added the Apache Axis jars back into the class path so WS clients can be created with SSJS.

To do it via java you have to add the apache axis jars to the system/application class path and then call the code from the library.