Skip to main content

C4C/CPI: Automatically adjust mapping for DEV namespace

Submitted by Stefan Barsuhn on

As C4C development systems (that are in development) use a different namespace than non-dev systems, one challenge is to adjust the CPI mapping of extension fields when moving to test or production.

When you are finished with development and unit testing in your dev environment, naturally, all CPI iflow mappings that involve extension fields would be mapped to the DEV namespace. If you simply move this iflow/mapping to your test system, it won't work, as the DEV namespace is not known in the test/production environment.

You either need to adjust your iflows manually. This involves uploading the test system WSDL to the iflow and re-mapping all extension fields from the DEV namespace to the test/production namespace.

However, you can also do this automatically as follows:

  1. Copy the iflow to your test CPI environment
  2. Open the copied iflow and download the mapping (tab References)
  3. Download the WSDL from your target C4C system (Administrator => Communication Arrangements)
  4. Upload this WSDL to the copied iflow (under References => Add)
  5. Delete the obsolete WSDL from the previous system
  6. Unzip the downloaded mapping
  7. Move the downloaded WSDL into the WSDL folder of the downloaded mapping
  8. Edit Mapping as follows:

Replace

<elem>filename of previous WSDL</elem>

with

<elem>filename of new WSDL</elem>

Now, this is important to understand. Assuming you're moving from DEV to TEST, then all extension field mappings will point to the DEV namespace. Luckily, you don't need to touch the individual mappings, you simply need to swap the namespaces.

The mapping file contains a mapping line for each namespace. For instance:

<property name="http://0000954793-one-off.sap.com/YUWOFU8OY_">ns8</property>

means that C4C namespace YAWOFU8OY (the DEV namespace in this case) is represented by ns8 in this mapping file. As such, all mappings that relate to extension fields will have a prefix of ns8:, e.g. ns8:Z_MyC4CExtensionField.

Now, to adjust this to the TEST namespace, we simply need to swap the namespace mapping.

If you're moving from DEV to TEST, then your mapping file will already contain a namespace entry for your TEST system, e.g.

<property name="http://0000954793-one-off.sap.com/Y2T9UWDOY_">ns10</property>

In this case, simply swap the namespaces for DEV and TEST and remove the DEV line (as it is not relevant in a TEST system), i.e. turn:

<property name="http://0000954793-one-off.sap.com/YUWOFU8OY_">ns8</property>
<property name="http://0000954793-one-off.sap.com/Y2T9UWDOY_">ns10</property>

into

<property name="http://0000954793-one-off.sap.com/Y2T9UWDOY_">ns8</property>

That way, all your DEV fields now point to the TEST namespace.

If you're moving the other way (TEST to DEV), then your source WSDL will only contain the TEST system namespace mapping, e.g. 

<property name="http://0000954793-one-off.sap.com/Y2T9UWDOY_">ns10</property>

Likewise, all extension fields would be mapped to ns10:, e.g. ns10:Z_MyC4CExtensionField.

In this case, you have to add the DEV namespace and then swap the mapping, i.e. turn:

<property name="http://0000954793-one-off.sap.com/Y2T9UWDOY_">ns8</property>

into 

<property name="http://0000954793-one-off.sap.com/YUWOFU8OY_">ns8</property>
<property name="http://0000954793-one-off.sap.com/Y2T9UWDOY_">ns10</property>

How do you know that you need to put ns10? You don't, but you can simply use any namespace that is not already used in the mapping, so if you can't find ns10, simply use it.

Now save the mapping, re-zip it and upload it under References => Add.

If you kept everything else the same, it would overwrite your existing mapping, so you simply need to deploy and you're done.

Note 1: When moving from test to production, you can simply copy the iflow as the namespace is the same, so no mapping adjustment required.

Note 2: If you don't use any extension fields at all, the same as in the previous note applies - simply copy the iflow. If you have extension fields, but don't use them in your mapping, simply replace the WSDL in the message mapping (this will add/get rid of the DEV namespace while preserving your mapping automatically).
 

Tags