You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure how or why, but making an Http\Client and then passing it to the OdooClient's XmlRpc breaks things on my end, I've also used it in the constructor which was my previous pull request, but for some reason, I get an Odoo error now:
This is the one where I set the Http Client with setHttpClient, after constructing the OdooClient
[Zend\XmlRpc\Client\Exception\FaultException]
Traceback (most recent call last):
File "/home/odoo/src/odoo/9.0/openerp/service/wsgi_server.py", line 56, in xmlrpc_return
result = openerp.http.dispatch_rpc(service, method, params)
File "/home/odoo/src/odoo/9.0/openerp/http.py", line 114, in dispatch_rpc
result = dispatch(method, params)
UnboundLocalError: local variable 'dispatch' referenced before assignment
The error I now get when I pass the Http\Client in the OdooClient's constructor is almost the same, but the error reads "method execute is not found", again an entire Odoo stacktrace on the Odoo Server side.
I have been breaking my head on this because if you make the Http\Client right before you instantiate the XmlRpcClient (https://github.com/jacobsteringa/OdooClient/blob/master/Odoo.php#L352) the error is gone. No problem whatsoever, if I pass the exact same statement, before I create my OdooClient, the Odoo returns its server errors. Meaning the following voodoo:
$httpClient = new Client(null, [options]);
$odooClient = new OdooClient(...., $httpClient);
-> fails, above stated errors are thrown
And when I do this:
$httpClient = new Client(null, [options]);
$this->client = new XmlRpcClient($this->host . '/' . $path, $httpClient);
-> all works fine
I'm clueless as to why this happens, I've been browsing in the underlying classes to figure out why, but found no answer.
Solution
I looked into an eloquent solution and found my current state of the client is the most eloquent one, one that instead of passing an entire Http\Client, just sets the options post construct.
So if someone runs into these problems, this very well may be a fix. I've seen you added the setHttpClient as an addition to my PR, so I'm not going to PR it just yet. Just letting you know and perhaps you know what's going on under the Zend-hood.
The text was updated successfully, but these errors were encountered:
Hi @jacobsteringa ,
Voodoo
I'm not sure how or why, but making an Http\Client and then passing it to the OdooClient's XmlRpc breaks things on my end, I've also used it in the constructor which was my previous pull request, but for some reason, I get an Odoo error now:
This is the one where I set the Http Client with setHttpClient, after constructing the OdooClient
The error I now get when I pass the Http\Client in the OdooClient's constructor is almost the same, but the error reads "method execute is not found", again an entire Odoo stacktrace on the Odoo Server side.
I have been breaking my head on this because if you make the Http\Client right before you instantiate the XmlRpcClient (https://github.com/jacobsteringa/OdooClient/blob/master/Odoo.php#L352) the error is gone. No problem whatsoever, if I pass the exact same statement, before I create my OdooClient, the Odoo returns its server errors. Meaning the following voodoo:
And when I do this:
I'm clueless as to why this happens, I've been browsing in the underlying classes to figure out why, but found no answer.
Solution
I looked into an eloquent solution and found my current state of the client is the most eloquent one, one that instead of passing an entire Http\Client, just sets the options post construct.
So if someone runs into these problems, this very well may be a fix. I've seen you added the setHttpClient as an addition to my PR, so I'm not going to PR it just yet. Just letting you know and perhaps you know what's going on under the Zend-hood.
The text was updated successfully, but these errors were encountered: