Web service in OpenERP

As per client’s requirement, we had to integrate PayPal services into our application, for that we used the Web services for that we have done:-

OpenERP use REST Web services to handle all type of request.
To make web service in OpenERP below sample code is used:
CODE:

from werkzeug.wrappers import Request, Response
from web import http
openerpweb = http

class web_paypal(openerpweb.Controller):
_cp_path = “/web/paypal_return”

@openerpweb.httprequest
def index(self, req, data=None, **kwargs):
# REST OF THE CODE TO HANDLE THESE WEB SERVICE
return werkzeug.wrappers.Response(kwargs, headers=headers)

In above example you have used HTTP request type (@openerpweb.httprequest), there is another way to handle the

request (@openerpweb.jsonrequest)
To make request to our OpenERP REST webservices by third party use below URL:
http://IP_ADDRESS:PORT/web/paypal_return

Note:- The above web services are Simple i.e. without any access right involved, it’s advisable to keep access right to make web services safe from an outside or third party.

Leave a Reply