This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Nov 7, 2012, 4:08 AM
9 Posts

external web service calls from xpages using Rest services

  • Category: Extension Library
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: web services rest
  • Replies: 8
Have been looking at the Rest services in extension lib and don't see a way to make calls to a external Rest web service.  It seems the controls provided are only capable of access Notes databases/documents etc and relational databases.  Is it possible to make these calls via Rest or is SOAP/WSDL using the Web Service consumer still the only option? 
 
thanks 
Nov 7, 2012, 4:50 AM
366 Posts
Re: external web service calls from xpages using Rest services
IBM Broke the the ability to instantiate a native web service client in version 8.5.2.  It's been PMR's but they are not going to fix it.
 
The work around is to import the Apache web service client jars to an agent and write a java agent to consume the web service and call the agent from the XPage via AJAX.
 
 
Nov 7, 2012, 2:14 PM
9 Posts
Re: external web service calls from xpages using Rest services
Wow that sounds easy.    Can you point me to any examples of this?  
 
Thanks for your reply.   I have been researching this for 2 days now and it didn't seem like it was going to be easy. 
Nov 8, 2012, 8:49 PM
366 Posts
Re: external web service calls from xpages using Rest services
On my website at http://www.nnsu.com if you go to the downloads link and then click on Lotusphere  2007 (yes I know this seems old, but it's the most maintainable way)
 
BP201 slides and sample database will walk you through it.
 
I know it says it's for version 6 and 7 but the all of the fundamental steps still work.
Nov 9, 2012, 5:14 PM
135 Posts
Re: external web service calls from xpages using Rest services
"IBM Broke the the ability to instantiate a native web service client in version 8.5.2. It's been PMR's but they are not going to fix it."
 
That's very interesting! One more (maybe a bit easier) option is to use "Web Service Consumer" design element and call that from the agent.
 
Also why can't you add the Axis JARs to WEB-INF folder and use them from XPages?
 
EDIT: According to this you can: 
 
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/reuse_web_services_xpage.htm 
Nov 9, 2012, 7:14 PM
366 Posts
Re: external web service calls from xpages using Rest services
You can't add the AXIS jars to the web-inf because it throws a java security error and continues to have classpath issues that conflict with the implemented client web service code.
 
As for the URL you provided that is the exact code that IBM broke in 8.5.2 forward.
 
 
Nov 10, 2012, 8:05 AM
135 Posts
Re: external web service calls from xpages using Rest services
If you read the end of the article behind the URL it says:
 
"Unfortunately, the above described code will not work in Domino 8.5.2 (and probably above), " 
 
Then it goes on to explain the workaround: import Axis JAR files to NSF and use them from XPages. Java.policy file needs to be updated if this is the first time JAR files are used in NSF.
 
Maybe they haven't really tried it. It would be interesting to hear if anyone has gotten this to work.
Nov 16, 2012, 5:29 PM
135 Posts
Re: external web service calls from xpages using Rest services
OK, I got an opportunity to try this out. I need to call a web service that I've developed earlier using the Web Service Provider design element. 
 
First I looked at Axis and noticed that the last release is from 2006.
 
Then I downloaded Axis2 which is the successor of Axis. I also installed Ant which should generate the Java stubs for me with command "ant generate.client". I tried all "Programmin models" that  Web Service Provider supports but always got errors complaining about the WSDL and nothing was generated. I didn't try Axis2 wsdl2java which might have done it.
 
Next I found this article by Stephan Wissel. The generation of Java source with wsdl2java worked fine after adding -autoNameResolution parameter to command line. I exported the Java classes to a jar file because they are not going to change often. But when I tried to call the web service I got error about "child element, which is NOT expected". The "Programming model" in my provider was RPC/Doc/literal. I changed that to RPC/Wrapped and after that everything seems to work! I'm not really using the Web Service yet but I'm able to call it and return a value.
 
You need Apache CXF only to generate the Java code based on WSDL (using wsdl2java.bat) because all the Web Service stuff now comes with Java 1.6:
 
http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/ 
 
There are other tools also for generating the Java but CXF at least is able to generate code that uses these new javax.jws.* classes. Maybe Eclipse would do it even easier (not Designer Eclipse which does not seem to include web service stuff).
 
I recommend using -p parameter in wsdl2java command line to specify a package for the generated classes. Also note that you need to run Windows command prompt as administrator when running wsdl2java. Otherwise you'll get something like java.io.FileNotFoundException: .\com\microsoft\schemas\_2003\_10\serialization\ObjectFactory.java.

 

If you get JAXBElement types in parameters, you can use a binding file to get rid of them. But this can cause the data posted to be empty and if so you will need to use JAXBElement types.

 

And to answer the original question: I don't think you can call a Web Service from the ext-lib REST control.
Nov 19, 2012, 1:19 PM
9 Posts
Re: external web service calls from xpages using Rest services
Thanks Paul that was helpful.   I have been researching what you had said.   One thing that isn't clear to me is how are you making the call?   Are you using an xagent?
 
Thanks again. 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal