Using Classes in Rails

I am a beginner so please excuse me, if i am doing something totally
wrong.

I have created a class and here is what it looks like:

class ServiceSoap < ::soap::RPC::Driver
DefaultEndpointUrl =
http://balrog/services/SearchWorker/service.asmx
MappingRegistry = ::soap::Mapping::Registry.new


def initialize(endpoint_url = nil)
endpoint_url ||= DefaultEndpointUrl
super(endpoint_url, nil)
self.mapping_registry = MappingRegistry
init_methods
end


end

I put in in app/controllers folder as “defaultDriver.rb”

in another controller, I am doing

require ‘defaultDriver.rb’

class RmssearchController < ApplicationController
layout “standard-layout”

def view
  obj = ServiceSoap.new(nil)   # line 10
  response = ServiceSoap.helloWorld(nil)
  render :text => response
end

end

and I am getting “uninitialized constant ServiceSoap” error at line 10

Any help is appreciated. Thnaks in Advanve.

Pradeep

Btw, If I use irb in that directory, it works fine.

irb
irb(main):001:0> require ‘rmsdefaultDriver.rb’
=> true
irb(main):002:0> obj = ServiceSoap.new(nil)
=>
#<ServiceSoap:#<SOAP::RPC::Proxy:http://balrog/services/SearchWorker/service.
asmx>>
irb(main):004:0> p obj.helloWorld(nil)
#<HelloWorldResponse:0x2e40748 @helloWorldResult=“Hello World”>
=> nil

Pradeep S. wrote:

I am a beginner so please excuse me, if i am doing something totally
wrong.

I have created a class and here is what it looks like:

You don’t need to pass “nil” to the ServiceSoap constructor, try just
ServiceSoap.new