Help with SOAP

Discussion in 'Ruby' started by Ben Myles, Jul 19, 2005.

  1. Ben Myles

    Ben Myles Guest

    Hi,

    I'm trying to write some code to connect to a SOAP webservice. I only
    need to call one method: SendMessage (see
    http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxreach.=
    asmx?op=3DSendMessage).

    I've been reading PickAxe but it's pretty thin on this stuff. I've got
    the outline of my code done, but am stuck on what arguments to send
    the method call.

    result =3D soap.SendMessage(...)

    I realise I need to send the arguments along, but how do I send
    complex datatypes (in the definition URL above you will see there are
    destinations containing recipients etc.). Also, do I need to specify
    every parameter or are some optional? Is it possible to query the web
    service for this information in Ruby?

    Any help would be *greatly* appreciated.

    Thanks in advance,
    Ben
    Ben Myles, Jul 19, 2005
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    Ben Myles wrote:
    > I'm trying to write some code to connect to a SOAP webservice. I only
    > need to call one method: SendMessage (see
    > http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxreach.asmx?op=SendMessage).
    >
    > I've been reading PickAxe but it's pretty thin on this stuff. I've got
    > the outline of my code done, but am stuck on what arguments to send
    > the method call.
    >
    > result = soap.SendMessage(...)
    >
    > I realise I need to send the arguments along, but how do I send
    > complex datatypes (in the definition URL above you will see there are
    > destinations containing recipients etc.). Also, do I need to specify
    > every parameter or are some optional? Is it possible to query the web
    > service for this information in Ruby?


    You should use WSDL file located at
    http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxreach.asmx?WSDL

    At first, generate class definition from the WSDL as follows.

    % wsdl2ruby.rb --wsdl
    'http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxreach.asmx?WSDL'
    - --type client --force
    I, [2005-07-20T14:40:25.503516 #32113] INFO -- app: Creating class
    definition.
    W, [2005-07-20T14:40:25.504452 #32113] WARN -- app: File 'default.rb'
    exists but overrides it.
    F, [2005-07-20T14:40:25.570157 #32113] FATAL -- app: Detected an
    exception. Stopping ... undefined method `name' for nil:NilClass
    (NoMethodError)

    Oops. I found the bug and fixed it at subversion repository. Please
    obtain the latest soap4r source from its subversion repository, or
    download the latest snapshot tarball from http://dev.ctor.org/download/

    With the latest soap4r source, wsdl2ruby.rb should run fine and the
    following script should work.

    #!/usr/bin/env ruby
    require 'defaultDriver.rb'
    obj = FaxProcessorSoap.new
    parameters = SendMessage.new(FaxMessage.new(...), 'NaHi', 'passwd')
    puts obj.sendMessage(parameters)

    class FaxMessage is very big. Good luck with you and soap4r...

    Regards,
    // NaHi
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (Cygwin)

    iD8DBQFC3inhf6b33ts2dPkRAjBPAJ0QBOTDFI/qUfKAawjFl4jP/lsL3ACgjoxH
    NaxqRhq2Dr5O95rnuOYUYm0=
    =UlxR
    -----END PGP SIGNATURE-----
    NAKAMURA, Hiroshi, Jul 20, 2005
    #2
    1. Advertising

  3. Ben Myles

    Ben Myles Guest

    Thanks so much! That's what I call community support - trying it out now :-=
    )

    Ben

    On 7/20/05, NAKAMURA, Hiroshi <> wrote:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >=20
    > Hi,
    >=20
    > Ben Myles wrote:
    > > I'm trying to write some code to connect to a SOAP webservice. I only
    > > need to call one method: SendMessage (see
    > > http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxre=

    ach.asmx?op=3DSendMessage).
    > >
    > > I've been reading PickAxe but it's pretty thin on this stuff. I've got
    > > the outline of my code done, but am stuck on what arguments to send
    > > the method call.
    > >
    > > result =3D soap.SendMessage(...)
    > >
    > > I realise I need to send the arguments along, but how do I send
    > > complex datatypes (in the definition URL above you will see there are
    > > destinations containing recipients etc.). Also, do I need to specify
    > > every parameter or are some optional? Is it possible to query the web
    > > service for this information in Ruby?

    >=20
    > You should use WSDL file located at
    > http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxreac=

    h.asmx?WSDL
    >=20
    > At first, generate class definition from the WSDL as follows.
    >=20
    > % wsdl2ruby.rb --wsdl
    > 'http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxrea=

    ch.asmx?WSDL'
    > - --type client --force
    > I, [2005-07-20T14:40:25.503516 #32113] INFO -- app: Creating class
    > definition.
    > W, [2005-07-20T14:40:25.504452 #32113] WARN -- app: File 'default.rb'
    > exists but overrides it.
    > F, [2005-07-20T14:40:25.570157 #32113] FATAL -- app: Detected an
    > exception. Stopping ... undefined method `name' for nil:NilClass
    > (NoMethodError)
    >=20
    > Oops. I found the bug and fixed it at subversion repository. Please
    > obtain the latest soap4r source from its subversion repository, or
    > download the latest snapshot tarball from http://dev.ctor.org/download/
    >=20
    > With the latest soap4r source, wsdl2ruby.rb should run fine and the
    > following script should work.
    >=20
    > #!/usr/bin/env ruby
    > require 'defaultDriver.rb'
    > obj =3D FaxProcessorSoap.new
    > parameters =3D SendMessage.new(FaxMessage.new(...), 'NaHi', 'passwd')
    > puts obj.sendMessage(parameters)
    >=20
    > class FaxMessage is very big. Good luck with you and soap4r...
    >=20
    > Regards,
    > // NaHi
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.1 (Cygwin)
    >=20
    > iD8DBQFC3inhf6b33ts2dPkRAjBPAJ0QBOTDFI/qUfKAawjFl4jP/lsL3ACgjoxH
    > NaxqRhq2Dr5O95rnuOYUYm0=3D
    > =3DUlxR
    > -----END PGP SIGNATURE-----
    >=20
    >
    Ben Myles, Jul 20, 2005
    #3
  4. Ben Myles

    Ben Myles Guest

    Failed schema validation (was Re: Help with SOAP)

    Hi,

    After following your instructions I managed to use wsdl2ruby to
    generate the files fine. However, when I try to interface with the web
    service, or even just run 'ruby FaxProcessorClient.rb' I get the
    following error:

    #<SOAP::Mapping::Object:0x102c0e0>: Failed schema validation (SOAP::FaultEr=
    ror)

    Any ideas why this might happen? I don't think it's Ruby specific -
    but if you could help at all by pointing me in the right direction I'd
    be very grateful.

    Regards,
    Ben Myles

    On 7/20/05, NAKAMURA, Hiroshi <> wrote:
    ...
    > At first, generate class definition from the WSDL as follows.
    >=20
    > % wsdl2ruby.rb --wsdl
    > 'http://webservices.xpedite.com.au/xpeditemessaging/faxreach/1-0-0/faxrea=

    ch.asmx?WSDL'
    > - --type client --force

    ...
    > With the latest soap4r source, wsdl2ruby.rb should run fine and the
    > following script should work.
    >=20
    > #!/usr/bin/env ruby
    > require 'defaultDriver.rb'
    > obj =3D FaxProcessorSoap.new
    > parameters =3D SendMessage.new(FaxMessage.new(...), 'NaHi', 'passwd')
    > puts obj.sendMessage(parameters)
    >=20
    > class FaxMessage is very big. Good luck with you and soap4r...
    Ben Myles, Jul 21, 2005
    #4
  5. Re: Failed schema validation (was Re: Help with SOAP)

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    Ben Myles wrote:
    > After following your instructions I managed to use wsdl2ruby to
    > generate the files fine. However, when I try to interface with the web
    > service, or even just run 'ruby FaxProcessorClient.rb' I get the
    > following error:
    >
    > #<SOAP::Mapping::Object:0x102c0e0>: Failed schema validation (SOAP::FaultError)


    Hmm. Some parameter could be wrongly encoded by soap4r. Can I see
    entire error message with the following script?

    obj = FaxProcessorSoap.new
    obj.wiredump_dev = STDOUT # add this line
    obj.sendMessage(...)

    Please send me the result directly if it contains internal information.

    Regards,
    // NaHi
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (Cygwin)

    iD8DBQFC36gnf6b33ts2dPkRArUYAJ9XCC8cRjmEtKn2qP+ViqMsO0iCuwCgjNbC
    qIm8yfft2NLtaZHQig3rxzU=
    =ZOHE
    -----END PGP SIGNATURE-----
    NAKAMURA, Hiroshi, Jul 21, 2005
    #5
    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. Sham Ramakrishnan
    Replies:
    2
    Views:
    8,324
    Sham Ramakrishnan
    Jul 1, 2003
  2. mooseshoes

    To SOAP or Not To SOAP?

    mooseshoes, Sep 4, 2003, in forum: XML
    Replies:
    3
    Views:
    381
    Heinz Häberle
    Sep 21, 2003
  3. Nagesh
    Replies:
    2
    Views:
    9,348
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Aug 12, 2006
  4. comp.text.xml
    Replies:
    0
    Views:
    495
    comp.text.xml
    Sep 20, 2006
  5. Amogh Hooshdar

    any library for SOAP 1.1 or SOAP 1.2?

    Amogh Hooshdar, Jan 25, 2008, in forum: Python
    Replies:
    1
    Views:
    373
    Paul Watson
    Mar 11, 2008
Loading...

Share This Page