if(val(attributes.timeout) LTE 0) { attributes.timeout = 45; } USPS = QueryNew('Service,Postage,SvcCommitments'); pounds = int(attributes.pounds); if (FindNoCase('.',attributes.pounds)) { ounces = right(attributes.pounds,len(attributes.pounds) - FindNoCase('.',attributes.pounds)); ounces = round(ounces*0.16); } else { ounces = 0; } if (attributes.country EQ 'USA') { // build the XMLstr for domestic rates services = '#attributes.service#'; APIstr = 'Rate'; XMLstr = ''; for (i = 0; i LT ListLen(services); i = i+1) { XMLstr = XMLstr & ' #ListGetAt(services,i+1)# #attributes.origzip# #attributes.destzip# #pounds# #ounces# #attributes.Container# #attributes.Size# #attributes.Machinable# '; } XMLstr = XMLstr & ''; } else { // build the XMLstr for International rates services = 'PACKAGE'; APIstr = 'IntlRate'; XMLstr = ''; for (i = 0; i LT ListLen(services); i = i+1) { XMLstr = XMLstr & ' #pounds# #ounces# #ListGetAt(services,i+1)# #Attributes.country# '; } XMLstr = XMLstr & ''; }

Request

#htmleditformat(XMLstr)#

Response

#htmleditformat(CFHTTP.FileContent)#
if (attributes.country EQ 'USA') { startChar = FindNoCase("", XMLResp); if (startChar GT 0) { while (FindNoCase("", XMLResp, startChar) GT 0) { // insert new row into query temp = QueryAddRow(USPS); // get service tempval = find("", XMLResp, startChar); tempval = tempval + 9; tempval2 = find("", XMLResp, startChar); lentoget = tempval2 - tempval; service = mid(XMLResp, tempval, lentoget); temp = QuerySetCell(USPS,'Service',service); // get postage tempval = find("", XMLResp, startChar); tempval = tempval + 9; tempval2 = find("", XMLResp, startChar); lentoget = tempval2 - tempval; postage = mid(XMLResp, tempval, lentoget); temp = QuerySetCell(USPS,'Postage',postage); startChar = FindNoCase("", XMLResp, startchar + 8); if (startChar EQ 0) { break; } } } } else { startChar = FindNoCase("", XMLResp); if (startChar GT 0) { while (FindNoCase("", XMLResp, startChar) GT 0) { // get postage tempval = find("", XMLResp, startChar); tempval = tempval + 9; tempval2 = find("", XMLResp, startChar); lentoget = tempval2 - tempval; postage = mid(XMLResp, tempval, lentoget); // get SvcCommitments tempval = find("", XMLResp, startChar); tempval = tempval + 16; tempval2 = find("", XMLResp, startChar); lentoget = tempval2 - tempval; SvcCommitments = mid(XMLResp, tempval, lentoget); // get SvcDescription tempval = find("", XMLResp, startChar); tempval = tempval + 16; tempval2 = find("", XMLResp, startChar); lentoget = tempval2 - tempval; SvcDescription = mid(XMLResp, tempval, lentoget); if (attributes.service EQ 'GBLEXPGUA'){ theService = "Global Express Guaranteed Non-Document Service"; } else if (attributes.service EQ 'GBLEXPMAIL'){ theService = "Global Express Mail (EMS)"; } else { theService = "NA"; }; if (trim(SvcDescription) EQ trim(theService)) { // insert new row into query temp = QueryAddRow(USPS); temp = QuerySetCell(USPS,'Postage',postage); temp = QuerySetCell(USPS,'SvcCommitments',SvcCommitments); temp = QuerySetCell(USPS,'Service',REPLACE(SvcDescription, "Non-Document Service", "", "All")); } startChar = FindNoCase("", XMLResp, startchar + 8); if (startChar EQ 0) { break; } } } } caller.USPS = USPS;