Squeak Http GET broken?

Nevin Pratt nevin at bountifulbaby.com
Tue Dec 27 03:59:43 UTC 2005


This should be simple, but it's got me stumped.

First, plug the following URL into any browser (Mozilla, IE, 
Thunderbird, Safari, or whatever, all one line in the URL panel):

   
http://testing.shippingapis.com/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest 
 ><Address ID="0"><Address1></Address1><Address2>6406 Ivy 
Lane</Address2><City>Greenbelt</City><State>MD</State><Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>

You should get back the following response from the shippingapis.com 
machine:

   <Error>
    <Number>80040b19</Number>
    <Description>XML Syntax Error: Error getting USERID 
attribute.</Description>
    <Source>UspsCom::DoAuth</Source>
</Error>

And, this is how it should be.  And, I would like to duplicate this 
behavior via Squeak code.  So, I try, for example, the following:

HTTPClient httpGetDocument: 
'http://testing.shippingapis.com/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest><Address 
ID="0"><Address1></Address1><Address2>6406 Ivy 
Lane</Address2><City>Greenbelt</City><State>MD</State><Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>'

I would think that the above would be the programmatic equivalent of the 
URL I typed into Thunderbird (I also tried it with Safari, and both 
Safari and Thunderbird gave me the same results).  But when I do it 
programmatically in Squeak, I get back this response:

HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.0
Date: Tue, 27 Dec 2005 03:46:44 GMT
Content-Type: text/html
Content-Length: 87<html><head><title>Error</title></head><body>The 
parameter is incorrect. </body></html>

I was expecting the "XML Syntax Error" response that Thunderbird (as 
well as Safari) gave me instead of this nonsense.  But I instead got 
back something totally different.  Why?

OK, let's try Scamper.  So, I plug in the URL I mentioned, and I get the 
following response in Scamper:

error occured retrieving 
http://testing.shippingapis.com/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest 
 ><Address ID="0"><Address1></Address1><Address2>6406 Ivy 
Lane</Address2><City>Greenbelt</City><State>MD</State><Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>: 
HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.0
Date: Tue, 27 Dec 2005 03:50:47 GMT
Content-Type: text/html
Content-Length: 87<html><head><title>Error</title></head><body>The 
parameter is incorrect. </body></html>

So, Scamper is also giving me something different from the "XML Syntax 
Error" response I was expecting.  Why?

I've tried every combination of GET and/or POST I could think of.  I 
just don't understand why Squeak is giving me a different result than 
Thunderbird gives me.  Anybody know?

In case you are curious, if I include my login ID as an XML arg of the 
URL, the shippingapis.com machine will validate my address(es) that I 
pass to it.  I just didn't think it would be a good idea to post my 
login ID.  Besides, it is unnecessary to do so, because if I solve the 
above problem, I will solve my *real* problem, and will be able to 
programmatically validate any US-based address.

Anybody know why Squeak is giving me different results than the web 
browsers do?

Nevin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20051226/6d87a095/attachment.htm


More information about the Squeak-dev mailing list