none
application.importxml hitting the api server three times everytime I make the call RRS feed

  • Question

  • I have an app that goes out to an API server and requests new orders. The API people tell me that everytime I issue the command their server recieves three requests all within a second of each other. This code is not in a loop, it just runs once. It seems that it must be retrying three times.  Anyone ever run into this before? is there registry entries I could modify to make it not do this. Here is my one line of code. This is attached to a button labeled, "Get New Orders". The user clicks the button, it runs this code.

        Application.ImportXML PathToApiServer, acAppendData


    I do not receive three xml files, I just receive 1.  Almost seems that the first two fail and the third one is responded to. But this all happens in less than a second.
    • Edited by BrianCole25 Tuesday, March 15, 2016 4:39 PM
    Tuesday, March 15, 2016 4:34 PM

Answers

  • >>>I do not receive three xml files, I just receive 1.  Almost seems that the first two fail and the third one is responded to. But this all happens in less than a second.

    According to your description  if you save the XML as a local file, you can use Access' Application.ImportXML Method. you could open the XML as a MSXML DOMDocument and use its methods to extract only the values you want, then store them in your table. That approach does work with either a URL or a local file.

    In addition this issue is possible to relate to API Server, so I suggest that you could contact API Server developers to seek help.
    • Marked as answer by David_JunFeng Thursday, March 24, 2016 8:53 AM
    Wednesday, March 16, 2016 2:24 AM

