Search code examples
ebay-api

findItemsAdvanced suddenly failing with: The connection with the server was terminated abnormally


I wrote some API calls in VBA a few years ago and they've been working fine up until recently when one call started to fail.

Here's the code I'm using:

    Set req = CreateObject("WinHttp.WinHttpRequest.5.1")
    With req
        .Open "POST", "http://svcs.ebay.com/services/search/FindingService/v1", False
        .setRequestHeader "X-EBAY-SOA-SERVICE-NAME", "FindingService"
        .setRequestHeader "X-EBAY-SOA-OPERATION-NAME", "findItemsAdvanced"
        .setRequestHeader "X-EBAY-SOA-SECURITY-APPNAME", "MY_APP_NAME"
        .setRequestHeader "X-EBAY-SOA-SERVICE-VERSION", "1.0.0"
        .setRequestHeader "X-EBAY-SOA-GLOBAL-ID", "EBAY-US"
        .setRequestHeader "X-EBAY-SOA-REQUEST-DATA-FORMAT", "XML"
    End With
    req.Send(myXML)

Here's an example of the XML I'm using...

myXML = "<?xml version="1.0" encoding="utf-8"?><findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/search/v1/services"><paginationInput><pageNumber>1</pageNumber><entriesPerPage>100</entriesPerPage></paginationInput><itemFilter><name>HideDuplicateItems</name><value>true</value></itemFilter><itemFilter><name>Seller</name><value>SELLER_NAME</value></itemFilter><keywords>"EXAMPLE OF SEARCH TERMS"</keywords><sortOrder>EndTimeSoonest</sortOrder></findItemsAdvancedRequest>"

However, I don't think the XML is really even relevant since it doesn't appear to be getting to that point. It's just rejecting the connection (it appears).

The error is: "The connection with the server was terminated abnormally."

It occurs when I run req.Send(myXML).

So far as I know, nothing has changed (the code certainly hasn't). The other API calls that I use (GetMultipleItems and GetSingleItem on open.api.ebay.com/shopping) are still working just fine. The error started occasionally popping up earlier in the year, but then became persistent in April and hasn't gone away since.

I've tried a different app name from a different developer account with the same results.

The most common solution mentioned for this error is an issue with TLS in VBA on Win7 machines:

WinHTTP - The connection with the server was terminated abnormally

However, every machine I've tested this on has been Win10. I also ran a check to see which protocol my connections are using, and it said TLS 1.2, so I'm already on the necessary protocol (so far as I know). Just in case, I implemented the reg hacks needed to fix the issue on Win7 and it did nothing (as you'd expect).

eBay support was useless and their forum is so bad I can hardly log in half the time, and the post I tried to put up there isn't even showing up, so here I am.


Solution

  • Well, it ends up that I wasn't using any security protocol at all (TLS or otherwise). I hadn't even noticed that the URL starts with "http:", which apparently was just fine up until a couple months ago, but they must have changed it recently to require secure http connections for all API calls. I changed the URL to "https:" and it started working again.