Getting time in transit from UPS via HTTP Post

grfgrf Member Posts: 10
Hello all,

We have been trying to communicate with the UPS website to get time in transit information. This calls for sending a xml doc with HTTP Post. We have been using Microsoft XML, v5.0 to post the doc, but here is the problem: The XML doc is made up of two xml docs that are concatenated. The first one contains login info and the second the inquiry. The question is, does anyone know how two concatenate the two docs to get a legal xml doc in navision? Or better still, is there another automation that can handle this?

Comments

  • ara3nara3n Member Posts: 9,257
    You can split the file in navision into two file and process them separately. You have to search for a string and store the data in a second file and process the files separately.
    If a xml document doesn't have a root then it is not realy a proper xml document.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • grfgrf Member Posts: 10
    I´ve tried to do this manually, create the two files and add them. It seems that the automation does not accept the document on this form. If I send one of the docs it goes through ok but an error comes up if a file containing the two is sent.
  • DenSterDenSter Member Posts: 8,307
    You could build one XML doc while browsing two others. So you create doc 1, you loop through doc A and copy nodes into doc 1. Then when you're done with doc A you start doc B and copy its nodes into doc 1. As long as you make sure doc 1 is well formed XML you should be fine.
  • grfgrf Member Posts: 10
    The request has to be of the following form:
    <?xml version="1.0"?>
    <AccessRequest xml:lang="en-US">
    <AccessLicenseNumber>LN</AccessLicenseNumber>
    <UserId>Usr</UserId>
    <Password>Pswd</Password>
    </AccessRequest>
    <?xml version="1.0"?>
    <TimeInTransitRequest xml:lang="en-US">
    ...
    </TimeInTransitRequest>

    I get an error when trying to send this kind of document with XMLHTTP.send. It seems that when sending the xml doc is validated.

    Is there any other ocx out there that can handle the Http POST?
  • DenSterDenSter Member Posts: 8,307
    Well you get an error, because that is not well formed XML, and any parser out there will rightfully error out. They might CALL it XML, but it is really just a string that LOOKS like XML.

    There is only supposed to be ONE root element, and you have two of those (AccessRequest and TimInTransitRequest). If you could put all of that into one big root element you would be ok, although I am not quite sure about having more than one XML declaration in one document.
Sign In or Register to comment.