With Tradebox connected to a Magento webstore, you may run into the error 'The following error occurred when connecting to Magento: The underlying connection was closed' or similar. There are a number of possible causes for this, such as Tradebox using incorrect credentials or being unable to get past security protocols on your webstore to access the data.
In layman's terms think of your Magento site as a house that Tradebox is trying to let itself into. This error tells us Tradebox is pushing the door to find it's locked but we don't know whether we're using the wrong key, or it's bolted from the inside, or we've got the wrong door number.
Check your credentials
Tradebox uses three credentials to get to your Magento orders. The API URL, the API username, and the API Password (also called an API Key). If you're setting up a new channel, you'll need to enter these during the new sales channel setup wizard. In an existing channel, you can see and edit them by going to Information > Sales Channels and double-clicking the Magento channel.
Note - setting up a new sales channel often makes it easier to test connection problems, as the new channel wizard features the Test Connection option. Even if you're troubleshooting an existing previously-working channel, you can troubleshoot using the new channel wizard if you have a spare channel slot on your licence.
API Username and Password
You're in control of the username and password that Tradebox uses to access your Magento via API, as well as the Role (what that username has permission to do). If you experience this error with a connection that previously worked, your first step should be to rule out a user-specific problem by setting up a new role and user (pages 4-6), and trying these.
The API URL is determined by the URL of your webstore. If your customers go to www.example.com, your API URL will be some variant of www.example.com/api/xmlrpc.
Note that the API suffix may be on a subdomain (e.g. www.example.com/store/index.php/api/xmlrpc), if you're unsure then check with your web developer or site host.
There are four variants to try when troubleshooting a connection:
Try each variant in turn, regardless whether your site shows as http or https when viewed in a web browser.
Does the URL contain the XML information?
If you enter the API URL into a web browser, you should see the XML document tree as in the below screenshot. Your site may or may not prompt for your credentials first, if it does then make sure you use the username and password that you've set up for Tradebox...remember, if you can't see the information with that logon, Tradebox won't be able to either.
Don't be alarmed if you see a 630 fault when viewing with a web browser, that's normal. The fact that we can see the XML code lets us know we're looking in the right place.
If you can't see the XML or you get a message through your web browser like connection timed out or page not available check with your web developer or site host that you've got the correct URL.
If you have the correct URL but the XML is still not visible, that suggests something is blocking your connection. Trying the same address from another computer accessing the internet through the same router will let you know if you've got a machine-specific problem or if it's wider than that.
I can't see the XML in my web browser
If you're confident you've got the right URL, try from a different PC. If nobody can see the XML, try the rest of your website - if the entire site www.example.com is down, then the Magento orders stored on the back end of that site will also be inaccessible until the problem is resolved. If the rest of your site is fine but the XML page is not present, that suggests a problem with Magento, so you should refer to your developer.
If however, you can see the XML from another PC but not from the one you run Tradebox on, that suggests a PC-specific connection issue. If other PC's on your network/running through the same router also can't see your site/XML, but this is accessible elsewhere (we're happy to check access from our location) that suggests an IP-specific connection issue.
I can see the XML in a web browser on the same PC but Tradebox still generates the error
At this point it's best to test from Tradebox on another PC. If you've only got one install, we're happy to test from our end so raise a support request to firstname.lastname@example.org and we'll be able to assist. If we know the XML information is in place, we've ruled out credentials and Tradebox still can't connect from any PC, that suggests an issue with security protocols. Ask your web developer to make sure your Magento site has enabled TLS 1.0 and TLS 1.1 encryption. We've had users resolve this problem by moving their Magento store to a different server so ask your developer if that's possible. If the error persists it's also worth searching the web for that specific error - the error is returned by Magento's API and isn't specific to Tradebox; there are resources online with more expertise in security protocols than ourselves and these should help your developer to find the root cause.
PC-specific connection issues
Troubleshooting connection issues on a PC will mean making some changes that will temporarily make your PC less secure, and others that may impact on other programs that use the internet (e.g. your web browser or email program). Changes like these will require a Windows logon with Administrator privileges. Making any security changes a temporary measure purely whilst troubleshooting will help control the risk; however we provide the following purely as information to aid you in resolving a problem. If you're concerned about security or about impacting other software on your PC then you should troubleshoot the problem with the help of an IT professional who will understand the implications of these steps.
So something's blocking all connections from your PC to the relevant URL, or from Tradebox to Magento but only on this PC? At this point you should look first to any security software on your computer. Most PC's will be running some kind of security and this is advisable - whilst troubleshooting a connection problem it's best to temporarily disable one element at a time and re-test; once you've found the problem then you can take action to allow access without leaving security disabled permanently.
Most PC's will have some kind of anti-virus (AV) and firewall software; these may be provided by the same package or may be separate. You may also have more than one. An active AV normally shows in your Windows system tray, hover over the icons there if you're not sure which AV(s) you run.
Every AV is different, though most will give an option to disable/pause protection by right-clicking the system tray icon. You're looking to disable active protection/real-time scanning and web protection/firewall. Again, while troubleshooting, if you're unsure it's best to turn off as much as possible to temporarily allow the clearest connection until you've found what's blocking it. If you can't disable or modify your AV, check with your IT support or the AV's tech support who will be able to help.
Modern versions of Windows also come with their own security (Windows Firewall, Windows Defender, Windows Security Essentials), these can be viewed and disabled via your computer's Control Panel. The other layer of security that can block connections is a proxy server, you should disable this if you do use one.
There are background elements of windows that will impact on users/software accessing specific web locations. Incrediblelab have a number of useful troubleshooting steps. Step 4 (flush/renew DNS) shouldn't impact on other software, so we'd suggest completing that first, before following their other steps. Periodically throughout these steps, you should also reset your router. If your PC loses internet connection after a troubleshooting step, restarting both your PC and your router will normally resolve this. Note that browsing data will vary depending which browser you use (you may have more than one browser installed, in which case repeat that step for all, even ones you don't normally use).
Most sites have some facility for allowing/denying access based on IP address/location. If no other steps have resolved the problem, you should check with both your website host and your ISP (internet service provider). We have had users unable to access their own sites both due to the site being blacklisted by their ISP or their IP address being blocked by their web host.
IP-specific connection issues
If multiple PC's in the same location can't access a web resource that you know is available elsewhere, it's unlikely to be something you'll resolve on your PC. Restart your router as a first port of call, flushing/renewing DNS will also do no harm (see the above section clearing caches).
Security software is unlikely to affect multiple PC's unless you're a larger business who runs on a domain or has server-controlled security that applies the same rules to all computers on your network. In this instance, refer to your local IT support as they'll be able to apply the PC-specific steps above to the larger network infrastructure.
The above section on IP blocks also applies here so check with your web host and ISP. It's also worth checking in with Magento support - if we can access your Magento site from our location but you can't from yours, there may be a regional outage affecting a specific element of their infrastructure.