I don’t know what is the first word about this post because I posted my last blog post long time ago 🙂

OpenNTF 2nd Contest, Lotusphere, My Company Project SIT and UAT … Now back to my website 🙂

My company project killed me … First XPages project in my company and I am so nervous 🙂

The main subject of this post,

I need to use web service from my XPages application. But I have some problems about that. Really I didn’t find any solution to invoke webservice from server side.
I tried to use Axis > Failed
Tried WebService Sample from Wiki -> Failed

So I invoked web service using dojo.xhrPost from client side, then passed values to server-side / scope var using Remove Service (RPC), then partial refreshes etc etc …

I don’t know what is the first word about this post because I posted my last blog post long time ago 🙂

OpenNTF 2nd Contest, Lotusphere, My Company Project SIT and UAT … Now back to my website 🙂

My company project killed me … First XPages project in my company and I am so nervous 🙂

The main subject of this post,

I need to use web service from my XPages application. But I have some problems about that. Really I didn’t find any solution to invoke webservice from server side.
I tried to use Axis > Failed
Tried WebService Sample from Wiki -> Failed

So I invoked web service using dojo.xhrPost from client side, then passed values to server-side / scope var using Remove Service (RPC), then partial refreshes etc etc …

I think (still not sure), I found a solution today but still have a problem. Little Security Problem 🙂
Maybe you have an idea about this problem. If you can write comment about that I will be appreciate. I attached my sample project in this post.

First of all;

Create Simple Web Service Provider in NSF :

Class WSTest

Public Function sayHello ( strName As String ) As String

sayHello = “Merhaba, ” + strName

End Function

End Class

Generate WSDL2Java Codes using Java SDK wsimport :

C:\>wsimport -d C:\Denemeler -keep http://ferhatdell.bestcoder.net/xpages/xws.nsf/WSTest?wsdl

Change package names from defaultNamespace to com.domino.xws :

Create Java class into XPages – WSEmployee :

Create XPages to invoke Web Service :

Open XPages from your browser anc click on Say Hello … Boom …

Domino will throw up these lines 🙂

03/08/2012 10:12:31 PM HTTP JVM: WSEmployee – currentDatabase :XPages Web Service
03/08/2012 10:12:31 PM HTTP JVM: WSEmployee – url :http://ferhatdell.bestcoder.net/uygulamalar/wscollection.nsf/WSTest?wsdl
03/08/2012 10:12:31 PM HTTP JVM: WSEmployee – service OK {urn:DefaultNamespace}WSTestService
03/08/2012 10:12:31 PM HTTP JVM: WSEmployee – port OK
03/08/2012 10:12:31 PM HTTP JVM: WSEmployee – Exception : class java.security.AccessControlException – Error Description : Access denied (java.lang.RuntimePermission setContextClassLoader)
03/08/2012 10:12:31 PM HTTP JVM: java.security.AccessControlException: Access denied (java.lang.RuntimePermission setContextClassLoader)
03/08/2012 10:12:31 PM HTTP JVM: at java.security.AccessController.checkPermission(AccessController.java:108)
03/08/2012 10:12:31 PM HTTP JVM: at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
03/08/2012 10:12:31 PM HTTP JVM: at java.lang.Thread.setContextClassLoader(Thread.java:753)
03/08/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:551)
03/08/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:543)
03/08/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:440)
03/08/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.client.Stub.process(Stub.java:223)
03/08/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:136)
03/08/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110)

What is that ? (class java.security.AccessControlException – Error Description : Access denied)

I googled it and found a file name with “java.policy”

…\IBM\Lotus\Domino\jvm\lib\security\java.policy

I opened it and added 3 lines …

grant {
       permission java.security.AllPermission;
};

Restart http task using “tell http q” and “load http”. Because we need to reload JVM.

Reload XPages

Click on Say Hello.

Look at the Domino Console …

Boom …

> tell http q
03/08/2012 10:49:57 PM Domino Off-Line Services HTTP extension unloaded.
03/08/2012 10:49:57 PM XSP Command Manager terminated
03/08/2012 10:49:58 PM HTTP Server: Shutdown

> load http
03/08/2012 10:50:40 PM HTTP Server: Using Web Configuration View
03/08/2012 10:50:44 PM JVM: Java Virtual Machine initialized.
03/08/2012 10:50:44 PM HTTP Server: Java Virtual Machine loaded
03/08/2012 10:50:44 PM HTTP Server: DSAPI Domino Off-Line Services HTTP extension Loaded successfully
03/08/2012 10:50:44 PM Servlet engine initialization was successful
03/08/2012 10:50:44 PM Could not load tr strings from resource module: nstrings_tr
03/08/2012 10:50:44 PM Could not load tr strings from resource module: nstrings
03/08/2012 10:50:44 PM Could not load tr strings from resource module: nhttprs_tr
03/08/2012 10:50:47 PM XSP Command Manager initialized
03/08/2012 10:50:48 PM HTTP Server: Started
03/08/2012 10:50:55 PM HTTP JVM: WSEmployee – url :http://ferhatdell.bestcoder.net/uygulamalar/wscollection.nsf/WSTest?wsdl
03/08/2012 10:50:56 PM HTTP JVM: WSEmployee – service OK {urn:DefaultNamespace}WSTestService
03/08/2012 10:50:56 PM HTTP JVM: WSEmployee – port OK
03/08/2012 10:50:56 PM HTTP JVM: Web Service Message:Merhaba, Ferhat Bulut

What does it mean ?

Which JAR file does not has permission to run on Domino ? Or What !

Still searching …

Download Sample NSF

11 Comments

  1. Hi!

    I remember having same kind of problems. My problem was that domino couldn’t handle web service calls from itself. Calling web services from another server worked fine.

    Reply

Cancel reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.