什么时候应该使用XML-RPC而不是Odoo中的控制器? [英] When should I use XML-RPC instead of a Controller in Odoo?

查看:999
本文介绍了什么时候应该使用XML-RPC而不是Odoo中的控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常混淆这两个交换信息的概念。 I 几天前问了一个问题,似乎我做错了。

I'm very confusing with this both concepts of exchanging information. I asked a question few days ago and it seems I was doing wrong.

是控制器Web服务还是类型?只有XML-RPC是Web服务?

Are the controllers web services or kind of? Only XML-RPC is a web service?

所以我想知道什么时候应该使用控制器在Odoo上,当我应该使用 XML-RPC 在Odoo和任何其他不同的应用程序之间交换信息。

So I would like to know when I should use a controller on Odoo and when I should use XML-RPC to exchange information between Odoo and any other different application.

这是最安全的方式?

在我上一个问题中,我想让客户向我发送一些客户的信息,数据库。有人发表了一条建议我用XML-RPC做一个评论。那么在哪些情况下我应该使用控制器?如果我要将一个网站发送回客户端作为响应,它只使用?

In my previous question I wanted the client to send me information about some customers to create them in the database. Somebody posted a comment recommending me to do it with XML-RPC. So in which cases should I use a controller? Is it only used if I want to sent back a website to the client as a response?

我在Odoo文档中没有找到任何线索。但是我在Odoo文档中发现了一些语言(Python,Ruby,PHP,Java)中的一些XML-RPC示例。也许做控制器的事情更方便,如果客户端,谁给我发送信息,不能用这些语言工作。是吗?

I didn't find any clue in the Odoo documentation. However I found some XML-RPC examples in some languages (Python, Ruby, PHP, Java) in the Odoo documentation. Maybe to do the things with a controller is more convenient if the client, who sends me the information, does not work with those languages. Is it?

我会感谢任何帮助。

推荐答案

你只是使用CRUD(创建,读取,更新,删除)你几乎肯定要使用xmlrpc / jsonrpc接口。你甚至可以使用xmlrpc / jsonrpc对模型执行自定义命令。因此,xmlrpc是在客户端和服务器之间执行身份验证交换的结构化方法。

If you are simply using CRUD (Create,Read,Update,Delete) you almost definitely want to use the xmlrpc/jsonrpc interfaces. You can even you xmlrpc/jsonrpc to execute custom commands on you models as well. So xmlrpc is a structured means of executing authenticated exchanges between your client and the server.

如果要将复杂的json数据提供回客户端或从客户端进行未经验证的交互 - >服务器然后控制器绝对是走的路。

If you want to provide complex json data back to your client or make unauthenticated interactions from client->server then a controller is definitely the way to go.

控制器对于Odoo网页服务也非常有用。重定向到正确的页面或加载适当的模板和处理表单数据非常容易。

Controllers are also very useful for the Odoo Webpage services. Making redirecting to the proper page or loading the appropriate template and handling form data very easy.

无论您的设计需求是什么工作都可能是正确的,但是Odoo已经创建了服务用于处理正常的CRUD交互和执行模型函数,建议从Odoo的工作中受益,并使用你的硬编程时间在需要时创建自己的结构。

Whatever works for your design needs may be correct for you, however Odoo has created services for handling normal CRUD interactions and executing model functions and it is advisable to benefit from Odoo's work and use your hard programming time to create your own structures where needed.

这里是Odoo docs。

Here is Odoo's docs.

xmlrpc

这篇关于什么时候应该使用XML-RPC而不是Odoo中的控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