What is XML-RPC and why we use it?
XML-RPC is created by Dave winer in 1998. It is XML based protocol, used to transmit information between computer systems through network. RPC stands for remote procedure call and it uses XML to encode the calls. To transmit information it uses HyperText Transfer Protocol (HTTP) request. RPC gives developers a mechanism for defining interfaces that can be called over a network.
By using XML-RPC two or more computers running different operating systems and programs written in different languages to share processing and in formations. For example, an Odoo application could talk with a PHP program or an Android Application which in turn talks with Python application that talks with ASP, and so on.
Connecting to odoo using XML-RPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xmlrpclib | |
from openerp.exceptions import except_orm | |
url = "http://localhost:8009" | |
db = "your_db_name" | |
user = "abc@gmail.com" | |
pwd = "1234" | |
url = 'http://localhost:8069' or '' | |
try: | |
common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url), allow_none=1) | |
uid = common.authenticate(db, user, pwd, {}) | |
if uid == 0: | |
raise Exception('Credentials are wrong for remote system access') | |
else: | |
message = 'Connection Stablished Successfully' | |
except Exception as e: | |
raise except_orm(_('Remote system access Issue \n '), _(e)) | |
print('******message*****',message) | |
return uid, url, db, common, pwd |
6 Comments
hi guys,
ReplyDeleteplease could i have the bit of XML-RPC code, which allows to create an invoice ?????
for odoo 11 or 13
I will upload soon for record creation in odoo13 using xml rpc
Deleteyou have a return in your code, but no function
ReplyDeleteYup you can use this function to get user, pwd and database info, i am printing all of this on a button click, thats why i have no function
DeleteHow can l use it for instagram handle
ReplyDeleteHow can l use it for instagram handle
ReplyDelete