Thursday October 11, 2007
TOTD #12: Invoking a Java EE 5 Web service endpoint from JRuby
A user asked how to invoke a Java EE 5 Web service from JRuby. This TOTD explains how a simple Metro Web service deployed on GlassFish V2 can be easily invoked from JRuby.
wsimport as shown
below:C:\workarea\samples\jruby\ws>\testbed\glassfish\final\glassfish\bin\wsimport.bat
-keep http://localhost:8080/WebApplication32/HelloService?wsdl
parsing WSDL...
generating code...
compiling code...C:\workarea\samples\jruby\ws>set CLASSPATH=.;\testbed\glassfish\final\glassfish\lib\webservices-rt.jar;\testbed\glassfish\final\glassfish\lib\endorsed\webservices-api.jar;C:\testbed\glassfish\final\gl
assfish\lib\activation.jarinclude Java
service = Java::server.HelloService.new();
port = service.getHelloPort();
result = port.sayHello("Duke");
java.lang.System.out.println(result);C:\workarea\samples\jruby\ws>\testbed\ruby\jruby-1.0.1\bin\jruby
simple.rb
Hello DukeThat's it! Read more about Tooling Options in Metro.
Using Java classes in JRuby explain the issues that you may encounter in invoking Java classes from JRuby.
Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.
Technorati: totd jruby jrubyonglassfish glassfish netbeans metro webservices ruby
Posted by Arun Gupta in webservices | Comments[0]
|
|
|
|
|
Today's Page Hits: 6786
Total # blog entries: 1002