Giter VIP home page Giter VIP logo

soap4r-spox's Introduction

soap4r-spox

This is a modified version of the soap4r library to work on Ruby versions >= 1.9. The official version can be found here.

Install

There is no rubygem for this library. Simply grab the latest version from the download page, unpack it and run:

ruby setup.rb all

That’s it.

There is still testing to be done. If you find any bugs, please let me know either by leaving a bug report, sending me a message to pull from your fixed fork, or drop me an email.

Thanks

A big thanks to everyone that has been helping squash 1.9 bugs in this library

Where to find me

soap4r-spox's People

Contributors

chrisroberts avatar mod-spox avatar simcha avatar swalterd avatar xaviershay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

soap4r-spox's Issues

compatibility with ruby 1.9

file soap4r-spox-1.6.0/lib/soap/mapping/mapping.rb needs some fixes:

obj.instance_variables inclusion is checked used strings. In ruby 1.9 Object#instance_variables returns an array of symbols so using Array#include? with a string parameter will always return false.

I propose to use the following fixes that will work in both ruby 1.9 and 1.8:

@line 256
ivars = obj.instance_variables.collect{|t| t.to_s}

@line 316
iv = obj.instance_variables.collect{|t| t.to_s}

wsdl file that worked fine with soap4r produces not working code with soap4r-spox

a wsdl file that works with soap4r produces not working server and client stubs with soap4r-spox.

wsdl file is:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.com/example/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="example" targetNamespace="http://www.example.com/example/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://www.example.com/example/">
      <xsd:element name="param" type="xsd:string">
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="request">
    <wsdl:part name="msg" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="response">
    <wsdl:part name="msg" type="xsd:string"/>
  </wsdl:message>
  <wsdl:portType name="port">
    <wsdl:operation name="op">
      <wsdl:input message="tns:request"/>
      <wsdl:output message="tns:response"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="bin" type="tns:port">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="op">
      <soap:operation soapAction="http://www.example.com/example/op"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="example">
    <wsdl:port binding="tns:bin" name="bin">
      <soap:address location="http://localhost:10080"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

how to reproduce:

  • install ruby 1.8.7 (ruby 1.9.3 produces the same result)
  • install rubygem
  • install gem soap4r-spox
  • generate client with:
wsdl2ruby.rb --wsdl case1.wsdl --type client --force
  • execute client with:
ruby -rubygems -e 'gem "soap4r-spox"' -e 'require "exampleClient"' 

result is:

C:/Ruby187/lib/ruby/gems/1.8/gems/soap4r-spox-1.6.0/lib/soap/element.rb:113:in `initialize': undefined method `name' for nil:NilClass (NoMethodError)
    from C:/Ruby187/lib/ruby/gems/1.8/gems/soap4r-spox-1.6.0/lib/soap/element.rb:112:in `each'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/soap4r-spox-1.6.0/lib/soap/element.rb:112:in `initialize'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/soap4r-spox-1.6.0/lib/soap/rpc/proxy.rb:126:in `new'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/soap4r-spox-1.6.0/lib/soap/rpc/proxy.rb:126:in `call'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/soap4r-spox-1.6.0/lib/soap/rpc/driver.rb:151:in `call'
    from (eval):6:in `op'
    from ./exampleClient.rb:20
    from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from -e:2

changing the wsdl and using element instead of type in messages definition

  <wsdl:message name="request">
    <wsdl:part name="msg" element="tns:param"/>
  </wsdl:message>
  <wsdl:message name="response">
    <wsdl:part name="msg" element="tns:param"/>
  </wsdl:message>

produces a client stub that works. the request sent is:

POST / HTTP/1.1
SOAPAction: "http://www.example.com/example/op"
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.6.1-SNAPSHOT (2.3.4.1, ruby 1.8.7 (2013-06-27))
Accept: */*
Date: Fri, 30 Aug 2013 09:04:36 GMT
Content-Length: 350
Host: localhost:10080

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Body>
    <n1:param xmlns:n1="http://www.example.com/example/"
        xsi:nil="true"></n1:param>
  </env:Body>
</env:Envelope>

using soap4r instead of soap4r-spox and the original wsdl produces a client that works. the request sent is:

POST / HTTP/1.1
SOAPAction: "http://www.example.com/example/op"
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.8 (2.3.4.1, ruby 1.8.7 (2013-06-27))
Accept: */*
Date: Fri, 30 Aug 2013 08:35:04 GMT
Content-Length: 289
Host: localhost:10080

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <msg xsi:nil="true"></msg>
  </env:Body>
</env:Envelope>

generated code is pratically the same with soap4r and soap4r-spox. in fact code generated with soap4r-spox works correctly using soap4r gem after a minor fix of

illegal inout definition for document style

in exampleDriver.rb line 12 ( it just needs string instead of symbol for :in and :out)

after the fix the request sent is:

POST / HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.example.com/example/op"
User-Agent: SOAP4R/1.5.8 (2.3.4.1, ruby 1.8.7 (2013-06-27))
Accept: */*
Date: Fri, 30 Aug 2013 09:17:32 GMT
Content-Length: 289
Host: localhost:10080

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <msg xsi:nil="true"></msg>
  </env:Body>
</env:Envelope>

no such file to load -- ftooles

If I try to install it, I just get:

sudo ./install.rb 
./install.rb:5:in `require': no such file to load -- ftools (LoadError  )
    from ./install.rb:5:in `<main>'

1.9 string compat updates for wsdl2ruby

Edits related to String.each => String.each_line in 1.9

driverCreator.rb, lines 36 and also 51 in dump:
@modulepath.each_line do |name|

clientSkeltonCreator.rb, line 36 in dump:
result << @modulepath.each_line.collect { |ele| "module #{ele}" }.join("; ")

clientSkeltonCreator.rb, line 45 in dump:
result << @modulepath.each_line.collect { |ele| "end" }.join("; ")

Can't access attributes of Mapping::Object

Hey!

Given the following Mapping::Object:

#<SOAP::Mapping::Object:0x5e19024
  {urn:ws.paymentech.net/PaymentechGateway}return=
    #<SOAP::Mapping::Object:0x5e18f5c {urn:ws.paymentech.net/PaymentechGateway}bin=\"XXXX\"
      {urn:ws.paymentech.net/PaymentechGateway}procStatus=\"0\">>

When trying to call "return" method on it I'm getting:

NoMethodError: undefined method `return' for SOAP::Mapping::Object:0x00000009229f08

Am I doing it wrong?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.