Help with SOAP

B

Ben Myles

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
 
N

NAKAMURA, Hiroshi

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

Hi,

Ben said:
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-----
 
B

Ben Myles

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

Ben

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
=20
Hi,
=20
Ben said:
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
 
B

Ben Myles

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
 
N

NAKAMURA, Hiroshi

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

Hi,

Ben said:
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-----
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top