Show TOC Start of Content Area

Procedure documentation Mapping Service Operations  Locate the document in its SAP Library structure

Use

Once you have imported an external service in your composite application, you need to map the external service operations to application service operations. This way you use external services without implementing code. If the external service you have imported has a huge number of operations and attributes, you can create automatic identical mappings to an application service.

The CAF application uses an application service operation to send an input message. The input message attributes are mapped to the remote service operation input attributes (input mapping). The remote service processes the input attributes and generates output attributes.The output message attributes are mapped to the application service operation output attributes (output mapping).

The application service operation returns the output attributes back to the caller. This process is described in the figure below:

 

This graphic is explained in the accompanying text

Prerequisites

      You have imported an external service in your application. For more information, see Importing Web Services.

      You must be familiar with the mapping rules. For more information, see Rules for Service Mapping.

      You must have disabled the Implemented checkbox. For more information, see Modeling Service Operations.

      For business objects, you also need to complete the following:

       You have created at least one operation custom key attribute.

       You have set remote persistency.

For more information, see Defining Business Object Persistency.

Procedure

Mapping External Service to an Application Service

       1.      Map the external service operation to the application service operation:

                            a.      Open the Datasource tab page.

                            b.      Select the application service operation you want to map and choose Create mapping.

                            c.      For a source operation, choose an external service operation you have imported.

                            d.      Use drag and drop to map the input and output parameters of the source and target  operations.

Arrows appear indicating the direction and type of attribute mapping:

§         Green arrow indicates mapping of collections.

§         Black arrow indicates mapping of single attributes.

       2.      Save all metadata, generate project code, build, and deploy.

Creating Automatic Mappings for Application Services

...

       1.      Click one of the external services you have imported with the secondary mouse button and choose Default mappings.

       2.      Select the attributes of the external services to be automatically mapped.

       3.      Choose the target application service for your mapping. You have the following options:

       Create methods in new Application Service

       Create methods in existing Application Service

Mapping an External Service to a Business Objects Operation

...

       1.      Open the Datasource tab page of the business object attribute, following the instructions for application service operations mapping.

       2.      Select the source operation attribute you want to map to the relevant CRUD or query operation.

       3.      Use drag and drop to map the input and output parameters of the source and target operations.

       4.      Arrows appear indicating the direction and type of attribute mapping:

       Green arrow indicates mapping of collections.

       Black arrow indicates mapping of single attributes.

Note

Select the proper external operations regarding semantics.

For example, the operation getUserInfo is more likely to be mapped to a read operation than to a create operation.

..

Changing the Default Mapping Behavior

You can change the default behavior of the mappings editor. Note that the difference between the structure and the attributes’ mapping is in the automatically generated code. For example if you choose attribute mapping, the amount of generated code is greater than the amount of code that will be generated if you have selected structure mapping. If the simple types in your service are many, we recommend that you choose structure mapping. However, if you have to exclude types from the structure, choose attribute mapping.

 

By default, the mappings you create are of type structure. To change that behavior:

       1.      From the menu path, choose Windows Preferences. Open the Composite Application Framework tab page.

       2.      Under Mapping Preferences, select the desired mapping behavior:

       Structure mapping – allows automatic mapping on structure level.  For example, the mapping will happen between the main structure nodes. The attributes of the structure will not be mapped explicitly.

       Attribute mapping – allows automatic mapping on attribute level. For example, if you have a structure, the mapping will take place between each of the structure’s elements.

       User choice – you are prompted to choose either structure or attribute mapping.

       3.      Apply your changes.

Result

The application service or business object node operations are now mapped, and if called at runtime they execute the mapped external service operation according to the attribute mappings.

To remove the operation mapping you created, choose Delete Mapping.

End of Content Area