All replies

  • >>>I do not receive three xml files, I just receive 1.  Almost seems that the first two fail and the third one is responded to. But this all happens in less than a second.

    According to your description  if you save the XML as a local file, you can use Access' Application.ImportXML Method. you could open the XML as a MSXML DOMDocument and use its methods to extract only the values you want, then store them in your table. That approach does work with either a URL or a local file.

    In addition this issue is possible to relate to API Server, so I suggest that you could contact API Server developers to seek help.
    • Marked as answer by David_JunFeng Thursday, March 24, 2016 8:53 AM
    Wednesday, March 16, 2016 2:24 AM
  • This is where Fiddler by Telerik comes in: It can look at your html stream and you can see in detail what's happening.

    -Tom. Microsoft Access MVP

    Wednesday, March 16, 2016 4:08 AM
  • Thank you for the pointing out fiddler.  It does show that the one line of code.  I have replaced the url with URL because my account has not been verified yet and I cannot post links.

        Application.ImportXML "URL=" & mvendorid & "&orderid=" & morderid & "&weight=" & mWeight & "&format=PDF&hash=" & MD5_string(mvendorid & morderid & mWeight & "PDF" & msecuritykey), acAppendData

    is making three requests.  The issue now is how do I make it make one request? are there any registry entries that deal with this?  below is the fiddler log

    GET URL

    HTTP/1.1
    Accept: */*
    Referer: URL

    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; InfoPath.3; .NET4.0C; .NET4.0E; GWX:MANAGED)
    Host: vendor.zazzle.com
    Connection: Keep-Alive


    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Type: text/html
    Server: Microsoft-IIS/8.0
    Set-Cookie: ASP.NET_SessionId=5hi350ztrbb10ej02lc01ta5; path=/; HttpOnly
    Access-Control-Allow-Origin: *
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Date: Thu, 17 Mar 2016 15:04:35 GMT
    Content-Length: 951
    Set-Cookie: NSC_wfoeps-ttm=ffffffff0909d83045525d5f4f58455e445a4a423660;expires=Thu, 17-Mar-2016 15:06:35 GMT;path=/;secure;httponly

    <?xml version="1.0" encoding="utf-8"?>
    <Response>
      <Status>
        <Code>SUCCESS</Code>
        <Info />
      </Status>
      <Result><ShippingInfo>
      <Carrier>UPS</Carrier>
      <Method>UPS Express Saver</Method>
      <TrackingNumber>1ZE6372R0450053821</TrackingNumber>
      <Weight>1</Weight>
      <ShippingDocuments>
        <ShippingDocument>
          <Type>Label</Type>
          <Format>PDF</Format>
          <Url>https://vendor.zazzle.com/v100/api.aspx?method=getshippingdocument&amp;tracking=1ZE6372R0450053821&amp;type=1&amp;hash=bd192bb864e1ea7cc1f90d6bc29e1d56&amp;page=0</Url>
        </ShippingDocument>
        <ShippingDocument>
          <Type>CommercialInvoice</Type>
          <Format>PDF</Format>
          <Url>https://vendor.zazzle.com/v100/api.aspx?method=getshippingdocument&amp;tracking=1ZE6372R0450053821&amp;type=2&amp;hash=8271e8c70c99b6a0159ed6c2ab22c718&amp;page=0</Url>
        </ShippingDocument>
      </ShippingDocuments>
    </ShippingInfo></Result>
    </Response>

    ------------------------------------------------------------------

    GET URLHTTP/1.1
    Accept: */*
    Referer: URL

    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; InfoPath.3; .NET4.0C; .NET4.0E; GWX:MANAGED)
    Host: vendor.zazzle.com
    Connection: Keep-Alive
    Cookie: ASP.NET_SessionId=5hi350ztrbb10ej02lc01ta5


    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Length: 951
    Content-Type: text/html
    Server: Microsoft-IIS/7.5
    X-AspNet-Version: 4.0.30319
    Access-Control-Allow-Origin: *
    X-Powered-By: ASP.NET
    Date: Thu, 17 Mar 2016 15:04:37 GMT
    Set-Cookie: NSC_wfoeps-ttm=ffffffff0909d83145525d5f4f58455e445a4a423660;expires=Thu, 17-Mar-2016 15:06:37 GMT;path=/;secure;httponly

    <?xml version="1.0" encoding="utf-8"?>
    <Response>
      <Status>
        <Code>SUCCESS</Code>
        <Info />
      </Status>
      <Result><ShippingInfo>
      <Carrier>UPS</Carrier>
      <Method>UPS Express Saver</Method>
      <TrackingNumber>1ZE6372R0450053830</TrackingNumber>
      <Weight>1</Weight>
      <ShippingDocuments>
        <ShippingDocument>
          <Type>Label</Type>
          <Format>PDF</Format>
          <Url>https://vendor.zazzle.com/v100/api.aspx?method=getshippingdocument&amp;tracking=1ZE6372R0450053830&amp;type=1&amp;hash=c5ab4f48915351234af88cb72da68bc3&amp;page=0</Url>
        </ShippingDocument>
        <ShippingDocument>
          <Type>CommercialInvoice</Type>
          <Format>PDF</Format>
          <Url>https://vendor.zazzle.com/v100/api.aspx?method=getshippingdocument&amp;tracking=1ZE6372R0450053830&amp;type=2&amp;hash=7c4f438e12b0f00caa00dd910bb9e1ad&amp;page=0</Url>
        </ShippingDocument>
      </ShippingDocuments>
    </ShippingInfo></Result>
    </Response>

    ------------------------------------------------------------------

    GET URL

    HTTP/1.1
    Accept: */*
    Referer: URL

    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; InfoPath.3; .NET4.0C; .NET4.0E; GWX:MANAGED)
    Host: vendor.zazzle.com
    Connection: Keep-Alive
    Cookie: ASP.NET_SessionId=5hi350ztrbb10ej02lc01ta5


    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Type: text/html
    Server: Microsoft-IIS/8.0
    Access-Control-Allow-Origin: *
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Date: Thu, 17 Mar 2016 15:04:38 GMT
    Content-Length: 951
    Set-Cookie: NSC_wfoeps-ttm=ffffffff0909d83045525d5f4f58455e445a4a423660;expires=Thu, 17-Mar-2016 15:06:38 GMT;path=/;secure;httponly

    <?xml version="1.0" encoding="utf-8"?>
    <Response>
      <Status>
        <Code>SUCCESS</Code>
        <Info />
      </Status>
      <Result><ShippingInfo>
      <Carrier>UPS</Carrier>
      <Method>UPS Express Saver</Method>
      <TrackingNumber>1ZE6372R0450053849</TrackingNumber>
      <Weight>1</Weight>
      <ShippingDocuments>
        <ShippingDocument>
          <Type>Label</Type>
          <Format>PDF</Format>
          <Url>https://vendor.zazzle.com/v100/api.aspx?method=getshippingdocument&amp;tracking=1ZE6372R0450053849&amp;type=1&amp;hash=57aee94b1d7dcd9cb10011d7c40fc46c&amp;page=0</Url>
        </ShippingDocument>
        <ShippingDocument>
          <Type>CommercialInvoice</Type>
          <Format>PDF</Format>
          <Url>https://vendor.zazzle.com/v100/api.aspx?method=getshippingdocument&amp;tracking=1ZE6372R0450053849&amp;type=2&amp;hash=5a592d0badc720882133b7bb135d38ad&amp;page=0</Url>
        </ShippingDocument>
      </ShippingDocuments>
    </ShippingInfo></Result>
    </Response>

    ------------------------------------------------------------------

    Thursday, March 17, 2016 3:13 PM
  • That is an interesting problem. Sorry I don't have a lot of time to delve into it. My first instinct is to use XMLHTTP library and issue the call myself, rather than relying on the "higher-level" Access call.

    -Tom. Microsoft Access MVP

    Friday, March 18, 2016 4:13 AM