[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Getting Error HTTP/1.1 501 Not Implemented.



David,

You might want to look at this:
http://www.scottklement.com/archives/ftpapi/200906/msg00110.html

A couple of us have previously tested the USPS function. You should be able to use as a template for most of the USPS functions. It handles the proper encoding of the input and parses the XML into a data structure.

Good luck!


> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
> bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of David White
> Sent: Monday, January 17, 2011 3:03 PM
> To: HTTPAPI and FTPAPI Projects
> Subject: Re: Getting Error HTTP/1.1 501 Not Implemented.
> 
> Thanks Scott & Magne,
> 
> Well that was a humbling experience for me :| Obviously I'm well
> versed in the post & get methods.
> 
> OK... I switched to using http_url_get_raw. I also, switched to using
> the ZipCodeLookup API.
> 
> 
> DAW1   //Construct the XML document.
> DAW1   data = '<ZipCodeLookupRequest%20USERID="400MCKES0921">' +
> DAW1          '<Address%20ID="0">' +
> DAW1
> '<Address1></Address1><Address2>6406%20Ivy%20Lane</Address2>' +
> DAW1          '<City>Greenbelt</City><State>MD</State>' +
> DAW1          '</Address></ZipCodeLookupRequest>';
> DAW1
> DAW1   //Construct the URL with the XML.
> DAW1   rc = http_url_get_raw(
> DAW1        'http://testing.shippingapis.com/' +
> DAW1        'ShippingAPITest.dll?API=ZipCodeLookup&XML=' :
> DAW1        1 : %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;
> 
> I do get a response now. RC was equal to 1, so no fatal errors
> occurred. This is the XML I get back, I will have to ask the USPS
> about that.
> 
> <Error>
> 	<Number>80040b19</Number>
> 	<Description>XML Syntax Error: Error getting USERID
> attribute.</Description>
> 	<Source>UspsCom::DoAuth</Source>
> </Error>
> 
> Thanks again guys!
> 
> Dave
> 
> On Mon, Jan 17, 2011 at 1:48 PM, Magne Kofoed
> <magne.kofoed@xxxxxxxxxxx> wrote:
> > Hi Dave,
> >
> > Your browser example is http get method.
> > Maybe you should try a httpapi get example.
> >
> > "HTTP/1.1 501 Not Implemented"  also indicates that the POST method
> is not
> > supported.
> >
> > Best regards,
> > Magne
> >
> > -----Opprinnelig melding-----
> > Fra: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] På vegne av David
> White
> > Sendt: 17. januar 2011 18:35
> > Til: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
> > Emne: Getting Error HTTP/1.1 501 Not Implemented.
> >
> > 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=<Add
> ressV
> >
> alidateRequest%20USERID="400MCKES0921"><Address%20ID="0"><Address1></Ad
> dress
> >
> 1><Address2>6406%20Ivy%20Lane</Address2><City>Greenbelt</City><State>MD
> </Sta
> > te><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
> > ---------------------------------------------------------------------
> --
> >
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------