H
Hartin, Brian
Hi all,
Got a question about the Ruby SOAP library. I've generated a proxy
using the SOAP::WSDLDriverFactory as follows:
ws =3D
SOAP::WSDLDriverFactory.new('http://foo.com/foo.wsdl').create_rpc_driver
I can see that this generates methods for each defined operation, and I
use them thusly:
ws.WSGetResultsmaxRecords =3D> 1, ...)
The method and parameters are translated to the appropriate XML in the
SOAP message body. However, some operations require a 'User' and
'Password' to be in the message _header_. I've looked through the
documentation and mailing lists with no luck. How can one achieve this?
My code is listed below.
Thanks!
Brian Hartin
---- soaptest.rb ----
require 'soap/wsdlDriver'
require 'date'
ws =3D
SOAP::WSDLDriverFactory.new('http://foo.com/foo.wsdl').create_rpc_driver
ws.generate_explicit_type =3D true
r =3D ws.WSHeartbeat({}) # Works because it doesn't require authenticatio=
n
r =3D g.WSGetXmlResultsrecordId =3D> 123, :recordLimit =3D> 200) # Does=
n't
work
---- Example SOAP request, according to vendor ----
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<soap:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
xmlns:soap=3D"http://schemas.xmlsoap.org/soap/envelope/">
=20 <soap:Header>
=20 <!-- I don't know how to populate the header -->
=20 <WSAuthHeader xmlns=3D"http://foo.com/WSFooSvc">
=20 <User>string</User>
=20 <Password>string</Password>
=20 </WSAuthHeader>
=20 </soap:Header>
=20 <soap:Body>
=20 <WSGetXmlResults xmlns=3D"http://foo.com/WSFooSvc">
=20 <recordId>int</recordId>
=20 <recordLimit>int</recordLimit>
=20 </WSGetXmlResults>
=20 </soap:Body>
</soap:Envelope>
*************************************************************************=
***=20
This email may contain confidential material.=20
If you were not an intended recipient,=20
Please notify the sender and delete all copies.=20
We may monitor email to and from our network.=20
*************************************************************************=
***
Got a question about the Ruby SOAP library. I've generated a proxy
using the SOAP::WSDLDriverFactory as follows:
ws =3D
SOAP::WSDLDriverFactory.new('http://foo.com/foo.wsdl').create_rpc_driver
I can see that this generates methods for each defined operation, and I
use them thusly:
ws.WSGetResultsmaxRecords =3D> 1, ...)
The method and parameters are translated to the appropriate XML in the
SOAP message body. However, some operations require a 'User' and
'Password' to be in the message _header_. I've looked through the
documentation and mailing lists with no luck. How can one achieve this?
My code is listed below.
Thanks!
Brian Hartin
---- soaptest.rb ----
require 'soap/wsdlDriver'
require 'date'
ws =3D
SOAP::WSDLDriverFactory.new('http://foo.com/foo.wsdl').create_rpc_driver
ws.generate_explicit_type =3D true
r =3D ws.WSHeartbeat({}) # Works because it doesn't require authenticatio=
n
r =3D g.WSGetXmlResultsrecordId =3D> 123, :recordLimit =3D> 200) # Does=
n't
work
---- Example SOAP request, according to vendor ----
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<soap:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
xmlns:soap=3D"http://schemas.xmlsoap.org/soap/envelope/">
=20 <soap:Header>
=20 <!-- I don't know how to populate the header -->
=20 <WSAuthHeader xmlns=3D"http://foo.com/WSFooSvc">
=20 <User>string</User>
=20 <Password>string</Password>
=20 </WSAuthHeader>
=20 </soap:Header>
=20 <soap:Body>
=20 <WSGetXmlResults xmlns=3D"http://foo.com/WSFooSvc">
=20 <recordId>int</recordId>
=20 <recordLimit>int</recordLimit>
=20 </WSGetXmlResults>
=20 </soap:Body>
</soap:Envelope>
*************************************************************************=
***=20
This email may contain confidential material.=20
If you were not an intended recipient,=20
Please notify the sender and delete all copies.=20
We may monitor email to and from our network.=20
*************************************************************************=
***