Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
SOAP WSDLDriverFactory header params
steven shingler
2/9/2009 5:33:00 PM
[Note: parts of this message were removed to make it a legal post.]
Hi all,
I have a little bit of code which uses the WSDLDriverFactory library:
class Swrapper
def initialize(wsdl)
wsdl = SOAP::WSDLDriverFactory.new(wsdl)
@soap = wsdl.create_rpc_driver
end
def send_soap(method, params)
@soap.send("#{method}", params)
end
end
But, I can't figure out how to add stuff into the header of the soap message
- like this:
<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envel...
xmlns:bet="
http://www.example.com/namespace/xsd/webservice...
<soapenv:Header>
<ticket:identity>
<ticket:id>3</bet:id>
<ticket:code>test</ticket:code>
<ticket:password>password</ticket:password>
</ticket:identity>
</soapenv:Header>
<soapenv:Body>
<ticket:title>
<ticket:summary>1</ticket:summary>
</ticket:title>
</soapenv:Body>
</soapenv:Envelope>
If anyone's used this library and knows, please shout! :)
Thanks all
Steven
1 Answer
Dan Webb
2/10/2009 9:35:00 AM
0
Hi Steven,
Best thing to start off is get the newest version of SOAP4R from gem.
I've used the WSDL2Ruby tool. The instructions for use are up at:
http://dev.ctor.org/soap4r/wiki...
I'm not sure how you produce the exact header information you want but
this should help you.=20
Instead of <ticket:id>3</bet:id>=20
this code will produce something along the lines of;=20
<n1:id>3</n1:id>
soapAuthentication.rb
require 'soap/header/simplehandler'
class SoapAuthHeader < SOAP::Header::SimpleHandler
NAMESPACE =3D '
http://questionmark.com/QM...
DIGEST =3D=20
ENCODING =3D=20
SIGNATURE =3D=20
def initialize()
super(XSD::QName.new(NAMESPACE, 'Trust'))
end
def on_simple_outbound
{
"Encoding" =3D> ENCODING,
"Digest" =3D> DIGEST,
"Signature" =3D> SIGNATURE
}
=20
end
end
main.rb
require 'defaultDriver.rb'
require 'soapAuthentication.rb'
## Create QMWise SOAP Driver
wsdl =3D "http://?wsdl"
user =3D ""
pass =3D ""
obj =3D defaultSOAP.new()
obj.wiredump_dev =3D STDERR if $DEBUG
trust =3D SoapAuthHeader.new
obj.headerhandler << trust
hope this helps a little. There's very little documentation when it
comes to SOAP4R, so if you find out how to change the "n1" tag to
"ticket" can you let me know ;)
Cheers,
Dan
-----Original Message-----
From: steven shingler [mailto:shingler@gmail.com]=20
Sent: 09 February 2009 17:33
To: ruby-talk ML
Subject: SOAP WSDLDriverFactory header params
Hi all,
I have a little bit of code which uses the WSDLDriverFactory library:
class Swrapper
def initialize(wsdl)
wsdl =3D SOAP::WSDLDriverFactory.new(wsdl)
@soap =3D wsdl.create_rpc_driver
end
def send_soap(method, params)
@soap.send("#{method}", params)
end
end
But, I can't figure out how to add stuff into the header of the soap
message
- like this:
<soapenv:Envelope
xmlns:soapenv=3D"
http://schemas.xmlsoap.org/soap/envel...
xmlns:bet=3D"
http://www.example.com/namespace/xsd/webservice...
<soapenv:Header>
<ticket:identity>
<ticket:id>3</bet:id>
<ticket:code>test</ticket:code>
<ticket:password>password</ticket:password>
</ticket:identity>
</soapenv:Header>
<soapenv:Body>
<ticket:title>
<ticket:summary>1</ticket:summary>
</ticket:title>
</soapenv:Body>
</soapenv:Envelope>
If anyone's used this library and knows, please shout! :)
Thanks all
Steven
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
SOAP WSDLDriverFactory header params
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password