[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting Error HTTP/1.1 501 Not Implemented.
Hi David,
Your HTTPAPI code is different from your Chrome example in two ways:
1) The data you're sending to Chrome is escaped properly. (You didn't
do that with the HTTPAPI data.)
2) The Chrome example is using a GET request, whereas with HTTPAPI, you
are using a POST request.
Consider using the URL-encoder or WebForms support in HTTPAPI to encode
the data. Then use http_url_get_raw (instead of http_url_post_raw) to
send it.
Good luck
On 1/17/2011 11:35 AM, David White wrote:
> Good Morning Everybody,
>
> I'm new to using the HTTPAPI. I searched for this error in the mailing
> list first but did not anything, so I decided to post this asking for
> some help.
>
> - What I'm trying to do is post an address to the USPS to get the zip code.
>
> - I modeled my program GETZIPCODE after EXAMPLE5. Here is the code
> that's running....
>
> c eval *inlr = *on
>
> DAW1 c
> DAW1 /free
> DAW1
> DAW1 //Construct the XML document.
> DAW1 data = '<AddressValidateRequest%20USERID="400MCKES0921">' +
> DAW1 '<Address ID="0">' +
> DAW1 '<Address1></Address1><Addreess2>6406 Ivy Lane</Address2>' +
> DAW1 '<City>Greenbelt</City><State>MD</State><Zip5></Zip5><Zip4>' +
> DAW1 '</Zip4></Address></AddressValidateRequest>';
> DAW1
> DAW1 //Construct the URL with the XML.
> DAW1 rc = http_url_post_raw(
> DAW1 'http://testing.shippingapis.com/' +
> DAW1 'ShippingAPITest.dll?API=Verify&XML=' :
> DAW1 %addr(data):
> DAW1 %len(%trimr(data)):
> DAW1 1:
> DAW1 %paddr('INCOMING'));
> DAW1
> DAW1 //Check for error.
> DAW1 if rc<> 1;
> DAW1 msg = http_error;
> DAW1 dsply msg;
> DAW1 //return;
> DAW1 endif;
> DAW1
> DAW1 //Convert the received data to EBCDIC character set.
> DAW1 if retlen> 1;
> DAW1 http_xlate(retlen : retdata : TO_EBCDIC);
> DAW1 endif;
> DAW1
> DAW1 return;
>
> - Here is the error returned...
>
> Job 280312/DWHITE/QPADEV005Z held by user DWHITE with option SPLFILE(*NO)
> Job 280312/DWHITE/QPADEV005Z released by user DWHITE.
> DSPLY HTTP/1.1 501 Not Implemented
>
> - When I post this via the browser (Chrome) it works fine...
>
> http://testing.shippingapis.com/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest%20USERID="400MCKES0921"><Address%20ID="0"><Address1></Address1><Address2>6406%20Ivy%20Lane</Address2><City>Greenbelt</City><State>MD</State><Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>
>
> Anybody see what I'm doing wrong?
>
> Thanks!
>
> Dave
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------