0

I am new to soap and I am having the problems with it already! I am using soap4r gem.

gem 'soap4r', :git => 'git://github.com/felipec/soap4r.git'
require 'soap/wsdlDriver'
require 'soap/rpc/driver'
require 'soap/mapping/mapping.rb'

And I initialize the rpc driver as follows:

 def initialize
    @username = "username"
    @password = "password"
    endpoint = "https://someurl.php"
    namespace = "abc:somenamespace"
    @driver = SOAP::RPC::Driver.new(endpoint, namespace)
  end

When I visit the endpoint from the browser I am getting this error:

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultactor xsi:type="xsd:string"/>
<faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service
</faultstring>
<detail xsi:type="xsd:string"/>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Also, when I do this from irb:

client = SOAP::WSDLDriverFactory.new("endpoint?wsdl").create_rpc_driver

I am getting this error:

RuntimeError: part: return cannot be resolved
    from /home/sadiksha/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:144:in `rpcdefinedtype'
    from /home/sadiksha/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:56:in `collect_rpcparameter'
.
.
.

But when I do this:

client = SOAP::WSDLDriverFactory.new(endpoint).createDriver

and list methods by

client.methods(false)

and I have one method getName. When I try to access that method by client.getName({:username => "username", :password => "password") it gives me error saying

SOAP::FaultError: Username doesn't exist 
    from 

I am sorry for making it too long! I have been searching about it for a long time now. But was not able to find the specific answer. I hope someone will have answer to my question. I am thinking that it might be some authentication error.

Sadiksha Gautam
  • 5,032
  • 6
  • 40
  • 71

1 Answers1

0

Using the following can help you trouble shoot whats going on. It will dump the generated and received XML to console.

myWebServiceInstance.wiredump_dev = STDERR
Greg
  • 1,549
  • 1
  • 20
  • 34