Squeak Http GET broken?

Nevin Pratt nevin at bountifulbaby.com
Wed Dec 28 19:36:13 UTC 2005


>>
>>
> 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
>

Your code works.  Thanks, Hans!

Also, your comment about using "asUrl retrieveContents" producing the 
wrong results is spot on.  Your code is what was needed.  Your code lets 
me use the USPS Web Tools API, to do address validation and more.

If anybody else wants to know more about doing this, I've pasted an 
email from USPS below, and it gives further details.  In the email, I've 
replaced my true Web Tools User ID with x's, though, for obvious 
reasons.  You would obviously have to contact USPS yourself to get your 
own user ID.

Thanks, everyone!

Nevin

>Thank you for registering for the U. S. Postal Service's Web Tools Application Program Interfaces (APIs).  We are providing you with a User ID that serves multiple purposes, as explained below.
>
>
>Your Web Tools User ID is: xxxxxxxxxxxx
>
>
>The latest versions of the technical documentation, including the Administrative Guide, are available from USPS.com at:  www.usps.com/webtools.  They provide documentation and sample code for implementing our APIs.  This documentation is in PDF and HTML format.  In order to open and view this document in PDF you must have Adobe Acrobat Reader installed on your system.  You may download this software, at no cost, from http://www.adobe.com/products/acrobat/readstep2.html.
>
>IMPORTANT NOTE:  The current documentation refers to a password.  Please ignore all references to password in the documentation.  Password is no longer used or required.
>
>Your Web Tools User ID to integrate USPS Web Tools is provided above. The User ID is used for testing your implementation of the API(s).  With this ID, you may begin sending calls to the test server.  The address to the test server is:  testing.shippingapis.com and the path is /ShippingAPITest.dll.  Use this information in combination with your User ID and your XML string to send a request to the USPS servers.  For more details, refer to the programming guides (located at
>www.usps.com/webtools) for the specific API you are integrating.
>
>A sample test request would look like: "http://testing.shippingapis.com/ShippingAPITest.dll?API=[API_Name]&XML=
>[XML_String_containing_User_ID]"
>
>When you have completed your testing, email the USPS Internet Customer Care Center (ICCC).  They will switch your profile to allow you access to the production server and will provide you with the production URL.
>
>The ICCC is staffed from 7:00AM to 11:00PM Eastern Time.
>
>	E-mail:	icustomercare at usps.com
>	Telephone:	1-800-344-7779 
>
>
>                      IMPORTANT NOTICE REGARDING USER ID
>
>
>The Web Tools User ID provided is for you and your company to use when requesting data via the Internet from the U.S. Postal Service API servers.  This unique User ID cannot be shared with others outside your organization, nor is it to be packaged and distributed or sold to other individuals, businesses or e-commerce web site entities.  As per the Terms and Conditions of Use Agreement you agreed to during the Web Tools registration process, you are responsible to maintain the confidentiality of your User ID as specified.  You may not package any APIs with your User ID for resale or distribution to others.  The U.S. Postal Service does not prohibit the reuse and/or distribution of the API documentation (User's Guide) with sample code in order to generate awareness, encourage use or provide ease-of-use to customers or affiliates. 
>
>Warning - If the U.S. Postal Service discovers use of the same User ID from more than one web site, all users will be subject to loss of access to the USPS production server and/or termination of the licenses granted under the Terms and Conditions of Use.  For more information regarding the USPS Web Tools User ID policy, or for questions regarding distribution of documentation, send email to icustomercare at usps.com.
>
>Thank you for helping the U.S. Postal Service provide new services to our shipping customers.
>
>Sincerely,
>
>The Internet Shipping Solutions Team
>
>USPS Internet Customer Care Center
>icustomercare at usps.gov
>7:00AM - 11:00PM EST
>  
>




More information about the Squeak-dev mailing list