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

Re: [Ftpapi] USPS address verification return values



Jeff,

The http_get_xml() routine will send it's output to the subprocedure(s) that are called when parsing the XML.  In this case, it looks like you've coded a subprocedure called "Incoming" that will receive them.  (But, you did not post the code for that procedure, so I don't know what it is doing.)

I'm not familiar with this particular program.  Do you have a link to it so I can see the rest of the code?

-SK



On 3/26/2018 4:00 PM, Jeff Wilson wrote:

I am trying to use the program that was posted 4 years ago for the USPS verification of addresses. My question is, how to I get the results? The program works fine and send the data to USPS and gets a response, but how do I evaluate the response? I don’t see it coming back into a variable. I am an RPG guy, with almost no XML, so I must be missing something.
Thanks very much

d address1        s             38a    inz(*blanks)
d address2        s             38a    inz('6406 Ivy Lane')
d city            s             15a    inz('Greenbelt')
d state           s              2a    inz('MD')
d zip5            s              5a    inz(*blanks)
d zip4            s              4a    inz(*blanks)
//production
url = 'http://production.shippingapis.com/ <https://protect-us.mimecast.com/s/Qvz9CzpYz7swwXiX3e0Z?domain=production.shippingapis.com>';
addressRequest =
        '<AddressValidateRequest '+
        'USERID="' + %trim(USPSUserID) + '">' +
        '<Address ID="0">'+
        '<Address1>' + %trim(Address1) +
        '</Address1>' +
        '<Address2>' + %trim(Address2) +
        '</Address2>' +
        '<City>' + %trim(City) +
        '</City>' +
        '<State>' + %trim(State) +
        '</State>' +
         '<Zip5>' + %trim(Zip5) +
         '</Zip5>' +
         '<Zip4>' + %trim(Zip4) +
         '</Zip4>' +
         '</Address></AddressValidateRequest>';
// encode the address request
Enc = http_url_encoder_new();
rc2 = http_url_encoder_addvar( Enc:
            'XML':
            %addr(addressRequest) + 2:
            %len(addressRequest));
bigString = http_url_encoder_getstr( Enc );
urlValues =
            'ShippingAPItest.dll?API=Verify&' +
             bigString;
// send request
rc = http_get_xml(url +  urlValues:
            *null: %paddr(Incoming): *null ); if rc <> 1;
   msg = http_error;
   dsply msg;
Else;
endif;




--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi