Web service in OpenERP

As per client’s requirement we had to integrate paypal services in to 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 is Simple i.e. without any access right involed, its advisable to keep access right to make webservices safe from outside or third party.

You must be logged in to post a comment.