跳至內容
選單
此問題已被標幟
1 回覆
6169 瀏覽次數

I'm trying to integrate odoo with an external application, that updates a custom url that I've given automatically, with XML data when an event occurs.

Suppose I hosted my odoo on https://mydomain.com, I can provide a custom url like https://mydomain.com/my/customurl

to that application, and that application will post an xml data to to the url. 

I can see that the url is actually called by the external application on status change, but how to view the xml data?

printing kwargs and args gave empty result. I think Odoo handles data with header  {"Content-Type": "application/json"} only. How to handle {"Content-Type": "text/xml"} data?

I know that data is present in the post request, which I've verified by giving a test url from https://requestbin.com which output the correct xml data in the body of the post request.

Any solutions or ideas are welcome. Odoo version is 11.

code :

from odoo import http
from odoo.http import request
import logging

class DocuSignStatus(http.Controller):

@http.route(['/docusign/envelope'], type='http', auth="public", methods=['POST'], csrf=False)
def update_docusign_status(self, *args, **kwargs):
    logging.error("\n\n\nCame in here!!!!!!!!!!!!!!!!!")
    for arg in args:
        logging.error("\nArgs = %s" % arg)
    logging.error("\n\n\nKwargs = %s" % kwargs)
    #        logging.error("request = %s" % request)
    #        logging.error("context = %s" % request.context)
    return {}

頭像
捨棄
最佳答案

print(request.httprequest.data)

will show the xml request data.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
4月 22
18364
0
1月 22
2356
3
12月 23
4703
0
12月 22
2246
0
7月 20
3500