Making way through Gate, Finding some REST !
I guess you might be puzzled with the title of my blog. Let me help to clear the puzzle. This blog is all about SAP NetWeaver Gateway!
There will be few questions in your mind about this stuff from SAP.
You may have some of below questions in your mind like,
1) What is SAP NetWeaver Gateway? And what is the importance of it?
2) How is it different from SAP PI?
3) What skills are required to learn it?
4) Learning sources?
This blog is just an attempt to answer above questions from the Research I did so far on this new stuff.
To answer 1st question,
In very simple terms, SAP NW Gateway can be viewed as one of the OData producers.
OData producers are services that expose their data using the OData protocol. You can find other OData producer list at http://www.OData .org/ecosystem
You may ask what OData is then.
Well, OData is Open Data Protocol!
You can refer below definition.
The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites.
OData protocol is used for creating Representational State Transfer (REST)-based [REST] data services, which enable resources, identified using Uniform Resource Identifiers (URIs) and defined in an abstract data model, to be published and edited by web clients within corporate networks and across the Internet using simple Hypertext Transfer Protocol (HTTP) messages.
[Reference – http://www.OData .org/ ]
If this technical definition is too much then in simple terms, OData is used for creating REST based data (Web?) services.
And then you will ask, what is REST?
Representational State Transfer (REST) is kind of architecture/protocol something similar to SOAP protocol but with more advantages over SOAP.
A RESTful web service (also called a RESTful web API) is a web service implemented using HTTP and the principles of REST.
The world of web is now divided between REST and SOAP and nowadays most of the applications are using REST.
Refer http://geeknizer.com/rest-vs-soap-using-http-choosing-the-right-webservice-protocol/ to know more on REST vs. SOAP
I hope, by now, you might be familiar with OData, REST terminology and importance of REST over SOAP.
Now coming back to SAP Gateway,
SAP NetWeaver Gateway is a development framework, which is available as an SAP NetWeaver Application Server ABAP (AS ABAP) add-on, which you can install on top of your existing SAP Business Suite or application platform.
SAP NetWeaver Gateway offers development and generation tools to create OData services to a variety of client development tools. Put simply, it establishes a connection between SAP Business Suite data and target clients, platforms, and programming framework.
Also note that SAP NetWeaver Gateway only provisions RESTful services. It cannot be used for consumption of services.
As most of us know that we can create web services on top of RFC which are SOAP based, there was no way to expose SAP data to outside world in the form of RESTful protocol and for that reason, SAP NW GW comes into picture. It simply helps usto expose this data in the form of REST based OData.
This light weight REST based data then can be easily consumed by tablets, mobile devices or web applications.
One question may pop up in your mind is how REST based web services can be light weight compared to SOAP and for that you need to know about JSON !
The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.
In simple terms, it is an alternative to XML but with few more advantages over XML.
Let’s see the difference between JSON vs. XML at http://www.json.org/xml.html
JSON with REST do have lot more advantages over XML with SOAP. Refer, http://blog.feedly.com/2009/03/03/jsonrest-vs-xmlsoap/
With all this information, it is clear that SAP want to leverage the capability of REST based services to outside world for consumption due to advantages of REST based OData.
Data exposed by GW service, is light weight, can be easily consumed by application and devices. One of the important consumers is SAPUI5 based applications. With SAPUI5, we can easily build web application or mobile application on top of GW service.
I hope this answers the second part of first question.
Back to 2nd question, how is it different from SAP PI?
Refer this link http://scn.sap.com/docs/DOC-25547
Before going through this document, I thought SAP NetWeaver Gateway as some sort of middleware and thought why SAP did not provided this capability with PI.
If we look back into SOAP based web service generation on top of RFC then it make sense to have this kind of facility in ABAP stack to be able to create REST based service on top of RFC and for this very purpose ABAP developer can use his/her all time favorite SE80 for GW Data Model and GW Consumption Model
As ABAP Developer may know more about which BAPI, RFCs, BOL(in CRM) to be used, what fields to be selected for various REST based operation (GET, POST, DELETE and UPDATE – in HTTP verbose), he/she will be best suitable person to develop GW services.
In future, REST based adaptor may be provided with PI but still it makes more sense to have SAP NW GW to develop GW REST based services.
We may not be surprised to see that GW services again consumed in PI for monitoring, governance purpose. This is something similar to have PI for SOAP based web service despite of the fact that SOAP based Web service can be directly consumed without PI by external applications.
This all stuff makes it very clear that both PI and GW have their own purpose!
Now coming back to third question, what skills are required to learn it?
With all above discussion and knowing the fact that SAP NW GW is on ABAP stack, embedded with SE80, ABAP development skills will be the best suited to learn SAP NW GW.
[P. S. – Eclipse based tools can be used for GW modeling etc. With ABAP on eclipse, this will be again simpler for ABAP developers]
Finally, the last and important question, learning sources?
As we are more familiar with RFC, you can first start with How to Guide at [Content Deleted June 2013]
This shows how one can develop Gateway service on top of RFC.
Some business objects, such as Sales Orders or Purchase Orders, consist of header and line item data. Thus, when creating such business objects, it makes sense to use hierarchical or nested data in the creation request. SAP NetWeaver Gateway can be used to create and expose a service that allows for the creation of these business objects.
In SAP NetWeaver Gateway, the OData Channel provides deep insert functionality to accommodate the creation of an entity along with its associated entities in one request. The deep insert functionality is provided in ABAP interface /IWBEP/IF_MGW_APPL_SRV_RUNTIME, method CREATE_DEEP_ENTITY.
Refer this link on this scenario, http://scn.sap.com/docs/DOC-22305
Finally you may be interested to develop web application based on GW service and how about using SAPUI5 for User interface which will consume GW OData service!
Refer these step-by-step document on it – http://scn.sap.com/docs/DOC-33792 and http://scn.sap.com/community/developer-center/front-end/blog/2013/05/31/how-to-create-sapui5-application-consuming-gateway-service-with-the-help-of-sap-nw-gateway-plugin
Some of you may get one question whether it is possible to develop REST based services without Gateway? For those, this link will be helpful http://scn.sap.com/community/abap/blog/2013/01/24/developing-a-rest-api-in-abap
3. Gateway Architecture – [Content Deleted Jan 2014]
5. SAP NetWeaver Gateway – How-To Guides – http://scn.sap.com/docs/DOC-27405
6. SAP NetWeaver Gateway developer tools –http://www.sdn.sap.com/irj/sdn/gateway?rid=/webcontent/uuid/a09fe802-c162-2e10-d59a-be4a4f27c49b
We explored lot and tried to open gates of new world based on Open Data. Now be relaxed and take some REST!