Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: priscilla colleaux
RE: Ruby to Java [ reply ]  
2012-01-27 21:04
Thank you for your help, it's very effective :D

By: Amal Chaudhuri
RE: Ruby to Java [ reply ]  
2012-01-27 20:16
Also, this may be an easier SOAP library to use.
https://github.com/rubiii/savon

By: Amal Chaudhuri
RE: Ruby to Java [ reply ]  
2012-01-27 20:09
Rjb isn't required for the SOAP interface you're building. Because the call to the URI via the SOAP library is going to marshall the arguments in a wire format that is independent of the Ruby or Java implementation. Unfortunately, I'm not familiar with the SOAP library, typically use a REST API.

Have you looked at Ryan Heath's old post on this?

http://rpheath.com/posts/298-consuming-soap-services-in-ruby


By: priscilla colleaux
RE: Ruby to Java [ reply ]  
2012-01-27 17:54
Thank you for your answer !
But I think I might need more details, how do I import my service with Rjb::import?
Yes, I do use a uri to express my Service. Here is my code without using Rjb (that doesn't work like this neither), it would be more simple :

require 'soap/wsdlDriver'
require 'rjb'

Rjb::load('.')

wsdl_url = 'http://localhost:8080/SOAPWebServiceLabo3/SOAPWebService?wsdl'
service=SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver

service.wiredump_file_base='soapmsgs'

jour=gets.chomp
result=service.volsProgrammesAtDay(jour)
puts result.return.inspect.split("|")

By: Amal Chaudhuri
RE: Ruby to Java [ reply ]  
2012-01-27 17:06
Presumably the Java service is expressed as a uri? If so, you shouldn't need to use RJB.

In any case, we use native ruby strings to call Java with RJB and the conversion is handled with rjb quite cleanly.

e.g.

result = service.volsProgrammesAtDay('abcde')

You will also need to Rjb::import the service as well, which probably happening somewhere else in your code.

HTH.

By: priscilla colleaux
Ruby to Java [ reply ]  
2012-01-27 16:30
Hi,

First of all let me apologize about my English, I'm French...

I'm developing a Java web service and a Ruby client for my web service. From this Ruby client, I need to call one of my webservice's methods with a String parameter (java.lang.String), so I downloaded RJB and installed it. But unfortunately when I use it in my Ruby code, it doesn't work... my web service receives a null value.

Here is my code :

require 'rjb'
Rjb::load('.')
@jString = Rjb::import('java.lang.String')
str = @jString.new_with_sig('Ljava.lang.String;', "abcde")
result = service.volsProgrammesAtDay(str.toString)