SAP PI – Dynamic SOAP action using DynamicConfiguration and ASMA settings


SAP PI allows to set soap action dynamically when you want to use single receiver soap adapter and change soap action dynamically. SAP PI provides DynamicConfiguration API which works with help of ASMA (Adapter Specific Message Attribute) settings.

Scenario: A receiver interface contains multiple operations is used to configure a scenario where there is single SOAP adapter on receiver end. Using single adapter you want to call multiple web service operations from SAP PI. This means to call individual operation / method of target WS via soap action residing on same location.

Output: Dynamic Configuration will add specified Soap Action to WS Soap Header at runtime while sending out request.

Procedure for ASMA settings is as follows –

  • Write a UDF (User Defined Function) in message mapping and map  to target parent node. Use code in UDF as follows.

DynamicConfigurationKey key = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/SOAP“,”THeaderSOAPACTION“);

DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get (StreamTransformationConstants.DYNAMIC_CONFIGURATION);

String soapAction = http://abc.com/acon/service/1.0/IServiceOut/AddNote”; conf.put(key, soapAction);

return “”;

  • Go to receiver SOAP communication channel and perform following.

Go to Advanced Tab -> Check ‘Use Adapter Specific Message Attributes’ -> Check ‘Variable Transport Binding’ ->Variable Header (XHeaderName1) = THeaderSOAPACTION
Go to General Tab and keep SOAP Action empty.

  • Activate scenario and test it.

In case, if you get multiple soap actions in Web Service Soap Header as an output as shown below. Apply SAP Note 1255400.

POST /BeaconService/BeaconService.svc HTTP/1.0
Accept: */*
Host: training.com:8080
User-Agent: SAP-Messaging-com.sap.aii.af.sdk.xi/1.0505
content-id: <soap-001CC4FC74A51EE18DF87E8066A44800@sap.com>
Content-Type: text/xml; charset=utf-8
Content-Length: 277
SOAPACTION:
SOAPACTION: http://abc.com/acon/service/1.0/IServiceOut/AddNote

Let me know for no obligation consulting assistance. Leave your comments for feedback or discussion.