Forum: Ruby on Rails Using Classes in Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Pradeep S. (Guest)
on 2006-05-01 23:20
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
Pradeep S. (Guest)
on 2006-05-01 23:41
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:
>
Paul B. (Guest)
on 2006-05-03 20:58
(Received via mailing list)
You don't need to pass "nil" to the ServiceSoap constructor, try just
ServiceSoap.new
This topic is locked and can not be replied to.