[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: HTTPAPI for UPS Rate
Can some one tell me what is my problem with the program, I have compile the
program and compiles correct and when I go to debug Mode the program never
reach the Code where the StartofElement neither the EndofElement where I do
the Select
See the attached program code
Thank you
5722WDS V5R4M0 060210 SEU SOURCE LISTING 09/09/10 12:31:41 S10DDA1B PAGE 1
SOURCE FILE . . . . . . . LIBHTTP/QRPGLESRC
MEMBER . . . . . . . . . UPSRATE
SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0
100 * UPSRate: Send and Get Rates for a Package from UPS 08/19/10
200 *
300 * This is an interactive program that asks for a UPS tracking
400 * number, then gets the status of that package from UPS. You
500 * might use this as a model for your own custom tracking app.
600 * for example:
700 * -- Modify it to get the tracking number from your
800 * database instead of from the user. (User keys an
900 * order number, it looks up the UPS tracking number,
1000 * and tracks it, real time!)
1100 * -- Modify it to track all packages for a day during
1200 * a batch run, instead of working interactively.
1300 * -- Make it a Web app where customers can see the
1400 * status of their orders on-line.
1500 *
1600 * UPS offers several other services besides tracking, and you
1700 * can use this as a model for accessing those services as well.
1800 *
1900 * Prior to using this application, you *MUST* register with UPS,
2000 * then fill-in the UPS_USERID, UPS_PASSWD and UPS_LICENSE
2100 * constants in the D-specs below.
2200 *
2300 * For more information, see the following:
2400 * http://ups.com/content/us/en/bussol/offering
2500 * /technology/automated_shipping/online_tools.html
2600 *
2700 * Here's a shorter/easier link:
2800 * http://tinyurl.com/hsrzt
2900 *
3000 * The URL used herein is UPS's URL for testing. They have a
3100 * different one for production. See the PDF documentation for
3200 * tracking found on the above Web site for more info.
3300 *
3400 * To Compile:
3500 * CRTDSPF FILE(EXAMPLE16S) SRCFILE(xxx/QDDSSRC)
3600 * CRTBNDRPG EXAMPLE16 SRCFILE(xxx/QRPGLESRC) DBGVIEW(*LIST)
3700 *
3800 H DFTACTGRP(*NO) BNDDIR('HTTPAPI')
3900
4300 /copy qrpglesrc,httpapi_h
4400
4500 D StartOfElement PR
4600 D UserData * value
4700 D depth 10I 0 value
4800 D name 1024A varying const
4900 D path 24576A varying const
5000 D attrs * dim(32767)
5100 D const options(*varsize)
5200 D EndOfElement PR
5300 D UserData * value
5400 D depth 10I 0 value
5500 D name 1024A varying const
5600 D path 24576A varying const
5722WDS V5R4M0 060210 SEU SOURCE LISTING 09/09/10 12:31:41 S10DDA1B PAGE 2
SOURCE FILE . . . . . . . LIBHTTP/QRPGLESRC
MEMBER . . . . . . . . . UPSRATE
SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0
5700 D value 65535A varying const
5800 D attrs * dim(32767)
5900 D const options(*varsize)
6000
6100 D UPS_USERID C '*******' 08/03/10
6200 D UPS_PASSWD C '********' 08/03/10
6300 D UPS_LICENSE C '****************' 08/03/10
6400
7000 d act s 10I 0
7001 d RATE ds qualified 09/09/10
7003 d UPSTCHG1 7A 09/09/10
7004 d UPSTCUR1 3A 09/09/10
7005 D UPSSCHG1 7A 09/09/10
7006 D UPSSCUR1 3A 09/09/10
7007 D UPSDCHG1 9A 09/09/10
7008 D UPSDCUR1 3A 09/09/10
8000
8100 D rc s 10I 0
8200 D postData s 24000A varying 08/31/10
8201 D SHPNBR s 6A varying 08/27/10
8202 D s1Fnam s 25A varying 08/27/10
8203 D s1Fad1 s 25A varying 08/27/10
8204 D s1Fad2 s 25A varying 08/27/10
8205 D s1Fcty s 20A varying 08/27/10
8206 D s1Fstt s 2A varying 08/27/10
8207 D s1Fzip s 9A varying 08/27/10
8208 D s1Fcntry s 2A varying 08/31/10
8209 D s1Fphn s 15A varying 08/27/10
8210 D s1Ffax s 15A varying 08/27/10
8211 D s1Snam s 25A varying 08/27/10
8212 D s1Sad1 s 25A varying 08/27/10
8213 D s1Sad2 s 25A varying 08/27/10
8214 D s1Scty s 20A varying 08/27/10
8215 D s1Sstt s 2A varying 08/27/10
8216 D s1Szip s 9A varying 08/27/10
8217 D s1Scntry s 2A varying 08/31/10
8218 D s1Sphn s 15A varying 08/27/10
8219 D s1Sfax s 15A varying 08/27/10
8220 D s1ptyp s 2A varying 08/27/10
8221 D s1pdes s 25A varying 08/27/10
8222 D s1srvcde s 2A varying 08/27/10
8223 D s1srvdes s 25A varying 08/27/10
8224 D s1pkgtyp s 2A varying 08/27/10
8225 D s1pkgdes s 25A varying 08/27/10
8226 D s1wgt s 7 09/09/10
8227 D s1uom s 3A varying 08/27/10
8228 D UPSTCHG s 7 09/09/10
8229 D UPSTCUR s 3A varying 08/31/10
8230 D UPSSCHG s 7 09/09/10
8231 D UPSSCUR s 3A varying 08/31/10
8232 D UPSDCHG s 9 09/09/10
8233 D UPSDCUR s 3A varying 08/31/10
8234 D filler s 95A varying 08/31/10
8235 D RRN s 4 0 09/09/10
8500 D tempDate s D
8600 D tempTime s T
8601 * 08/27/10
8602 D ALIST DS 08/27/10
8603 D @SHPNBR 6 08/27/10
8604 D @s1Fnam 25 08/27/10
8605 D @s1Fad1 25 08/27/10
8606 D @s1Fad2 25 08/27/10
8607 D @s1Fcty 20 08/27/10
8608 D @s1Fstt 2 08/27/10
8609 D @s1Fzip 9 08/27/10
8610 D @s1Fcntry 2 08/31/10
8611 D @s1Fphn 15 08/27/10
8612 D @s1Ffax 15 08/27/10
8613 D @s1Snam 25 08/27/10
8614 D @s1Sad1 25 08/27/10
8615 D @s1Sad2 25 08/27/10
8616 D @s1Scty 20 08/27/10
8617 D @s1Sstt 2 08/27/10
8618 D @s1Szip 9 08/27/10
8619 D @s1Scntry 2 08/31/10
8620 D @s1Sphn 15 08/27/10
8621 D @s1Sfax 15 08/27/10
8622 D @s1ptyp 2 08/27/10
8623 D @s1pdes 25 08/27/10
8624 D @s1srvcde 2 08/27/10
8625 D @s1srvdes 25 08/27/10
8626 D @s1pkgtyp 2 08/27/10
8627 D @s1pkgdes 25 08/27/10
8628 D @s1wgt 7 09/09/10
8629 D @s1uom 3 08/27/10
8630 D @UPSTCHG 7 09/09/10
8631 D @UPSTCUR 3A 08/31/10
8632 D @UPSSCHG 7 09/09/10
8633 D @UPSSCUR 3A 08/31/10
8634 D @UPSDCHG 9 09/09/10
8635 D @UPSDCUR 3A 08/31/10
8636 D @filler 95A 08/31/10
8637 D XPLIST 1 500 08/31/10
8638 * 08/27/10
8701 * 08/27/10
8702 * Define enter parameter 08/27/10
8703 C *ENTRY PLIST 08/27/10
8704 C PARM ALIST 08/27/10
8705 * 08/27/10
8706 08/27/10
8800 /free
8900 if ( %subst(UPS_USERID:1:1) = '<'
9000 or %subst(UPS_PASSWD:1:1) = '<'
9100 or %subst(UPS_LICENSE:1:1) = '<' );
9200 http_comp('You must be registered with UPS! Can + 08/27/10
9300 Not Continue with the proces.'); 08/27/10
9400 *inlr = *on;
9500 return;
9600 endif;
10300
10301 if ALIST = ' '; 08/27/10
10302 *inlr = *on; 08/27/10
10303 return; 08/27/10
10304 else; 08/27/10
10305 If Alist <> ' '; 08/27/10
10401 shpnbr = %trim(@SHPNBR); 08/27/10
10402 s1fnam = %trim(@s1Fnam); 08/27/10
10403 s1Fad1 = %trim(@s1Fad1); 08/27/10
10404 s1Fad2 = %trim(@s1Fad2); 08/27/10
10405 s1fcty = %trim(@s1Fcty); 08/27/10
10406 s1fstt = %trim(@s1Fstt); 08/27/10
10407 s1fzip = %trim(@s1Fzip); 08/27/10
10408 s1fcntry = %trim(@s1Fcntry); 08/31/10
10409 s1Fphn = %trim(@s1Fphn); 08/27/10
10410 s1Ffax = %trim(@s1Ffax); 08/27/10
10411 s1Snam = %trim(@s1Snam); 08/27/10
10412 S1Sad1 = %trim(@s1Sad1); 08/27/10
10413 S1Sad2 = %trim(@s1Sad2); 08/27/10
10414 S1Scty = %trim(@s1Scty); 08/27/10
10415 S1Sstt = %trim(@s1Sstt); 08/27/10
10416 S1Szip = %trim(@s1Szip); 08/27/10
10417 s1Scntry = %trim(@s1Scntry); 08/31/10
10418 S1Sphn = %trim(@s1Sphn); 08/27/10
10419 S1Sfax = %trim(@s1Sfax); 08/27/10
10420 S1Ptyp = %trim(@s1ptyp); 08/27/10
10421 S1Pdes = %trim(@s1pdes); 08/27/10
10422 S1Srvcde = %trim(@s1srvcde); 08/27/10
10423 S1Srvdes = %trim(@s1srvdes); 08/27/10
10424 S1PkgTyp = %trim(@s1pkgtyp); 08/27/10
10425 S1PkgDes = %trim(@s1pkgdes); 08/27/10
10426 S1Wgt = (@s1wgt); 09/09/10
10427 S1Uom = %trim(@s1uom); 09/09/10
10428 endif; 08/27/10
10429 endif; 08/27/10
10500
10600 postData =
10700 '<?xml version="1.0"?>' +
10800 '<AccessRequest xml:lang="en-US">' +
10900 '<AccessLicenseNumber>' +
11000 UPS_LICENSE +
11100 '</AccessLicenseNumber>' +
11200 '<UserId>' + UPS_USERID + '</UserId>' +
11300 '<Password>' + UPS_PASSWD + '</Password>' +
11400 '</AccessRequest>' +
11500 '<?xml version="1.0"?>' +
11501 '<RatingServiceSelectionRequest xml:lan="en-US">' + 08/31/10
11700 '<Request>' +
11800 '<TransactionReference>' +
11900 '<CustomerContext>' + 08/31/10
12000 'Rating and Service' + 08/27/10
12100 '</CustomerContext>' +
12200 '<XpciVersion>1.0001</XpciVersion>' +
12300 '</TransactionReference>' +
12400 '<RequestAction>Rate</RequestAction>' + 08/19/10
12500 '<RequestOption>Rate</RequestOption>' + 08/19/10
12600 '</Request>' +
12601 '<PickupType>' + 08/19/10
12602 '<Code>' + S1Ptyp + '</Code>' + 08/27/10
12603 '<Description>' + S1Pdes + '</Description>' + 08/27/10
12604 '</PickupType>' + 08/27/10
12606 '<Shipment>' + 08/31/10
12607 '<Description>Rate Description</Description>' + 08/31/10
12608 '<Shipper>' + 08/31/10
12609 '<Name>' + s1fnam + '</Name>' + 08/31/10
12610 '<PhoneNumber>' + s1Fphn + '</PhoneNumber>' + 08/31/10
12611 '<ShipperNumber>' + Shpnbr + '</ShipperNumber>' + 08/31/10
12612 '<Address>' + 08/31/10
12613 '<AddressLine1>' + s1Fad1 + '</AddressLine1>' + 08/31/10
12614 '<AddressLine2>' + s1Fad2 + '</AddressLine2>' + 08/31/10
12616 '<City>' + s1fcty + '</City>' + 08/31/10
12617 '<StateProvinceCode>' + 08/31/10
12618 S1Fstt + 08/31/10
12619 '</StateProvinceCode>' + 08/31/10
12620 '<PostalCode>' + s1fzip + '</PostalCode>' + 08/31/10
12621 '<CountryCode>' + S1Fcntry + '</CountryCode>' + 08/31/10
12623 '</Address>' + 08/31/10
12624 '</Shipper>' + 08/31/10
12625 '<Shipto>' + 08/31/10
12626 '<CompanyName>' + s1Snam + '</CompanyName>' + 08/31/10
12627 '<PhoneNumber>' + S1Sphn + '</PhoneNumber>' + 08/31/10
12628 '<Address>' + 08/31/10
12629 '<AddressLine1>' + s1Sad1 + '</AddressLine1>' + 08/31/10
12630 '<AddressLine2>' + s1Sad2 + '</AddressLine2>' + 08/31/10
12631 '<City>' + s1Scty + '</City>' + 08/31/10
12632 '<StateProvinceCode>' + 08/31/10
12633 S1Sstt + 08/31/10
12634 '</StateProvinceCode>' + 08/31/10
12635 '<PostalCode>' + s1Szip + '</PostalCode>' + 08/31/10
12636 '<CountryCode>' + S1Scntry + '</CountryCode>' + 08/31/10
12638 '</Address>' + 08/31/10
12639 '</Shipto>' + 08/31/10
12640 '<ShipFrom>' + 08/31/10
12641 '<CompanyName>' + s1Fnam + '</CompanyName>' + 08/31/10
12642 '<AttentionName>'+ s1Fnam + '</AttentionName>' + 08/31/10
12643 '<PhoneNumber>' + S1Fphn + '</PhoneNumber>' + 08/31/10
12644 '<FaxNumber>' + S1Ffax + '</FaxNumber>' + 08/31/10
12645 '<Address>' + 08/31/10
12646 '<AddressLine1>' + s1Fad1 + '</AddressLine1>' + 08/31/10
12647 '<City>' + s1Fcty + '</City>' + 08/31/10
12648 '<StateProvinceCode>' + 08/31/10
12649 S1Fstt + 08/31/10
12650 '</StateProvinceCode>' + 08/31/10
12651 '<PostalCode>' + s1Fzip + '</PostalCode>' + 08/31/10
12652 '<CountryCode>' + S1Fcntry + '</CountryCode>' + 08/31/10
12654 '</Address>' + 08/31/10
12655 '</ShipFrom>' + 08/31/10
12656 '<Service>' + 08/31/10
12657 '<Code>' + S1Srvcde + '</Code>' + 08/31/10
12658 '</Service>' + 08/31/10
12659 '<Package>' + 08/31/10
12660 '<PackagingType>' + 08/31/10
12661 '<Code>' + S1PkgTyp + '</Code>' + 08/31/10
12662 '<Description>' + S1PkgDes + '</Description>' + 08/31/10
12663 '</PackagingType>' + 08/31/10
12664 '<Description>Rate</Description>' + 08/31/10
12665 '<PackageWeight>' + 08/31/10
12666 '<UnitOfMeasurement>' + 08/31/10
12667 '<Code>' + S1Uom + '</Code>' + 08/31/10
12668 '</UnitOfMeasurement>' + 08/31/10
12669 '<Weight>' + S1wgt + '</Weight>' + 08/31/10
12670 '</PackageWeight>' + 08/31/10
12671 '</Package>' + 08/31/10
12672 '<ShipmentServiceOptions />' + 08/31/10
12673 '</Shipment>' + 08/31/10
12674 '</RatingServiceSelectionRequest>' ; 08/31/10
12900
13000 rc = http_url_post_xml('https://wwwcie.ups.com/ups.app/xml/Rate' 08/19/10
13100 : %addr(postData) + 2
13200 : %len(postData)
13300 : %paddr(StartOfElement)
13400 : %paddr(EndOfElement)
13500 : *NULL );
13600 if (rc <> 1);
13700 @filler = http_error(); 08/31/10
13800 // FIXME: REPORT ERROR TO USER
13900 *inlr = *on;
14000 return;
14001 endif; 09/07/10
14002 09/09/10
17900 /end-free
18100
18200 P StartOfElement B
18300 D StartOfElement PI
18400 D UserData * value
18500 D depth 10I 0 value
18600 D name 1024A varying const
18700 D path 24576A varying const
18800 D attrs * dim(32767)
18900 D const options(*varsize)
19000 /free
19002 09/09/10
19003 if path = '/RatingServiceSelectionResponse/RatedShipment' + 09/09/10
19004 '/TransportacionCharges' and name='CurrencyCode'; 09/09/10
19203 act = act + 1; 08/31/10
19400 endif;
19500
19600 /end-free
19700 P E
19800
20000 P EndOfElement B
20100 D EndOfElement PI
20200 D UserData * value
20300 D depth 10I 0 value
20400 D name 1024A varying const
20500 D path 24576A varying const
20600 D value 65535A varying const
20700 D attrs * dim(32767)
20800 D const options(*varsize)
20900 /free
21000
21100 select;
21101 09/09/10
21102 when path = '/RatingServiceSelectionResponse/RatedShipment' + 09/09/10
21103 '/TransportacionCharges'; 09/09/10
21108 09/09/10
21400 select;
21500 when name = 'CurrencyCode'; 09/09/10
21600 @UPSTCUR = value; 09/09/10
21700 when name = 'MonetaryValue'; 09/09/10
21800 @UPSTCHG = value; 09/09/10
21900 endsl;
22000
22002 when path = '/RatingServiceSelectionResponse/RatedShipment' + 09/09/10
22003 '/ServiceOptionsCharges'; 09/09/10
22004 09/09/10
22400 select;
22500 when name = 'CurrencyCode'; 09/09/10
22600 @UPSSCUR = value; 09/09/10
22700 when name = 'MonetaryValue'; 09/09/10
22800 @UPSSCHG = value; 09/09/10
22900 endsl;
23000
23002 when path = '/RatingServiceSelectionResponse/RatedShipment' + 09/09/10
23003 '/TotalCharges'; 09/09/10
23300
23400 select;
23500 when name = 'CurrencyCode'; 09/09/10
23600 @UPSDCUR = value; 09/09/10
23700 when name = 'MonetaryValue'; 09/09/10
23800 @UPSDCHG = value; 09/09/10
23900 endsl;
24700
24800 endsl;
24900
25000 /end-free
25100 P E
* * * * E N D O F S O U R C E * * * *
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------