Copy Gateway Service from One server to another server using EDMX file
When there is a requirement to copy a particular gateway service from one server to another server, the most time consuming part is to copy the data model manually by creating all the entities, entity sets, associations and navigation paths.
Now to overcome this big trouble, there is a better way given by SAP. There is an option called “Data Model From File”.
The goal of this document is to provide the steps to use this option “Data Model from File”.
1. Generate METADATA:
Suppose we want to copy the Gateway Service “ZTEST_SALESORDER”. Then first of all we have to generate the $metadata of this service. For this we have to go to Service Maintenance and select the System for which the Service Registration has already been done. Then click the button “Maintain”.
This will give a pop-up message, click yes.
This will open the “Activate and Maintain Services” screen.
Here click on the button “Gateway Client”. This will open SAP NetWeaver Gateway Client screen.
To directly open SAP NetWeaver Gateway Client screen one can use the Tcode /iwfnd/gw_client
Now to get the METADATA add $metadata at the end of the URI as below:
Now the entire METADATA of the data model will be displayed inside the HTTP response section.
2. Create EDMX file
Copy the entire metadata from the previous step and paste it in a text file. After that save the text file with the extension .edmx
3. Use EDMX File to copy the data model into a new service
Now we will create a new Project from transaction SEGW (SAP NewtWeaver Gateway Service Builder).
Now right click on Data Model and select the option Import -> Data Model From File
Chose the EDMX file that we have saved in the previous step.
Now check the service in SEGW. All the entity, entity sets, associations, association sets, navigation paths are automatically copied into the newly created service.
After that the Runtime Objects can be generated for the service and accordingly the Service Implementations can be copied.
Appendix(Copy Standard Service):
Here in the above example I have considered a custom service to be copied. If you want to copy any standard service then you should follow the below steps to get the metadata of the service.
Open the TCODE /iwfnd/maint_service
This will display the entire service catalog of the system. Select the one that you want to copy from the service catalog and then click on the button Gateway Client.
After that please follow the previously discussed steps.