{"id":421,"date":"2012-03-08T23:16:46","date_gmt":"2012-03-08T21:16:46","guid":{"rendered":"http:\/\/www.bestcoder.net\/?p=421"},"modified":"2012-10-14T13:30:12","modified_gmt":"2012-10-14T13:30:12","slug":"xpages-server-side-invoke-web-services-jax-ws","status":"publish","type":"post","link":"http:\/\/www.bestcoder.net\/?p=421","title":{"rendered":"XPages &#8211; Server Side &#8211; Invoke Web Services (JAX-WS)"},"content":{"rendered":"<p><!--:en-->I don&#8217;t know what is the first word about this post because I posted my last blog post long time ago \ud83d\ude42<\/p>\n<p>OpenNTF 2nd Contest, Lotusphere, My Company Project SIT and UAT &#8230; Now back to my website \ud83d\ude42<\/p>\n<p>My company project killed me &#8230; First XPages project in my company and I am so nervous \ud83d\ude42<\/p>\n<p>The main subject of this post,<\/p>\n<p>I need to use web service from my XPages application. But I have some problems about that.\u00a0Really I didn&#8217;t find any solution to invoke webservice from server side.<br \/>\n<span style=\"color: #800000;\">I tried to use Axis &gt; <strong>Failed<\/strong><\/span><br \/>\n<span style=\"color: #800000;\">Tried <a href=\"http:\/\/www-10.lotus.com\/ldd\/ddwiki.nsf\/dx\/reuse_web_services_xpage.htm\" target=\"_blank\"><span style=\"color: #800000;\">WebService Sample from Wiki<\/span><\/a> -&gt; <strong>Failed<\/strong><\/span><\/p>\n<p>So I invoked web service using <strong>dojo.xhrPost<\/strong> from client side, then passed values to server-side \/ scope var using Remove Service (RPC), then partial refreshes etc etc &#8230;<\/p>\n<p><!--:--><!--:tr-->I don&#8217;t know what is the first word about this post because I posted my last blog post long time ago \ud83d\ude42<\/p>\n<p>OpenNTF 2nd Contest, Lotusphere, My Company Project SIT and UAT &#8230; Now back to my website \ud83d\ude42<\/p>\n<p>My company project killed me &#8230; First XPages project in my company and I am so nervous \ud83d\ude42<\/p>\n<p>The main subject of this post,<\/p>\n<p>I need to use web service from my XPages application. But I have some problems about that.\u00a0Really I didn&#8217;t find any solution to invoke webservice from server side.<br \/>\n<span style=\"color: #800000;\">I tried to use Axis &gt; <strong>Failed<\/strong><\/span><br \/>\n<span style=\"color: #800000;\">Tried <a href=\"http:\/\/www-10.lotus.com\/ldd\/ddwiki.nsf\/dx\/reuse_web_services_xpage.htm\" target=\"_blank\"><span style=\"color: #800000;\">WebService Sample from Wiki<\/span><\/a> -&gt; <strong>Failed<\/strong><\/span><\/p>\n<p>So I invoked web service using <strong>dojo.xhrPost<\/strong> from client side, then passed values to server-side \/ scope var using Remove Service (RPC), then partial refreshes etc etc &#8230;<\/p>\n<p><!--:--><!--more--><!--:en--><\/p>\n<p>I think (still not sure), I found a solution today but still have a problem. Little Security Problem \ud83d\ude42<br \/>\nMaybe 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.<\/p>\n<p>First of all;<\/p>\n<p><strong>Create Simple Web Service Provider in NSF :<\/strong><\/p>\n<p><a href=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSTest.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-426 alignnone\" title=\"WSTest\" src=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSTest-300x96.png\" alt=\"\" width=\"300\" height=\"96\" srcset=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSTest-300x96.png 300w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSTest-1024x327.png 1024w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSTest.png 1190w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Class WSTest<\/p>\n<p>Public Function sayHello ( strName As String ) As String<\/p>\n<p>sayHello = &#8220;Merhaba, &#8221; + strName<\/p>\n<p>End Function<\/p>\n<p>End Class<\/p>\n<p><strong>Generate WSDL2Java Codes using Java SDK wsimport :<\/strong><\/p>\n<p><strong>C:\\&gt;wsimport -d C:\\Denemeler -keep http:\/\/ferhatdell.bestcoder.net\/xpages\/xws.nsf\/WSTest?wsdl<\/strong><\/p>\n<p><a href=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-428\" title=\"wsimport\" src=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport-300x88.png\" alt=\"\" width=\"300\" height=\"88\" srcset=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport-300x88.png 300w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport.png 680w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-423\" title=\"wsimport_codes_1\" src=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_1-300x139.png\" alt=\"\" width=\"300\" height=\"139\" srcset=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_1-300x139.png 300w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_1.png 459w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-424\" title=\"wsimport_codes_2\" src=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_2-300x93.png\" alt=\"\" width=\"300\" height=\"93\" srcset=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_2-300x93.png 300w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_2.png 948w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Change package names from defaultNamespace to com.domino.xws :<\/strong><\/p>\n<p><a href=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-425\" title=\"wsimport_codes_3\" src=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_3-300x214.png\" alt=\"\" width=\"300\" height=\"214\" srcset=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_3-300x214.png 300w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/wsimport_codes_3.png 835w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Create Java class into XPages &#8211; WSEmployee :<\/strong><\/p>\n<p><a href=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSEmployee.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-427\" title=\"WSEmployee\" src=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSEmployee-300x206.png\" alt=\"\" width=\"300\" height=\"206\" srcset=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSEmployee-300x206.png 300w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSEmployee-1024x706.png 1024w, http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/WSEmployee.png 1373w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Create XPages to invoke Web Service :<\/strong><\/p>\n<p>Open XPages from your browser anc click on Say Hello &#8230; Boom &#8230;<\/p>\n<p>Domino will throw up these lines \ud83d\ude42<\/p>\n<p>03\/08\/2012 10:12:31 PM HTTP JVM: WSEmployee &#8211; currentDatabase :XPages Web Service<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: WSEmployee &#8211; url :http:\/\/ferhatdell.bestcoder.net\/uygulamalar\/wscollection.nsf\/WSTest?wsdl<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: WSEmployee &#8211; service OK {urn:DefaultNamespace}WSTestService<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: WSEmployee &#8211; port OK<br \/>\n<span style=\"color: #ff0000;\">03\/08\/2012 10:12:31 PM HTTP JVM: WSEmployee &#8211; Exception : class java.security.AccessControlException &#8211; Error Description : Access denied (java.lang.RuntimePermission setContextClassLoader)<\/span><br \/>\n<span style=\"color: #ff0000;\">03\/08\/2012 10:12:31 PM HTTP JVM: java.security.AccessControlException: Access denied (java.lang.RuntimePermission setContextClassLoader)<\/span><br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at java.security.AccessController.checkPermission(AccessController.java:108)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at java.lang.Thread.setContextClassLoader(Thread.java:753)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:551)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:543)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:440)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.client.Stub.process(Stub.java:223)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:136)<br \/>\n03\/08\/2012 10:12:31 PM HTTP JVM: at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110)<\/p>\n<p>What is that ? (<strong>class java.security.AccessControlException &#8211; Error Description : Access denied<\/strong>)<\/p>\n<p>I googled it and found a file name with <span style=\"color: #ff0000;\"><strong>&#8220;java.policy&#8221;<\/strong><\/span><\/p>\n<p>&#8230;\\IBM\\Lotus\\Domino\\jvm\\lib\\security\\<strong>java.policy<\/strong><\/p>\n<p>I opened it and added 3 lines &#8230;<\/p>\n<p><span style=\"color: #0000ff;\">grant {<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0 \u00a0 \u00a0 \u00a0permission java.security.AllPermission;<\/span><br \/>\n<span style=\"color: #0000ff;\">};<\/span><\/p>\n<p>Restart http task using &#8220;tell http q&#8221; and &#8220;load http&#8221;. Because we need to reload JVM.<\/p>\n<p>Reload XPages<\/p>\n<p>Click on <strong>Say Hello.<\/strong><\/p>\n<p>Look at the Domino Console &#8230;<\/p>\n<p>Boom &#8230;<\/p>\n<p>&gt; tell http q<br \/>\n03\/08\/2012 10:49:57 PM Domino Off-Line Services HTTP extension unloaded.<br \/>\n03\/08\/2012 10:49:57 PM XSP Command Manager terminated<br \/>\n03\/08\/2012 10:49:58 PM HTTP Server: Shutdown<\/p>\n<p>&gt; load http<br \/>\n03\/08\/2012 10:50:40 PM HTTP Server: Using Web Configuration View<br \/>\n03\/08\/2012 10:50:44 PM JVM: Java Virtual Machine initialized.<br \/>\n03\/08\/2012 10:50:44 PM HTTP Server: Java Virtual Machine loaded<br \/>\n03\/08\/2012 10:50:44 PM HTTP Server: DSAPI Domino Off-Line Services HTTP extension Loaded successfully<br \/>\n03\/08\/2012 10:50:44 PM Servlet engine initialization was successful<br \/>\n03\/08\/2012 10:50:44 PM Could not load tr strings from resource module: nstrings_tr<br \/>\n03\/08\/2012 10:50:44 PM Could not load tr strings from resource module: nstrings<br \/>\n03\/08\/2012 10:50:44 PM Could not load tr strings from resource module: nhttprs_tr<br \/>\n03\/08\/2012 10:50:47 PM XSP Command Manager initialized<br \/>\n03\/08\/2012 10:50:48 PM HTTP Server: Started<br \/>\n<span style=\"color: #339966;\"><strong>03\/08\/2012 10:50:55 PM HTTP JVM: WSEmployee &#8211; url :http:\/\/ferhatdell.bestcoder.net\/uygulamalar\/wscollection.nsf\/WSTest?wsdl<\/strong><\/span><br \/>\n<span style=\"color: #339966;\"><strong>03\/08\/2012 10:50:56 PM HTTP JVM: WSEmployee &#8211; service OK {urn:DefaultNamespace}WSTestService<\/strong><\/span><br \/>\n<span style=\"color: #339966;\"><strong>03\/08\/2012 10:50:56 PM HTTP JVM: WSEmployee &#8211; port OK<\/strong><\/span><br \/>\n<span style=\"color: #339966;\"><strong>03\/08\/2012 10:50:56 PM HTTP JVM: Web Service Message:Merhaba, Ferhat Bulut<\/strong><\/span><\/p>\n<p><strong>What does it mean ?<\/strong><\/p>\n<p><span style=\"color: #800000;\"><strong>Which JAR file does not has permission to run on Domino ? Or What !<\/strong><\/span><\/p>\n<p><strong>Still searching &#8230;<\/strong><\/p>\n<h2><a title=\"Download Sample NSF\" href=\"http:\/\/www.bestcoder.net\/wp-content\/uploads\/2012\/03\/xws.zip\" target=\"_blank\">Download Sample NSF<\/a><\/h2>\n<p><!--:--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t know what is the first word about this post because I posted my last blog post long time ago \ud83d\ude42 OpenNTF 2nd Contest, Lotusphere, My Company Project SIT and UAT &#8230; Now back to my website \ud83d\ude42 My company project killed me &#8230; First XPages project in my company and I am so &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,21,3,28],"tags":[45,44,30],"class_list":["post-421","post","type-post","status-publish","format-standard","hentry","category-development","category-lotus-domino","category-lotusnotesdevelopment","category-xpages","tag-jax-ws","tag-webservices","tag-xpages-2","entry","has-more-link"],"_links":{"self":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts\/421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=421"}],"version-history":[{"count":11,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts\/421\/revisions"}],"predecessor-version":[{"id":436,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=\/wp\/v2\/posts\/421\/revisions\/436"}],"wp:attachment":[{"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=421"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.bestcoder.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}