Quantcast
Channel: SCN : Blog List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 68

Write for Web Services but use RFC

$
0
0

Consumer Mapping

 

If you have an application that is going to communicate with several systems (on different releases, for example), the services in the various systems may expect different communication types.

 

You can write an application to call a particular service but then, without changing the coding, call a different service that is semantically similar. I will illustrate this, with what is almost the „hello world” of consumer mapping, using a call to a Web service and then a call to an equivalent remote-enabled function module. An even simpler example would involve two Web services but the reasons for doing that may not be so obvious.

 

Starting Point

 

In a provider system I exposed a function module as a Web service. In the consumer system I created a corresponding consumer proxy. The application calls the Web service in the usual way by specifying the consumer and the logical port.

 

Picture1.png

 

Second Provider System

 

In another system there is no corresponding Web service but there is the same function  module as used in the Web service – you don’t get much more semantically similar than that and it makes the mapping trivial.

 

Picture2.png

 

A Little Development

 

I do not touch the application and the existing Web service consumer is not capable of calling the function module directly. So I first create an RFC consumer that will communicate with the function module. Then I create the consumer mapping between the Web service consumer and the RFC consumer. The Web service consumer is the “source consumer” and the RFC consumer is the “target” consumer”. Because there is only one target this is called single target consumer mapping (STCM).

 

Picture4.png

 

Configuration and Execution

 

The final step is to configure the STCM in SOA Manager. This is basically specifying the logical port, which in this case entails configuring an RFC destination. For the application, nothing has changed. But now, depending on the logical port used, the call is made to the naked function module.

 

Picture3.png

 

Conclusion

 

Since STCMs are a separate type of ABAP development object, a customer or partner, or other organization, could create their own STCM objects in order to manipulate outbound messages without modifying the sending application. For example, a web service consumer in an SAP-delivered scenario does not exactly match the service in an existing landscape. The customer could create the appropriate STCM based on the service consumer and the data structure of the addressed service, and do the mapping to provide the correct message structure.


Viewing all articles
Browse latest Browse all 68

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>