Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

In this blog, I will introduce the service extensibility concept that was developed as part of the SP09 development for the SAP NetWeaver Gateway Service Builder.


Motivation: The motivation behind the service extensibility concept was to have a single service URL for both the original service and the new service (which is generated by redefining the original service). This will enable users to redefine a particular service as per the requirements but still access the new redefined service using the URL of the original service.

Prerequisites:

IW_BEP 200 SP09


Step-by-Step Procedure

Following are the step by step procedures to extend a particular service. I will redefine an original service into a new redefined one and then showcase the service extensibility functionality.

Creation of a “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” service


Create a new service by redefining the original service


Extend the service while generating the runtime artifacts


Check the service URLs


Creation of a “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” service

  1. Go to the transaction SEGW and create a new project by clicking on
  2. Enter the details for the Project, Description, and Generation Strategy. Select project type as “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” from the drop-down. I have mentioned the project name as “z_srvext_parent” for better comprehension.

    

     3. Create few entities for this project by right clicking on “Data Model” and selecting “Create Entity”. Or you could also right-click on the “Data Model” and                select the “Import” mechanism to import a data source. I will import a RFC in this example.

       

     4. I now have the service as follows. Let’s call this the “parent” service.

    

     5. Generate the Runtime artifacts by clicking on . In the following dialog Click Continue.

    

     The runtime artifacts for this “parent” service will be generated.

Create a new service by redefining the original service

  1. Let’s now create a new “Service with SAP Annotations project” and redefine it from the “parent” service. Navigate to the SEGW transaction and create a new service as follows.

    

     Let’s call this the “child” service.

2. Right Click on the Data Model and select Redefine -> OData Service (GW).

3. In the following wizard, enter the values for the “parent” service and click “Next”.

4. Select the entity of the “parent” service in the next wizard as follows and click on “Finish”.

5. Add another entity to this service by right-clicking on Data Model and selecting Create -> Entity Type.

Add a property for this entity. (I have tried to keep the entities and properties to be as simple as possibleJ). The “child” project now has two entities as shown below.

6. The “child” project now looks like as follows:

The “parent” service appears under the Model References folder.

Extend the service while generating the runtime artifacts

1. Generate the runtime artifacts for this “child” service by clicking on . The following dialog opens up.

The Overwrite Base/Extended Service under “Service Extension” is by-default unchecked. Once checked, we get the warning “Base service will be inaccessible” and the Technical Service Name and the Service Version fields get filled with the values of the “parent” service that was entered in step 3.

(If the checkbox Overwrite Base/Extended Service is checked, the service extensibility concept comes into play. The service URL of the “parent” service (Z_SERVICEEXT_PARENT) will now be re-directed (i.e. fetch the service details) to the “child” service (Z_SERVICEEXT_CHILD).

2. We will now register this service in the SAP NetWeaver Gateway Hub system. Click on Service Maintenance and select the Hub system and click on Register.

   Click Ok and enter the system alias in the next dialog. Enter the package in the subsequent dialog and click Ok.

  

3. Register the “parent” service as well by following the same steps as above. Now since we have both the “parent” as well as the “child” services registered, we       can check the service URLs.

Check the service URLs

  1. Navigate to the “parent” service -> Service Maintenance, select the Hub system and click on Gateway Client to check the service details.

  

   2. In the Gateway Client window, enter the details as mentioned in the picture below and execute to see the service details.

  

Now, in the metadata of the “parent” service, we can see the two entities associated with the “child” service. This happens because the service URL of the “parent” service gets redirected to the “child” service as the “child” service has extended the “parent” service.

Both the “parent” and the “child” service can be accessed using the URL of the “parent” service.

Hope this post helped you get a perspective on the service extensibility concept in service builder :smile:

12 Comments