04-19-2014 9:17 PM
Hello experts , i now seriously need your suggestion here. Is there a way to expose a BAPI as a rest webservice which can be consumed by a web application in the end.
What is ICF ( Internet Communication Framework) ? Does this help in generating web service from BAPI ?
Netweaver Gateway might help to generate services but may not be recommended here in our scenario.
04-19-2014 11:56 PM
David,
Open up the FM in SE37 and chose the below menu path.
UTILITIES->MORE UTILITIES - > CREATE A WEB SERVICE - > FROM THE FUNCTION MODULE.
Once you are there, SAP will take you thru various steps thru which you can expose the FM as a web service to be consumed from web applications.
Thanks,
Vikram.M
04-20-2014 8:10 AM
This will get you a SOAP web service. David Clavey wants a REST webservice.
04-20-2014 7:37 AM
Please refer Real Web Services with REST and ICF for creation of rest services in sap. The BAPI will have to be called in your handler class.
I think your best bet would be to transfer the data in the body of the http request and use simple transformation(with multiple roots) to convert the xml data to sap formats. GZIP can also be used to compress the data that is being sent. We have done this successfully in one of our projects.
However this approach(RESTful Service) would involve more work when compared to the approach suggested by Vikram. If SOAP based services are ok, then you should go ahead with Vikram's approach.
07-13-2016 8:08 PM
07-13-2016 9:46 PM
You can't call a SOAP web service via a GET request so clicking on a URL will not work. Restless services can be build by implementing an ABAP class that implements the interface IF_HTTP_EXTENSION. You'll have to implement the method in the interface. The method gets a parameter server which can be used to access the data in the HTTP request.
With the method server->request->get_form_fields you can get the parameters in the URL. You can use them to send data to your REST service.
The anwer to the call should be added to the HTTP response (server->response).
Then you'll have to create a new node in SICF and set the class as HTTP handler.
More information here:
Best regards,
Frank
07-13-2016 11:43 PM
07-14-2016 3:30 PM
Hi Juan,
unfortunately the setting have to be done on the network, it's either a firewall or less likely a NAT issue.
I would advise to not open the firewall for the ECC system though. It would be better to use e.g. a reverse proxy that only opens a way for that one interface.
Best regards,
Frank
07-14-2016 3:52 PM
Thanks Frank,
looks like reverse proxies are only applicable to SOAP(SOAMANAGER).
is there another way to allow open up a Restful webservice safely?
thanks
07-14-2016 4:21 PM
Hi Juan,
any HTTP reverse proxy or server should work as your service is based on the HTTP protocol.
Example for nginx: https://www.nginx.com/resources/admin-guide/reverse-proxy/
Example for apache: Running a Reverse Proxy with Apache:
Best regards,
Frank