Calling SOAP based Web Services over SSL

Ok, here we go.

  1. I am trying to talk to a soap web service @ the url
    https://rsvcstage.e2ma.net/emmaTestCalls
  2. I can talk to the web service in plain ruby if I:
    2.1) disable site ruby (by renaming the site_ruby directory to
    something else)
    2.2) use the WDSLDriverFactory instead of an actionwebservice
    The working ruby code looks like this:

wsdl_url = "https://rsvcstage.e2ma.net/emmaTestCalls.wsdl"
soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
result = soap.sayHello
puts "The result from sayHello is:" + result
result = soap.testStringParam("Hello from darden")
puts "The result from testStringParam(string my_string) is:" + result

  1. The “equivalent” ruby code in rails fails. The ruby on rails code
    looks like:

def hello
soap_client =
SOAP::WSDLDriverFactory.new(“https://rsvcstage.e2ma.net/emmaTestCalls.wsdl”)
driver = soap_client.create_rpc_driver
driver.generate_explicit_type = true
@retVal = driver.sayHello()


the results for that code is:


Processing EmmaTestController#hello (for 127.0.0.1 at 2006-06-27
14:47:49) [GET]
Session ID: 613f45340158044b3c25a7eb029e0874
Parameters: {“action”=>“hello”, “controller”=>“emma_test”}
Error occurred in sayHello:uninitialized constant WSDLDriverFactory
Rendering emma_test/hello
Completed in 0.00010 (10000 reqs/sec) | Rendering: 0.00000 (0%) | 200 OK
[http://localhost/emma_test/hello]


which I was told was because the factory could not resolve the https.
As a test to ensure that i could write something that would talk soap I
created a call to google
that looked like this:


def googleSearch
soap_client =
SOAP::WSDLDriverFactory.new(“http://api.google.com/GoogleSearch.wsdl”)
driver = soap_client.create_rpc_driver
driver.generate_explicit_type = true
query=params[:query]
key = “this is the place for my key”
@retVal = driver.doGoogleSearch(key, query, 0, 10, false,"", false,
“”, “”, “”)
rescue Exception => exc
logger.error(“Error occurred in googleSearch:” + exc.message)
end


Ok, so I then tried to use actionwebservice’s driver_options to include
ssl options.
I also dloaded QuickCert to generate leys and loaded them into my public
directory of my web server. That code looked like this:


def hello
opts = {}
opts[‘protocol.http.ssl_config.verify_mode’] =
‘OpenSSL::SSL::VERIFY_PEER’
opts[‘protocol.http.ssl_config.client_cert’] =
‘public/healeyt/cert_healeyt.pem’
opts[‘protocol.http.ssl_config.client_key’] =
‘public/healeyt/healeyt_keypair.pem’
opts[‘protocol.http.ssl_config.ca_file’] = ‘public/CA’
soap_client = ActionWebService::Client::Soap.new(EmmaApi,
https://rsvcstage.e2ma.net/emmaTestCalls’, :driver_options =>
opts).create_rpc_driver
soap_client.generate_explicit_type = true
@retVal = soap_client.sayHello()
rescue Exception => exc
logger.error(“Error occurred in sayHello:” + exc.message)
end


And the result from that was SSL not supported.


Processing EmmaTestController#hello (for 127.0.0.1 at 2006-06-27
15:08:11) [GET]
Session ID: 613f45340158044b3c25a7eb029e0874
Parameters: {“action”=>“hello”, “controller”=>“emma_test”}
Error occurred in sayHello:SSL not supported
Rendering emma_test/hello
Completed in 0.01500 (66 reqs/sec) | Rendering: 0.00000 (0%) | 200 OK
[http://localhost/emma_test/hello]


So then I tried to make a secure webrick server based the code in this
email:
http://lists.rubyonrails.org/pipermail/rails/2006-January/012432.html
and put it in the commands directory with the other server.

I copied script/server script to script/secure and pointed it to the
secure_webrick script in the previous step.

That didn’t work.
After all this I am convinced of 2 things:

  1. that this is harder than it needs to be
  2. I am screwing up in so major way

and I am pleading for help.

Thanks in advance.
Tom

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs