Monday, February 26, 2007

Mike Heath stumbles upon pile of java JIT

Mike has had a great time with this and we've had some intriguing conversations about it. Once he posts his svn repo url I'll snag the code, run the tests on my MacBook Pro and add the results to his matrix.

Wednesday, February 21, 2007

UPS xml online tools and Ruby

UPS provides "XML Online Tools" to account holders here. Once you register as a developer you can get access to these tools and the associated specs and sample code. I needed access to the Rates and Service Selection tool, which happened to contain VB script and Java sample code from 2001. The docs are very thorough, but the code (as expected) was very outdated. Once I had it working with 1.5 (not too difficult at all) I was able to better understand what was needed for working with their HTTP-XML services.

The following barebones Ruby code is the result of a quick implementation:

require 'net/https'
require 'uri'

auth_xml = (access request xml doc goes here)
req_xml = (request xml doc goes here)
both_xml = auth_xml + req_xml

url = URI.parse("https://....")
request =
request.body = (both_xml)
request.content_type = 'application/x-www-form-urlencoded'

http =,443)
#http.set_debug_output $stderr
http.use_ssl = true
http.timeout = 30

@response = nil
http.start do
@response = http.request(request)

p @response.body