Introduction: SAP PO REST Adapter provides extensive functionalities can be used to realize a wide range of scenarios for consuming or exposing REST services in SAP PO. In this article, I will provide an insight on how to expose a REST service with multiple operations within PO based on one of my projects use case.
Use case: There exists a use case where mobile apps via the SAP Mobile Platform needs to consume some backend services in a legacy application. However, between SMP and the legacy system, an orchestration needs to be performed and this is implemented in Java Proxy Orchestration. In this article, these various services available in the legacy application will be combined into a single interface with multiple operations.
Figure 1: Use case overview with systems involved in orchestration
Implementation steps:
1) Create a Sender REST Adapter as shown below, selecting the options as seen on the screen in the “General tab”
Figure 2: Overview of the REST Sender Adapter
2) Proceed to the “Channel Selection” tab, choose the option specify endpoint and provide a name that can be used as a unique point of entry to this service (channel) by the consumer application;
Figure 3: REST Sender Adapter Channel Selection Configuration
3) Proceed to the third tab; “REST Resources”, within the URL Pattern option, select “Custom Pattern” and put a forward slash “/” as the pattern. Also, select the XI Dynamic Attribute “REST Service (service)”, Here provide the value for your “HTTP Header Element ” that would be passed from the consumer application
N:B-The first Dynamic Attribute shown in the screen is not relevant here.
Figure 4: REST Sender Adapter Resource configuration and HTTP Header element
NB: The optional field can be ticked if you want to make this attribute option
4) In the 4th tab “REST Operation”, select HTTP Operation as the “Value Source”
Figure 5: REST Sender Adapter operation configuration
5) A very important step in this configuration is the 5th tab “Operation Determination”, here the Sender REST Adapter maps the incoming message with the appropriate service interface operation.
Figure 6: REST Sender Adapter Operation Determination configuration
Once all the configuration steps described above have been implemented, then save and activate your channel.
6) Testing from a consumer: In this case the SOAP UI client tool is used, other REST client tools can be used as well. Perform the following actions to test,
Figure 7: Creating REST Project in SOAP UI Tool
Method =POST
Endpoint: http//:<hostname>:port
Resource: /CalculatorService_2015 (as specified in step 2)
Figure 8: Endpoint settings in REST Project Request message
Media Type: application/json
Request: JSON request message
HTTP Header Information:
i) Header = Calculator_Operation (as specified in step 3)
ii) Value = name of operation to be called e.g Add operation (as specified in step 5)
Figure 9: Input JSON Message and HTTP Header element input
Conclusion: With the steps described in this blog, you can easily expose a multi-operation service interface in SAP Process Orchestration as REST service using the sender REST Adapter. Consumer applications/client tools are able to consume the different services in the service interface operations by providing the configurable parameters set on the channel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |