Squeak Http GET broken?
Hans-Martin Mosner
hmm at heeg.de
Wed Dec 28 19:00:10 UTC 2005
Bob Courchaine wrote:
>Nevin Pratt wrote:
>
>
>>I want to retrieve that response, via the URL, totally inside of Squeak,
>>without dealing with files. It's that simple.
>>
>>
>
>?
>
>I thought your issue was w/ a client you were trying to use, like Celeste.
>
>In a Workspace, Inspect "<your long URL> asUrl retrieveContents".
>
>A MIMEDocument is returned. Look at the "Contents" and you'll see your
>error message.
>
>
>
>
>
But that's the original, wrong, error message.
The problem is that your request is not properly URL-encoded. The
easiest way to achieve this (which is also much easier to use
programmatically given an XML request string) looks like this:
HTTPSocket
httpGetDocument: 'http://testing.shippingapis.com/ShippingAPITest.dll'
args: ({'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>')
} as: Dictionary)
accept: 'text/xml'
Note that the dictionary values must be arrays of strings, not simple
strings. This is a little awkward, but it's how the class is implemented.
I've tested it, it works.
Cheers,
Hans-Martin
More information about the Squeak-dev
mailing list
|