Consuming a SOAP Service in Ruby.

Discussion in 'Ruby' started by Saeed Bhuta, Jul 6, 2010.

  1. Saeed Bhuta

    Saeed Bhuta Guest

    Hi,

    I am trying to consume a SOAP service. I don't know a lot about this
    area but from what I have read, I have come up with the following code
    so far;

    require 'soap/wsdlDriver'

    wsdl="http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx"

    driverFactory = SOAP::WSDLDriverFactory.new(wsdl)

    p '>>>>>>>>here'
    service = driverFactory.create_rpc_driver

    board=service.GetDepartureBoard(4, 'ALN', '', '')

    However I am getting the following error;
    "ignored element: {http://www.w3.org/2001/XMLSchema}maxLength of
    WSDL::XMLSchema::SimpleRestriction
    ignored element: {http://www.w3.org/2001/XMLSchema}maxLength of
    WSDL::XMLSchema::SimpleRestriction
    ignored attr: {}default
    /usr/lib/ruby/1.8/wsdl/import.rb:44:in `parse_attr': undefined method
    `targetnamespace=' for #<WSDL::XMLSchema::Schema:0x..fdb72b8a6>
    (NoMethodError)"

    I'm assuming the error is related to the namespace?

    Would sincerely appreciate it if someone could point me in the right
    direction.

    Saeed
    --
    Posted via http://www.ruby-forum.com/.
    Saeed Bhuta, Jul 6, 2010
    #1
    1. Advertising

  2. Saeed Bhuta

    Tony Arcieri Guest

    [Note: parts of this message were removed to make it a legal post.]

    I've had lots and lots of problems with soap4r in the past and would most
    certainly not recommend it. Try Savon instead:

    http://github.com/rubiii/savon

    On Tue, Jul 6, 2010 at 5:39 AM, Saeed Bhuta <> wrote:

    > Hi,
    >
    > I am trying to consume a SOAP service. I don't know a lot about this
    > area but from what I have read, I have come up with the following code
    > so far;
    >
    > require 'soap/wsdlDriver'
    >
    > wsdl="http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx"
    >
    > driverFactory = SOAP::WSDLDriverFactory.new(wsdl)
    >
    > p '>>>>>>>>here'
    > service = driverFactory.create_rpc_driver
    >
    > board=service.GetDepartureBoard(4, 'ALN', '', '')
    >
    > However I am getting the following error;
    > "ignored element: {http://www.w3.org/2001/XMLSchema}maxLength of
    > WSDL::XMLSchema::SimpleRestriction
    > ignored element: {http://www.w3.org/2001/XMLSchema}maxLength of
    > WSDL::XMLSchema::SimpleRestriction
    > ignored attr: {}default
    > /usr/lib/ruby/1.8/wsdl/import.rb:44:in `parse_attr': undefined method
    > `targetnamespace=' for #<WSDL::XMLSchema::Schema:0x..fdb72b8a6>
    > (NoMethodError)"
    >
    > I'm assuming the error is related to the namespace?
    >
    > Would sincerely appreciate it if someone could point me in the right
    > direction.
    >
    > Saeed
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >



    --
    Tony Arcieri
    Medioh! A Kudelski Brand
    Tony Arcieri, Jul 6, 2010
    #2
    1. Advertising

  3. Saeed Bhuta

    Tim Becker Guest

    The wsdl you presented is fairly short, I've found the easiest way to
    implement small SOAP enpoints in ruby is to do this:

    * Use Java or .NET Tools to create bindings out of the WSDL
    * Make one or two sample calls.
    * sniff the xml generated by those calls and use it to create
    templates for ruby.

    Unfortunately, SOAP is one of the most convoluted protocols the earth
    has ever seen. The above may sound a bit TOO pragmatic, but you'll
    save yourself a world of hurt.

    -tim




    On Tue, Jul 6, 2010 at 1:39 PM, Saeed Bhuta <> wrote:
    > Hi,
    >
    > I am trying to consume a SOAP service. I don't know a lot about this
    > area but from what I have read, I have come up with the following code
    > so far;
    >
    > require 'soap/wsdlDriver'
    >
    > wsdl="http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx"
    >
    > driverFactory = SOAP::WSDLDriverFactory.new(wsdl)
    >
    > p '>>>>>>>>here'
    > service = driverFactory.create_rpc_driver
    >
    > board=service.GetDepartureBoard(4, 'ALN', '', '')
    >
    > However I am getting the following error;
    > "ignored element: {http://www.w3.org/2001/XMLSchema}maxLength of
    > WSDL::XMLSchema::SimpleRestriction
    > ignored element: {http://www.w3.org/2001/XMLSchema}maxLength of
    > WSDL::XMLSchema::SimpleRestriction
    > ignored attr: {}default
    > /usr/lib/ruby/1.8/wsdl/import.rb:44:in `parse_attr': undefined method
    > `targetnamespace=' for #<WSDL::XMLSchema::Schema:0x..fdb72b8a6>
    > (NoMethodError)"
    >
    > I'm assuming the error is related to the namespace?
    >
    > Would sincerely appreciate it if someone could point me in the right
    > direction.
    >
    > Saeed
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
    Tim Becker, Jul 7, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick Chan
    Replies:
    0
    Views:
    493
    Nick Chan
    Sep 13, 2007
  2. Tony C
    Replies:
    2
    Views:
    337
    Xiangyang Liu
    Jul 20, 2003
  3. Curt K
    Replies:
    3
    Views:
    440
    John Saunders [MVP]
    Jun 15, 2007
  4. Tim Perrett

    Solution consuming .NET SOAP service

    Tim Perrett, Mar 4, 2007, in forum: Ruby
    Replies:
    2
    Views:
    156
    Tim Perrett
    Mar 4, 2007
  5. Saeed Bhuta
    Replies:
    4
    Views:
    257
    Saeed Bhuta
    Jul 13, 2010
Loading...

Share This Page