Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 2 Jahren, 4 Monaten
Letzter Beitrag:
vor 1 Monat, 2 Wochen
Beteiligte Autoren:
Yogi Yang, Peter Zhou, PETER ZHOU

[WD] - How to convert Python/Java code in WD?

Startbeitrag von Yogi Yang am 01.01.2016 07:09

Hello,

Happy New Year to all members!

I am trying to communicate with Odoo (ERP) server from my WD app.

Odoo server uses XMLRPC to communicate with external clients.

Here is sample code in Python as well as Java:
Python
(ask https://demo.odoo.com for test Database)
import xmlrpclib
info = xmlrpclib.ServerProxy('https://demo.odoo.com/start').start()
url, db, username, password = info['host'], info['database'], info['user'], info['password']


Java
(ask https://demo.odoo.com for test Database)
final XmlRpcClient client = new XmlRpcClient();

final XmlRpcClientConfigImpl start_config = new XmlRpcClientConfigImpl();
start_config.setServerURL(new URL("https://demo.odoo.com/start";));
final Map info = (Map)client.execute(
start_config, "start", emptyList());

final String url = info.get("host"),
db = info.get("database"),
username = info.get("user"),
password = info.get("password");

There is this note also:
Quote

Note

These examples use the Apache XML-RPC library

The examples do not include imports as these imports couldn't be pasted in the code.


Here is the code in WD that I am trying:
cMyRequest is httpRequest

cMyResponse is httpResponse

cMyRequest..URL = "https://demo3.odoo.com/";
cMyRequest..ContentType = XMLRPDefault
cMyRequest..User = "demo"
cMyRequest..Password = "demo"
cMyResponse = HTTPSend(cMyRequest)

IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse..Content)
END


Here is the online documentation link.

TIA

Yogi Yang

Antworten:

Hello Again,

This Python code is working perfectly but when I convert it to WD it is not working:

import xmlrpclib

svr = 'abc.com:8069'
db = 'test_erp'
user = 'xyxyxyxy'
pwd = 'xxxxxxxx'

url = 'http://%s/xmlrpc/' % (svr)

common_proxy = xmlrpclib.ServerProxy(url+'common')
object_proxy = xmlrpclib.ServerProxy(url+'object')

uid = common_proxy.login(db,user,pwd)

print "Logged in as %s (uid:%d)" % (user, uid)


SvrVersion = common_proxy.version()

print SvrVersion

Can someone help convert this in WD please...

TIA

Yogi Yang

von Yogi Yang - am 05.01.2016 07:05
Quote
Yogi Yang
Hello Again,

This Python code is working perfectly but when I convert it to WD it is not working:

import xmlrpclib

svr = 'abc.com:8069'
db = 'test_erp'
user = 'xyxyxyxy'
pwd = 'xxxxxxxx'

url = 'http://%s/xmlrpc/' % (svr)

common_proxy = xmlrpclib.ServerProxy(url+'common')
object_proxy = xmlrpclib.ServerProxy(url+'object')

uid = common_proxy.login(db,user,pwd)

print "Logged in as %s (uid:%d)" % (user, uid)


SvrVersion = common_proxy.version()

print SvrVersion

Can someone help convert this in WD please...

TIA

Yogi Yang


Hi Yong,

Did you deploy WD with Odoo API solution ?
Any issue ?

Regards,

PETER ZHOU

von PETER ZHOU - am 31.03.2018 00:52
Quote
PETER ZHOU
Hi Yong,

Did you deploy WD with Odoo API solution ?
Any issue ?

Regards,

PETER ZHOU

Actually No.

I could not make any progress with WD/WM so I completed the project using B4X.

von Yogi Yang - am 31.03.2018 03:41
Quote
Yogi Yang
Quote
PETER ZHOU
Hi Yong,

Did you deploy WD with Odoo API solution ?
Any issue ?

Regards,

PETER ZHOU

Actually No.

I could not make any progress with WD/WM so I completed the project using B4X.



Just B4X alone ? Or with PHP?

von Peter Zhou - am 03.04.2018 04:22
Quote
Peter Zhou
Just B4X alone ? Or with PHP?

Yes with help from PHP also.

von Yogi Yang - am 05.04.2018 03:19
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.