php-twinfield / twinfield

PHP 7.3+ Library for using the Twinfield API.
https://accounting.twinfield.com/webservices/documentation/#/
Other
33 stars 78 forks source link

Twinfield to cloudflare infrastructure ("Could not connect to host") #214

Closed spoxies closed 2 years ago

spoxies commented 2 years ago

On 15 aug 2022 there was a infrastructure change and on our env this resulted in a "Could not connect to host". However there was no real connection issue as running direct (non SoapClient) requests from PHP were all fine.

A SSL/Cipher problem was the first direction I took in debugging, but nothing conclusive. But it would explain how the occurrence coincided with the Twinfield Cloudflare migration.

The exact cause of this issue remains a bit of a black box, WDSL caching could be a factor. But in my case, clearing cache and rebooting the server, disabling WDSL cache gave no relief.

Opening a PR for PhpTwinfield\Services\BaseService to fix this issue as proposed here, as it either bypasses or (hot)fixes the issue for now (if others experience the same issue).

Since the proposed fix also mentions misconfiguration of the SoapClient, the real fix might need to be implemented elsewhere so this PR is a Hotfix.

Env:

{
    "require": {
        "php-twinfield/twinfield": "^3.0",
        "league/oauth2-client": "^2.4"
    }
}

Error:


  | object(PhpTwinfield\Exception)#25 (7) {
-- | --
  | ["message":protected]=>
  | string(25) "Could not connect to host"
  | ["string":"Exception":private]=>
  | string(0) ""
  | ["code":protected]=>
  | int(0)
  | ["file":protected]=>
  | string(129) "[..]/vendor/php-twinfield/twinfield/src/ApiConnectors/BaseApiConnector.php"
  | ["line":protected]=>
  | int(111)
RickJeroen commented 2 years ago

Twinfield need to fix their soap:address location in https://api.accounting.twinfield.com/webservices/processxml.asmx?wsdl

Twinfield Process XML web service methods.
spoxies commented 2 years ago

@RickJeroen You might be right, so I left Twinfield Support a 'voicemail' (I don't have high hopes). I do not have a contact and this implementation was a one time thing only, so I'm not well versed.

I think that all that are using a PHP implementation of the TWF API, would experience this issue(?) ~So for those that might be reading along and feel a bit bored... you might like to give them a call.~

And one might like to add that announcing a (IP) server change, on the the same day as the change itself, is a bit frowned upon 🥲

spoxies commented 2 years ago

Seems the issue is resolved: https://wktaaeu.force.com/nlcommunity/s/article/MTN-26279-Het-kan-voorkomen-dat-er-een-foutmelding-getoond-wordt-bij-het-verbinden-van-de-API-koppeling?language=nl_NL