Results 1 to 16 of 16
  1. #1
    Kabiraa is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Question Error working with UPS/FedEx Shipping API..

    Hello there..

    Anyone out there have any idea about working with Shipping APIs of UPS/FedEx?

    Well, I have created my own module of generating the Shipping Rates by using the UPS/FedEx Shipping APIs ( sending request xml to their server & getting ship rates contained in the response xml ).

    Now, I am having problems with sending the request xml to their server. So, if anyone has any idea about this then please help me to solve my problem..

    Reply ASAP...

    Thanks..

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Can you elaborate on "having problems"?
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #3
    Kabiraa is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Default

    Thanks for reply..

    Well, I have created a simple application for generating Shipping Rates from Ups servers...earlier i was working with the simple request xml passing only zipFrom, zipTo, & weight to the server & getting back the shipping rate...
    But now, i want to add the dimension parameters as well, to this request xml to get the rate more precisely...here, i tried to add the dimensional part to the xml but the response xml sent the error message:

    UPS Response Error : "Missing/Illegal Combination of Package/Dimensions"

    I dont know what wrong is happening there...so, need your help in this...

    btw, here is my UPS Request XML:

    Java Code:
    ...
       <?xml version=\"1.0\"?>
        <RatingServiceSelectionRequest xml:lang=\"en-US\">
         <Request>
          <TransactionReference>
           <CustomerContext>Rating and Service</CustomerContext>
           <XpciVersion>1.0001</XpciVersion>
          </TransactionReference>
          <RequestAction>Rate</RequestAction>
          <RequestOption>Shop</RequestOption>
         </Request>
         <PickupType>
          <Code>01</Code>
         </PickupType>
         <Shipment>
          <Shipper>
           <ShipperNumber>" + UPSAccount + "</ShipperNumber>
           <Address>
            <PostalCode>" + zipFrom + "</PostalCode>
           </Address>
          </Shipper>
          <ShipTo>
           <Address>
            <PostalCode>" + zipTo + "</PostalCode>
           </Address>
          </ShipTo>
          <Package>
           <PackagingType>
            <Code>02</Code>
            <Description>Package</Description>
           </PackagingType>
           <Dimensions>
            <UnitOfMeasurement>
             <Code>IN</Code>
            </UnitOfMeasurement>
            <Length>" + length + "</Length>
            <Width>" + width + "</Width>
            <Height>" + height + "</Height>
           </Dimensions>
           <Description>Rate Shipping</Description>
           <PackageWeight>
            <UnitOfMeasurement>
             <Code>LBS</Code>
            </UnitOfMeasurement>
            <Weight>" + weight + "</Weight>
           </PackageWeight>
          </Package>
         </Shipment>
        </RatingServiceSelectionRequest>
    ...

  4. #4
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    And where is their API documentation located?
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  5. #5
    Kabiraa is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Default

    sorry, i dont get you question.!!

    location of API Documentation means the server URL where i send request?

    if yes, then the server url is "https://wwwcie.ups.com/upc.xml/Rate".

    if no, then i dont know the exactly where the documentation is located...
    i just google searched for the UPS Request xml, & used one of these xml as a reference...

    can you have any idea about why my xml (shown in the CODE) is giving error with Dimensions?

  6. #6
    Kabiraa is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Default

    For Your Information..

    The response xml gives error only if i add <Dimensions> tag to the request xml.
    If i omit the <Dimensions> tag, then the response xml gives the appropriate Ship Rate value...

  7. #7
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    I see you've cross-posted at Error While Adding Dimensional Values to the UPS/FedEx Shipping Rate Request XML | Ubercart

    I can't find any documentation either, just numerous php examples. You are sure you're generating valid xml? I can't see the code around you posted example, but strings don't usually continue over line breaks.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  8. #8
    Kabiraa is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Default

    Yes, it works fine for me, but only when i omit the "<Dimensions>" part out of this xml..
    If I dont write the <Dimensions> part, then this xml works fine; it replies back with the appropriate shipping rates...But when i include the <Dimensions> part to this xml, the reply comes with the error message "Missing/Illegal Combination of Package/Dimensions"

    So, this is the scenario...

    Now, if you or anyone have any idea whats wrong with this / know any other example of request xml which works fine with Dimensions then please let me know...

    BTW, here is my complete code that creates the request xml for passing it to UPS Server.

    Java Code:
    ...
    
        StringBuffer upsShipRateRequest = new StringBuffer("<?xml version=\"1.0\"?>\n");
    
        upsShipRateRequest.append("<RatingServiceSelectionRequest xml:lang=\"en-US\">\n");
        upsShipRateRequest.append("<Request>\n");
        upsShipRateRequest.append(" <TransactionReference>\n");
        upsShipRateRequest.append("  <CustomerContext>Rating and Service</CustomerContext>\n");
        upsShipRateRequest.append("  <XpciVersion>1.0001</XpciVersion>\n");
        upsShipRateRequest.append(" </TransactionReference>\n");
        upsShipRateRequest.append(" <RequestAction>Rate</RequestAction>\n");
        upsShipRateRequest.append(" <RequestOption>Shop</RequestOption>\n");
        upsShipRateRequest.append("</Request>\n");
        upsShipRateRequest.append("<PickupType>\n");
        upsShipRateRequest.append(" <Code>01</Code>\n");
        upsShipRateRequest.append("</PickupType>\n");
        upsShipRateRequest.append("<Shipment>\n");
        upsShipRateRequest.append(" <Shipper>\n");
        upsShipRateRequest.append("  <ShipperNumber>" + UPSAccount + "</ShipperNumber>\n");
        upsShipRateRequest.append("  <Address>\n");
        upsShipRateRequest.append("   <PostalCode>" + zipFrom + "</PostalCode>\n");
        upsShipRateRequest.append("  </Address>\n");
        upsShipRateRequest.append(" </Shipper>\n");
        upsShipRateRequest.append(" <ShipTo>\n");
        upsShipRateRequest.append("  <Address>\n");
        upsShipRateRequest.append("   <PostalCode>" + zipTo + "</PostalCode>\n");
        upsShipRateRequest.append("  </Address>\n");
        upsShipRateRequest.append(" </ShipTo>\n");
        for (int i = 0; i < Integer.parseInt(quantity); i++) {
          upsShipRateRequest.append(" <Package>\n");
          upsShipRateRequest.append("  <PackagingType>\n");
          upsShipRateRequest.append("	 <Code>02</Code>\n");
          upsShipRateRequest.append("   <Description>Package</Description>\n");
          upsShipRateRequest.append("	</PackagingType>\n");
          upsShipRateRequest.append("  <Dimensions>\n");
          upsShipRateRequest.append("   <UnitOfMeasurement>\n");
          upsShipRateRequest.append("    <Code>IN</Code>\n");
          upsShipRateRequest.append("   </UnitOfMeasurement>\n");
          upsShipRateRequest.append("   <Length>" + length + "</Length>\n");
          upsShipRateRequest.append("   <Width>" + width + "</Width>\n");
          upsShipRateRequest.append("   <Height>" + height + "</Height>\n");
          upsShipRateRequest.append("  </Dimensions>\n");
          upsShipRateRequest.append("	<Description>Rate Shipping</Description>\n");
          upsShipRateRequest.append("	<PackageWeight>\n");
          upsShipRateRequest.append("	 <UnitOfMeasurement>\n");
          upsShipRateRequest.append("    <Code>LBS</Code>\n");
          upsShipRateRequest.append("   </UnitOfMeasurement>\n");
          upsShipRateRequest.append("	 <Weight>" + weight + "</Weight>\n");
          upsShipRateRequest.append("	</PackageWeight>\n");
          upsShipRateRequest.append(" </Package>\n");
        }
        upsShipRateRequest.append(" </Shipment>\n");
        upsShipRateRequest.append("</RatingServiceSelectionRequest>");
    
    ...

  9. #9
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default A shot in the dark...

    I'm not an expert... so if I say something stupid, just ignore it...
    Java Code:
          upsShipRateRequest.append("  [COLOR="Blue"]<Dimensions>[/COLOR]\n");
          upsShipRateRequest.append("   <UnitOfMeasurement>\n");
          upsShipRateRequest.append("    <Code>IN</Code>\n");
          upsShipRateRequest.append("   </UnitOfMeasurement>\n");
          upsShipRateRequest.append("   <Length>" + length + "</Length>\n");
          upsShipRateRequest.append("   <Width>" + width + "</Width>\n");
          upsShipRateRequest.append("   <Height>" + height [COLOR="Red"][B][SIZE="2"]+[/SIZE][/B][/COLOR] "</Height>\n");
          upsShipRateRequest.append("  <[COLOR="blue"]/Dimensions>[/COLOR]\n");
    I'm assuming that dimensions is a field by itself, so is there supposed to be something else added after the red plus sign above? If not, maybe that plus sign is creating static ....

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  10. #10
    Kabiraa is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Default

    Quote Originally Posted by CJSLMAN View Post
    I'm not an expert... so if I say something stupid, just ignore it...
    Java Code:
          upsShipRateRequest.append("  [COLOR="Blue"]<Dimensions>[/COLOR]\n");
          upsShipRateRequest.append("   <UnitOfMeasurement>\n");
          upsShipRateRequest.append("    <Code>IN</Code>\n");
          upsShipRateRequest.append("   </UnitOfMeasurement>\n");
          upsShipRateRequest.append("   <Length>" + length + "</Length>\n");
          upsShipRateRequest.append("   <Width>" + width + "</Width>\n");
          upsShipRateRequest.append("   <Height>" + height [COLOR="Red"][B][SIZE="2"]+[/SIZE][/B][/COLOR] "</Height>\n");
          upsShipRateRequest.append("  <[COLOR="blue"]/Dimensions>[/COLOR]\n");
    I'm assuming that dimensions is a field by itself, so is there supposed to be something else added after the red plus sign above? If not, maybe that plus sign is creating static ....

    Luck,
    CJSL
    Well, my posted code creates the xml file..so the line "upsShipRateRequest.append("<Dimensions>\n");" just creates a node <Dimensions> in the xml...

    Now, talking about "+" sign...as you can see, the variable upsShipRateRequest is an instance of StringBuffer...So, as per the String class rules, "+" sign is used for the concatenation...So, there is nothing like "+" is creating static or something like that...its just a concatenation sign...nothing else...

  11. #11
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Maybe UPS just doesn't like the values you are giving. Have you tried with different numbers?
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  12. #12
    Kabiraa is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Default

    Quote Originally Posted by OrangeDog View Post
    Maybe UPS just doesn't like the values you are giving. Have you tried with different numbers?
    Well, here I am passing the following values for Dimensions..
    Length : 60
    Width : 200
    Height : 100

    & the Unit of measurement is as stated under <UnitOfMeasurement> tag ( i.e "IN").

    So, I dont find UPS should have any problems with these values..

  13. #13
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    So you haven't tried with different numbers? Or checked UPS guides for allowable dimension/weight combinations?
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  14. #14
    eimajenthat is offline Member
    Join Date
    Aug 2009
    Posts
    1
    Rep Power
    0

    Default

    I know this is a dead post, but I Googled my way to it, and I thought someone else might do the same. Plus, I was excited to find a question to which I knew the answer. The UPS package dimension guidelines are here:
    ups.com/content/us/en/resources/ship/packaging/weight_size.html

    # Packages can be up to 165 inches (419 cm) in length and girth combined.
    # Packages can be up to 108 inches (270 cm) in length.

    I think since it's a cardboard box, that the length, width, girth, etc. are interchangeable. So, if any two dimensions are over 165 inches, or if any one dimension is over 108 inches, you've got a problem.

    So, 200 inches is an invalid dimension. I had to think about it for a sec, because I'm not so bright, but that's over 16 feet! The poor UPS driver would have a hell of a time getting that thing on and off his truck, if it would even fit.

    Sounds like the code is working just fine. Yay!

  15. #15
    mpiparo is offline Member
    Join Date
    Nov 2009
    Posts
    1
    Rep Power
    0

    Default decimal precision

    Also, be sure to check decimal precision carefully. Dimension data is limited to 2 decimal places, more than (even if 0s as i discovered) causes the error as well.
    Package Weight has a 1 decimal precision, however looks like it accepts more without causing error.. ???

  16. #16
    srinis is offline Member
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Default UPS rates response help needed.

    Quote Originally Posted by Kabiraa View Post
    Hello there..

    Anyone out there have any idea about working with Shipping APIs of UPS/FedEx?

    Well, I have created my own module of generating the Shipping Rates by using the UPS/FedEx Shipping APIs ( sending request xml to their server & getting ship rates contained in the response xml ).

    Now, I am having problems with sending the request xml to their server. So, if anyone has any idea about this then please help me to solve my problem..

    Reply ASAP...

    Thanks..
    Hello Kabiraa,
    Looks like you have had some success in finding the UPS response rates back, I'm trying to do the same- I have a Java program that creates an xml document and posts it to UPS servers, however i do not have much luck on the returns back. I'd be interested to know how you are establishing the connection to the UPS servers? In other words, How does your access request section of the request looks like? I have included mine, please suggest if you have any suggestions.
    thx.
    public static Document accessRequest() throws Exception {
    Calendar cal = Calendar.getInstance();
    Document document = DocumentHelper.createDocument();
    Element root = document.addElement("AccessRequest")
    .addNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")
    .addAttribute("xsi:noNamespaceSchemaLocation", "AccessRequest.xsd");

    //***********************Access Request******************
    Element accessRequest = root.addElement("AccessRequest");

    Element accessLicenseNumber = accessRequest.addElement("AccessLicenseNumber").ad dText("9C522122732149BC");
    Element userId = accessRequest.addElement("UserId").addText("xxxxxx x");
    Element password = accessRequest.addElement("Password").addText("xxxx xxxx");
    //***********************Access Request******************
    return document;
    }

Similar Threads

  1. Replies: 3
    Last Post: 01-23-2009, 08:53 AM
  2. working with splitpanes
    By masa in forum AWT / Swing
    Replies: 3
    Last Post: 12-19-2008, 06:13 PM
  3. Replies: 8
    Last Post: 05-28-2008, 07:00 AM
  4. Working around paintcomponent
    By sahhhm in forum New To Java
    Replies: 2
    Last Post: 05-16-2008, 02:43 AM
  5. Working With ANT
    By JavaForums in forum Eclipse
    Replies: 0
    Last Post: 04-26-2007, 08:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •