xml-rpc 302 error handling?

C

cooper bethea

Hi everybody -

I've been playing with 37signals' new Backpack XML-RPC API -
http://www.backpackit.com/api/ - and it's giving me a bit of a problem.
Apparently my use of XMLRPC::Client#call returns a RuntimeError that
contains ""HTTP-Error: 302 Found" but no URI to redirect to. Is there a
way to work around this? I've pasted code below - note that if you just
plug this in and try it it won't work for you; the xml api requires an
sha-1 hash supplied with "token".

Any suggestions?

--
#!/usr/local/bin/ruby

require 'xmlrpc/client'
require 'rexml/document'

token = ''

headers = Hash.new
headers['X-POST_DATA_FORMAT'] = 'xml'

server = XMLRPC::Client.new("cooper.backpackit.com",
"/ws/tags/select/3165")
server.http_header_extra = headers

begin
tags = server.call("token", token)
rescue RuntimeError => e
p e.message
end

p tags
--
 
A

Adam Keys

Hi everybody -

I've been playing with 37signals' new Backpack XML-RPC API -
http://www.backpackit.com/api/ - and it's giving me a bit of a
problem. Apparently my use of XMLRPC::Client#call returns a
RuntimeError that contains ""HTTP-Error: 302 Found" but no URI to
redirect to. Is there a way to work around this? I've pasted code
below - note that if you just plug this in and try it it won't work
for you; the xml api requires an sha-1 hash supplied with "token".

Any suggestions?


That's quite the novel use of xmlrpc4r. Any reason you're doing that
rather than using Net::HTTP directly or the Backpack wrapper that was
posted by why?

http://www.whytheluckystiff.net/ruby/backpack.rb
 

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,770
Messages
2,569,586
Members
45,089
Latest member
Ketologenic

Latest Threads

Top