Skip to Content

Objective

An interface should be created to send an IDOC to a legacy system using HTTP, post request method with three key fields (in this order):

  1. request: fixed value
  2. directory: fixed value
  3. filename: value will be dynamically configured using IDOC number

HTTP_AAE Communication Channel

To accomplish that we need to create a Receiver HTTP_AAE Communication Channel, setting Message Protocol = POST and all the Destination and Security information.

HTTP_AAE_1.png

After that, in “Advanced” tab, scrolling down, in the Adapter-Specific Message Properties, we mark “Set Adapter-Specific Message Properties” and “URL Parameters”:

  1. Parameter 1 (URLParamOne): request
  2. Parameter 2 (URLParamTwo): directory
  3. Parameter 3 (URLParamThree): filename

HTTP_AAE_2.png

DynamicConfiguration

To dynamically set all three parameters, I use Message Mapping and UDF, but it is possible to use the same code for Java Mapping as well.

The UDF should have three input parameters that will be used to dynamically set HTTP_AAE parameters values:


public String setDynamicURLParameters(String request, String directory, String filename, Container container) throws StreamTransformationException{
//Get the dynamic configuration from the container
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//Create the URLParamOne key in namespace http://sap.com/xi/XI/System. This key will hold the dynamically created request parameter
DynamicConfigurationKey keyParam1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System", "URLParamOne");
//Create the URLParamTwo key in namespace http://sap.com/xi/XI/System. This key will hold the dynamically created directory  parameter
DynamicConfigurationKey keyParam2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System", "URLParamTwo");
//Create the URLParamThree key in namespace http://sap.com/xi/XI/System. This key will hold the dynamically created filename parameter
DynamicConfigurationKey keyParam3 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System", "URLParamThree");
//Put the parameters values from the input in the configuration under the specified key
conf.put(keyParam1, request);
conf.put(keyParam2, directory);
conf.put(keyParam3, filename);
return filename;
}


To use the UDF, we create a Variable by right clicking the root element and choosing “Add Variable”:

HTTP_AAE_3.png

Finally, for this Variable mapping we create two Constants to set the first two Parameters that will have fixed values and push DOCNUM of IDOC structure from source message to use as the third parameter, filename.

HTTP_AAE_4.png

We can check in SXI_MONITOR the parameters set in DynamicConfiguration.

HTTP_AAE_5.png

To report this post you need to login first.

11 Comments

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

  1. W.L.A.F. Karremans

    Hi Diogo,

    This is exactly what I need. I have my parameters in the DynamicConfiguration, but I do not know how to define the path in the channel. I have 4 URLParm parameters: login, password, method and order_ref. I tried many things, but I was not able to figure this out.

    my path looks like:

    ?/login=username&password=pw123456&method=accept_order&order_ref=M12345678

    Example: URLParamOne contains value login=username

    Any help is appreciated,

    Wilbert

    (0) 
      1. Wilbert Karremans

        Hi Mark

        I am not using the SOAP adapter. I use the HTTP (Post) adapter as shown in the blog.

        Any help is welcome regarding to the setup for the path. I am able to see the values for my 4 parameters in DynamicConfiguration.

        Wilbert

        (0) 
    1. Wilbert Karremans

      With the help of Mark I found the correct solution. We are running PI 7.30 SP5.

      First of all, I mentioned in my example the path like:

      ?/login=username&password=pw123456&method=accept_order&order_ref=M12345678

      That must be:

      /?login=username&password=pw123456&method=accept_order&order_ref=M12345678


      When passing my parameters dynamically, the following was successful:


      1) path name contains only a / (do not put ? or &)

      2) pass only the values for the parameter in the UDF (in the beginning I passed both keyword and value).

      3) Within the ASMP you specify the keywords

      In my example:

      Parameter 1 (URLParamOne): login

      Parameter 2 (URLParamTwo): password

      Parameter 3 (URLParamThree): method

      Parameter 4 (URLParamFour): order_ref

      I found out that it is does not support a password containing a &. Even when a use %26 instead of a & it did not work. I have to avoid using a & in the password.

      Wilbert

      (0) 
  2. Danisay Vujovic

    Hello! Diogo Awaihara

    I have the same scenario IDOC sender to HTTP_AAE Receiver, but I do not know how to design in ESR, should have the same structure xml either side? i must use java mapping ? Please can you help me with esta scenario.

    Danisay.

    (0) 
    1. Diogo Awaihara Post author

      Hello Danisay.

      That depends on the requirements from the receiver side.

      In my case, I kept the same structure, so no special mapping here (besides the Variable + UDF).

      Regards,

      Diogo

      (0) 
  3. ceren ├žetin

    Hello I need to send request parameters in URL. My UDF is the below , But it does not working.

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

    DynamicConfigurationKey parmValue;

    //the url below is not the one in the real coding due to security reason

    String url = “http://production.shippingapis.com/ShippingAPI.dll?API=RateV4”;

    // TargetURL

    parmValue = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/HTTP_AAE”, “TargetURL”);
    conf.put(parmValue, url);

    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”,”UrlParamOne”);

    conf.put(parmValue, var1);

    parmValue = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/HTTP_AAE”, “UrlParamTwo”);

    conf.put(parmValue, var2);

    parmValue = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/HTTP_AAE”, “UrlParamThree”);

    conf.put(parmValue, var3);

    parmValue = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/HTTP_AAE”,”UrlParamFour”);

    conf.put(parmValue, var4);

    parmValue = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/HTTP_AAE”,”UrlParamFive”);

    conf.put(parmValue, var5);

    parmValue = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/HTTP_AAE”,”UrlParamSix”);

    conf.put(parmValue, var6);

    String extension = “urlext”;

    // Additional field

    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”,”SAP_URL_EXTENSION”);

    conf.put(parmValue, extension);

    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”, “urlext01=”);

    conf.put(parmValue, var7);

    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”, “urlext02=”);

    conf.put(parmValue, var8);
    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”, “urlext03=”);

    conf.put(parmValue, var9);

    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”, “urlext04=”);

    conf.put(parmValue, var10);
    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”, “urlext05=”);

    conf.put(parmValue, var11);

    parmValue = DynamicConfigurationKey.create( “http://sap.com/xi/XI/System/HTTP_AAE”, “urlext06=”);

    conf.put(parmValue, var12);

    return “”;

    (0) 

Leave a Reply