users@glassfish.java.net

Calling a Web Service From a JRuby on Rails - Application

From: <glassfish_at_javadesktop.org>
Date: Wed, 06 Jan 2010 01:55:14 PST

Hi,

I want call a web service and display / process the results in a rails application. I created a jar-File that contains a Web Service Client that was generated in Netbeans with JAX-WS-Style. When I put that jar-File into the domains/domain1/lib - Folder and try to include the class to my ruby app via

include_class 'test.TestClient'

I get the error message 'cannot load Java class test.TestClient.

When I put the same jar-File to the domains/domain1/lib/ext - Folder, I can include the class to my ruby app, but I cannot call the Web Service:

INFO: NativeException (java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider com.sun.xml.ws.spi.ProviderImpl could not be instantiated: java.lang.ClassCastException):
  java/util/ServiceLoader.java:207:in `fail'
  java/util/ServiceLoader.java:164:in `access$100'
  java/util/ServiceLoader.java:353:in `next'
  java/util/ServiceLoader.java:421:in `next'
  javax/xml/ws/spi/Provider.java:146:in `getProviderUsingServiceLoader'
  javax/xml/ws/spi/Provider.java:106:in `provider'
  javax/xml/ws/Service.java:57:in `<init>'
  com/west_wind/foxcentral/FoxCentral.java:44:in `<init>'
  test/TestClient.java:21:in `getArticles'
  app/controllers/rule_sets_controller.rb:13:in `index'
  haml (2.2.16) lib/sass/plugin/rails.rb:19:in `process'
  file:/C:/Programme/sges-v3/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:133:in `call'
  file:/C:/Programme/sges-v3/glassfish/modules/grizzly-jruby.jar!/rack/handler/grizzly.rb:55:in `call'

I tried both methods from a Java Web Application, too. Method 1 works (in lib-Folder); Method 2 produces the same error as the jruby-app.

Am I putting the jar-File to the wrong directory? Or do I have to include other libs, too?

Thanks,
Heiko
[Message sent by forum member 'hzeus' (hzeus_at_gmx.de)]

http://forums.java.net/jive/thread.jspa?messageID=378987