Hi guys,

Recently, I have come across a scenario where we needed to send some data from request payload to response payload for an Async-Sync bridge scenario. The approach I followed is described below:

Async Sync scenario from ECC (IDoc) to Database (JDBC) [IDoc –> JDBC (Synchronous Insert) –> IDoc]

Request from ECC IDoc to JDBC

JDBC Response to IDoc ECC

We have used Async Sync bridge module at the JDBC receiver channel – [alternative to BPM].

Requirement:

Some field values from the requesting outbound IDoc from ECC needed to be sent as a part of the response Inbound IDoc to ECC.

As the JDBC channel just gives insert_count information as response for INSERT statement, we needed to add the required values from request IDoc to response IDoc.

Solution:

To achieve this, we have implemented the following solution:

  1. The standard Async – Sync bridge modules inserted [RequestResponseBean and ResponseOnewayBean] at the receiver JDBC channel at proper sequence.

          /wp-content/uploads/2016/01/1_867058.jpg

    2. At the request message mapping, we have added the required values [to be sent back as response] as Dynamic configuration variables to the message header via setDCKey UDF.

          /wp-content/uploads/2016/01/2_867152.jpg

     3. The dynamic config keys which were set at the mapping runtime [step-2], were copied into Adapter module header variables [any name of our choice]. This is done via DynamicConfigurationBean module. (DCB1) And is done before the processing of RequestResponseBean module starts processing.

                    Parameter name              Parameter Value

                    Key.<num>                        write <dynamic config namespace> <dynamic config variable name>

                    Value.<num>                    module.<variable name>

              /wp-content/uploads/2016/01/3_867153.jpg

     4. After CallSapAdapter module of the JDBC adapter, the adapter module variables set at step 3 were read into the Dyncamic Configuration Variables of the response message header. This is done via DynamicConfiurationBean (DCB2) and this bean is used before the response oneway bean module gets processed. Parameter name              Parameter Value

                         Key.<num>                        read <dynamic config namespace> <dynamic config variable name>

                         Value.<num>                    module.<variable name>

     /wp-content/uploads/2016/01/4_867154.jpg

  5. Now we read the dynamic configuration keys of the message header set at step 4 into the response message mapping via getDCKey UDF, and send the required values from source request IDoc to the target response IDoc of the scenario.

      /wp-content/uploads/2016/01/5_867158.jpg

Code for the UDFs are given below:

public String setDCKey(String keyName, String keyValue, String dcNamespace, Container container) throws StreamTransformationException{

                AbstractTrace trace = container.getTrace();

                trace.addInfo(“Entering UDF: setDCKey”);

                try{

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

                DynamicConfigurationKey key = DynamicConfigurationKey.create(dcNamespace,keyName);

                conf.put(key,keyValue );

                }catch(Exception ex)

                {

                                trace.addWarning(“Exiting UDF: setDCKey with error. Error: “+ex.toString());

                                throw new StreamTransformationException(“Error in UDF setDCKey. Error: “+ex.toString());

                }

                return keyValue;

}

public String getDCKey(String keyName, String dcNamespace, Container container) throws StreamTransformationException{

                AbstractTrace trace = container.getTrace();

                trace.addInfo(“Entering UDF: getDCKey”);

                try{

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

                DynamicConfigurationKey key = DynamicConfigurationKey.create(dcNamespace ,keyName);

                return (conf.get(key));

                }catch(Exception ex)

                {

                                trace.addWarning(“Exiting UDF: getDCKey with error. Error: “+ex.toString());

                                throw new StreamTransformationException(“Error in UDF getDCKey. Error: “+ex.toString());

                }

}

And the RequestResponseBean and ResponseOnewayBean module parameters for async sync bridge:

/wp-content/uploads/2016/01/6_867159.jpg

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

    1. RAVI DAS Post author

      Actually we were not interested in changing the structure in our case. As every time some receiver webservice side structural change occurs – say addition of new fields – a new wsdl file comes with additional fields, then we need to make changes in the new wsdl file (to incorporate our concerned fields), and then upload it to ESR and rework the same. Changing the whole payload at the receiver adapter was not needed. Thanks.

      (0) 

Leave a Reply