Using SOAP and other standard libraries in Ruby 1.9.2

So, I recently upgraded to 1.9.2 Ruby, used 1.8.7 forever (I wanted to try Rails 3).

The BIGGEST problem I am facing is that none of my SOAP requests work ... I have things like:

require 'soap/rpc/driver' require 'xsd/qname' require 'soap/wsdlDriver' require 'ftools' 

Even ftools doesn’t work, but I THINK (looking at the Ruby source) that it became "fileutils"? But I don’t see anything like SOAP ..... is it just deleted?

If so ... what should I do? Are there plugins that do pretty much the same thing?

My code is similar:

  require 'soap/wsdlDriver' def send_package adi_url = "ftp://anonymous: ads123@ #{APP_CONFIG['pcms_ip']}/#{self.id}/original/ADI.XML" cl0 = SOAP::WSDLDriverFactory.new(APP_CONFIG['corba_bridge']) driver = cl0.create_rpc_driver driver.streamhandler.client.receive_timeout = 10 x = driver.exportPackage2(self.name+self.id.to_s, adi_url, "NS2.PackageFactory") log x if x.to_s =~ /ERROR/ raise x.to_s end end 

and

  require 'soap/rpc/driver' require 'xsd/qname' def get_self_offering_ids(wsdl, namespace) ret = [] input = {"#{namespace}:includeAssetMetadata" => 'true'} begin driver = SOAP::RPC::Driver.new(wsdl, namespace) driver.add_document_method('GetAllOfferingsRequest', "OpenStreamVOD#getAllOfferings", XSD::QName.new(namespace, "GetAllOfferingsRequest"), XSD::QName.new(namespace, "GetAllOfferingsResponse")) result = driver.GetAllOfferingsRequest(input) rescue => err log err end if result result.offering.each do |o| if offeringIsSelf?(o) ret << o.xmlattr_offeringId end end end return ret end 

I don't have much soap experience ... and I'm not even sure how wsdlDriver and rpc / driver differ from each other ... I just probably had a good reason to use two separate libraries at the time

+4
source share
3 answers

If you want to use the standard Ruby 1.8 soap library (aka soap4r), you can try https://github.com/spox/soap4r-spox ...

 wget --no-check-certificate https://github.com/spox/soap4r-spox/tarball/1.5.8.4 tar -xzf spox-soap4r-spox-1.5.8.4-0-g345a6cb.tar.gz cd spox-soap4r-spox-345a6cb/ ruby setup.rb all 

If you use rvm, do not sudo the last command ... instead of su in root and rvm in ruby ​​1.9, so setup.rb puts the files in the right place.

 $ irb ruby-1.9.2-p0 > require 'soap/rpc/driver' => true ruby-1.9.2-p0 > require 'xsd/qname' => false ruby-1.9.2-p0 > require 'soap/wsdlDriver' => true ruby-1.9.2-p0 > require 'fileutils' => true 

As suggested by other fooobar.com/questions/1300246 / ... , you can switch to a gem like Savona.

+5
source

https://rubygems.org/gems/soap4r-ruby1.9

gem install soap4r-ruby1.9

This stone solved most of my soap problems with ruby ​​1.9

+8
source

if you are trying to use rails 3, update your gem file with

gem 'soap4r',: git => 'git: //github.com/felipec/soap4r.git'

This is a hotfix update.

+1
source

Source: https://habr.com/ru/post/1338139/


All Articles