Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6147 Lượt xem

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 {}

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

print(request.httprequest.data)

will show the xml request data.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 22
18364
0
thg 1 22
2343
3
thg 12 23
4688
0
thg 12 22
2220
0
thg 7 20
3474