walkthrough for consuming web service from ruby?

R

rpardee

Hey All,

I've got a .net web service that I need to drive from ruby. I
*thought* I had it working, using the soap/wsdlDriver library, but it
looks like I was wrong. :-(

Is there a beginner-level HOWTO or other such hand-holdy document that
I could read to start getting my bearings w/this stuff? I've had bad
luck trying to find one on ruby-doc and google. The little bit in
pickaxe 2 is not working for me.

Thanks!

-Roy
 
N

NAKAMURA, Hiroshi

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

Hi,

I've got a .net web service that I need to drive from ruby. I
*thought* I had it working, using the soap/wsdlDriver library, but it
looks like I was wrong. :-(

Is there a beginner-level HOWTO or other such hand-holdy document that
I could read to start getting my bearings w/this stuff? I've had bad
luck trying to find one on ruby-doc and google. The little bit in
pickaxe 2 is not working for me.

Sorry for that. Soap4r distribution package at
http://dev.ctor.org/download/ contains bunch of examples and no document
by me. English is the most complex and headachy language for me. (Do
not ask me what languages I'm comparing with.)

Posting about "pickaxe 2 is not working" to soap4r ML (or here) may
solve the problem.

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

iD8DBQFDaZTYf6b33ts2dPkRAoYYAJkBBFbqyZtDEr+N/anXBQquRbnqJwCfThHm
XIwTqaUVXctRTvAPWR8xskM=
=7R9/
-----END PGP SIGNATURE-----
 
R

rpardee

Hee-hee--"I feel your pain" as they say.

Here's my script:

require "soap/wsdlDriver"
WSGUID = "39AC29C5-68BB-4678-BD6D-6486FA277544"
WSDL_URL =
"http://ctrhs-devnet/pardre1/MailException/ExceptionMailer.asmx?wsdl"

proxobj = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
proxobj.sendGeneralMessageRPC("(e-mail address removed)", "subject: sent from
script", "this was sent from a ruby script.", WSGUID)

Which, when submitted results in:

c:/ruby/lib/ruby/1.8/wsdl/operation.rb:67:in `outputparts': undefined
method `find_message' for nil:NilClass (NoMethodError)
from c:/ruby/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:72:in
`collect_documentparameter'
from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:132:in `create_param_def'
from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:101:in `add_operation'
from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:96:in `each'
from c:/ruby/lib/ruby/1.8/xsd/namedelements.rb:57:in `each'
from c:/ruby/lib/ruby/1.8/xsd/namedelements.rb:57:in `each'
from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:96:in `add_operation'
from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:40:in `create_rpc_driver'
from C:/Documents and Settings/pardre1/Desktop/DelMe.rb:5

Here is the WSDL (hopefully this will come through--I'm posting via
google groups)

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s1="http://microsoft.com/wsdl/types/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://tempuri.org/MailException/ExceptionMailer"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://tempuri.org/MailException/ExceptionMailer"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/MailException/ExceptionMailer">
<s:import namespace="http://microsoft.com/wsdl/types/" />
<s:element name="Send">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="User"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Machine"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="ExceptionString" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="recipient"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="AppName"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SendGeneralMessage">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="recipients"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="subject"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="body"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="key"
type="s1:guid" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified"
targetNamespace="http://microsoft.com/wsdl/types/">
<s:simpleType name="guid">
<s:restriction base="s:string">
<s:pattern
value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
/>
</s:restriction>
</s:simpleType>
</s:schema>
</wsdl:types>
<wsdl:message name="SendSoapIn">
<wsdl:part name="parameters" element="tns:Send" />
</wsdl:message>
<wsdl:message name="SendGeneralMessageSoapIn">
<wsdl:part name="parameters" element="tns:SendGeneralMessage" />
</wsdl:message>
<wsdl:message name="SendGeneralMessageRPCSoapIn">
<wsdl:part name="recipients" type="s:string" />
<wsdl:part name="subject" type="s:string" />
<wsdl:part name="body" type="s:string" />
<wsdl:part name="key" type="s:string" />
</wsdl:message>
<wsdl:message name="SendGeneralMessageRPCSoapOut" />
<wsdl:portType name="ExceptionMailerSoap">
<wsdl:eek:peration name="Send">
<wsdl:input message="tns:SendSoapIn" />
</wsdl:eek:peration>
<wsdl:eek:peration name="SendGeneralMessage">
<wsdl:input message="tns:SendGeneralMessageSoapIn" />
</wsdl:eek:peration>
<wsdl:eek:peration name="SendGeneralMessageRPC">
<wsdl:input message="tns:SendGeneralMessageRPCSoapIn" />
<wsdl:eek:utput message="tns:SendGeneralMessageRPCSoapOut" />
</wsdl:eek:peration>
</wsdl:portType>
<wsdl:binding name="ExceptionMailerSoap"
type="tns:ExceptionMailerSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:eek:peration name="Send">
<soap:eek:peration
soapAction="http://tempuri.org/MailException/ExceptionMailer/Send"
style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
</wsdl:eek:peration>
<wsdl:eek:peration name="SendGeneralMessage">
<soap:eek:peration
soapAction="http://tempuri.org/MailException/ExceptionMailer/SendGeneralMessage"
style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
</wsdl:eek:peration>
<wsdl:eek:peration name="SendGeneralMessageRPC">
<soap:eek:peration
soapAction="http://tempuri.org/MailException/ExceptionMailer/SendGeneralMessageRPC"
style="rpc" />
<wsdl:input>
<soap:body use="encoded"
namespace="http://tempuri.org/MailException/ExceptionMailer"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="encoded"
namespace="http://tempuri.org/MailException/ExceptionMailer"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>
<wsdl:service name="ExceptionMailer">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<wsdl:port name="ExceptionMailerSoap"
binding="tns:ExceptionMailerSoap">
<soap:address
location="http://ctrhs-devnet/pardre1/MailException/ExceptionMailer.asmx"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
 
N

NAKAMURA, Hiroshi

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

Hi,

Hee-hee--"I feel your pain" as they say.

Here's my script:

Thanks. Hmm. No operation definition in Send method... It should
intend to one-way operation.

Unfortunately current soap4r does not support one-way operation. Do you
know what HTTP response is expected for "Send" operation you are
calling? HTTP-200(OK) response with empty body? Or SOAP Envelope with
empty SOAPBody?

You seem to use ASP.NET at server side so I think you can browse sample
request wiredump and sample response wiredump by accessing
ExceptionMailer.asmx ...

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

iD8DBQFDazkTf6b33ts2dPkRAvBgAJ40fcxtsfjWDM9piL4i8Bdynr6f3QCfd+XW
ByEzh2WMIaZyjbEwrninVMQ=
=2sys
-----END PGP SIGNATURE-----
 
R

rpardee

Okay--I've resolved this by taking the one-way attributes off the 2
webmethods that had them. Looks like it's working fine now. Thanks
for the pointer!

Cheers,

-Roy
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top