Override endpoint in WSDL

16 views
Skip to first unread message

Bill Kocik

unread,
May 24, 2008, 12:14:56 PM5/24/08
to soap4r

Hello -

I'm integrating with Google's AdSense API using soap4r. As is
standard, I create a WSDLDriverFactory, point it at the WSDL file, and
ask for an RPC driver which I then call my methods on. The trouble is
that right now Google's WSDL generator has a bug (which they're aware
of), and it defines the endpoint for the service as a 10.* IP address,
which clearly cannot be routed to across the Internet. Their suggested
workaround is that users override the endpoint given in the WSDL file
until they fix their bug.

Does soap4r provide some way to override the endpoint of a service?
I'm not having a lot of luck finding it in the docs; hopefully I just
haven't looked in the right place yet.

Thanks,
-Bill

brofield

unread,
May 24, 2008, 6:41:25 PM5/24/08
to soap4r
On May 25, 1:14 am, Bill Kocik <bko...@gmail.com> wrote:
> Does soap4r provide some way to override the endpoint of a service?
> I'm not having a lot of luck finding it in the docs; hopefully I just
> haven't looked in the right place yet.

I'm not sure about when you are using dynamically generated proxies,
however if you use wsdl2ruby and generate the static driver classes
then you can override the URL programmatically as:

url = 'http://your.server/service'
client = ServicePortType.new(url)

Of course, if you are generating classes then you can just manually
edit the WSDL too before generating. Can't help you with the dynamic
case though (I don't use it).

Regards,
Brodie

Bill Kocik

unread,
May 27, 2008, 9:24:51 AM5/27/08
to soap4r
Well, I was trying to use dynamically generated proxies, but since as
far as I can tell there isn't a way to override the endpoint in that
scenario, at your suggestion I tried the wsdl2ruby route. It didn't
work at all. I called this:

ruby /usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.8/bin/wsdl2ruby.rb --
wsdl https://sandbox.google.com/api/adsense/v3/AccountService?wsdl --
type client --force

...and got back a ton of errors, most of which looked something like
this:

WARNING: no soap:fault found for wsdl:fault "{http://www.google.com/
api/adsense/v3}associateExistingAccountFault" in operation
"associateExistingAccount"

...with various operation names, and then finally this:

F, [2008-05-27T09:23:10.292399 #5114] FATAL -- app: Detected an
exception. Stopping ... base type definition not found: {http://
www.google.com/api/adsense/v3}AxisFault (RuntimeError)

I'm sunk. :(

jerith

unread,
Jun 19, 2008, 9:22:21 AM6/19/08
to soap4r
On 24 May, 18:14, Bill Kocik <bko...@gmail.com> wrote:
> Does soap4r provide some way to override the endpoint of a service?
> I'm not having a lot of luck finding it in the docs; hopefully I just
> haven't looked in the right place yet.

1.5.8 provides an endpoint_url accessor on the driver. My client
contains the following snippet of code to set it:

@driver = SOAP::WSDLDriverFactory.new(@wsdl).create_rpc_driver
@driver.endpoint_url = CONFIG[:endpoint_url]

I find it particularly useful to switch between test and production
servers.

--J
Reply all
Reply to author
Forward
0 new messages