1

I'm trying to make a connection from my PHP script to an Odoo server, but running into inconsistent connection problems.

I have 3 test locations:

  1. Localhost
  2. Domain A
  3. Domain B

And 2 test scripts:

Odoo Demo:

require_once("ripcord.php");
$info = ripcord::client('https://demo.odoo.com/start')->start();
print_r($info);

Odoo Target Server:

require_once("ripcord.php");
$common = ripcord::client("###.###.###.##:8069/xmlrpc/2/common");
print_r($common->version());

This gives me strange and inconsistent outcomes:

  • Localhost + Odoo Demo: success
  • Localhost + Odoo Target Server: success
  • Domain A + Odoo Demo: success
  • Domain A + Odoo Target Server: Could not access ###.###.###.##:8069
  • Domain B + Odoo Demo: Could not access https://demo.odoo.com/start
  • Domain B + Odoo Target Server: Could not access ###.###.###.##:8069

Versions:

Localhost:

  • PHP version: 7.0.15
  • Ripcord version: 0.9

Server (Domain A & Domain B):

  • PHP version: 5.6.30
  • Ripcord version: 0.9

What makes it stranger is that Domain A and Domain B are on the same server. What factors could determine whether or not the request succeeds? More importantly, how can I successfully access the Odoo Target Server from Domain A and B?

GroovyPanda
  • 3,694
  • 8
  • 31
  • 42

1 Answers1

1

Turns out my problem was two-fold:

  1. Domain B seemed to have a poblem with the default RipcurlTransport (Stream); perhaps a problem with file system permissions. Switching to Curl solved the problem of not being able to connect to the Odoo demo database.
  2. The server is behind a Firewall, which needed to allow outgoing connections to port 8069. This solved the problem of not being able to connect to the production database.
GroovyPanda
  • 3,694
  • 8
  • 31
  • 42
  • RemiX, could you please give more details about how you resolved the problem ? When I var_dump records using search( ) method, then I always keep getting this array { "faultCode"=> 3, "faultString"=> "Access Denied" } . Also, when I call the ripcord::client($url)->start() method, I get Fatal error: Uncaught Ripcord_TransportException: Could not access – Victor Attila Breelle Jan 27 '21 at 09:07
  • It's been 4 years since I worked on this, so I don't recall much of it. It seems I solved the problem on Domain B by switching to curl (don't ask me for the exact commands, I don't remember), and not using Ripcord at all. Did you try using curl instead? Did you also check the firewall for outgoing connections to port 8069? – GroovyPanda Jan 28 '21 at 10:17
  • So, instead of using the Odoo Demo, I decided to purchase some modules. And like you said, I opened the 8069 port for that specific IP address for the new database (like "Domain Z + Odoo Target Server"). And finally, it worked :) :) But I think the start( ) method is specific for Odoo Demos only, I mean the following code cannot work : ripcord::client('http://###.###.###.###:8069/start')->start(); – Victor Attila Breelle Feb 05 '21 at 15:53