Skip to Content
Author's profile photo Diogo Awaihara

Using DynamicConfiguration to Receiver HTTP_AAE (IDOC to HTTP_AAE)

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

Assigned tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thank You for the blog.

      Author's profile photo Former Member
      Former Member

      Nice Blog Diogo..... Keep Posting

      Author's profile photo Former Member
      Former Member

      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

      Author's profile photo Mark Dihiansan
      Mark Dihiansan

      Hi WLAF,

      The format is as follows:

      http(s)://host:port/path?queryStringParams

      Take the SOAP sender for example:

      http://test.com:50000/XISOAPAdapterMessageServlet?channel=p:s:c

      host: test.com

      port: 50000

      path: /XISOAPAdapterMessageServlet

      queryString: channel=p:s:c

      Regards,

      Mark

      Author's profile photo Wilbert Karremans
      Wilbert Karremans

      Hi Mark

      (I use my new scn account).

      This is not a SOAP channel. I use the exact same adapter as mentioned in this blog. Any ideas?

      Wilbert

      Author's profile photo Mark Dihiansan
      Mark Dihiansan

      Hi W,

      It was just an example. Here is an example where a query string is used

      www.webservicex.net/stockquote.asmx/GetQuote?symbol=HPQ

      The URL above points to a webservice that returns the stocks based on the symbol value, in this case HPQ. Based on that, the settings for the HTTP_AAE should be

      Host: www.webservicex.net

      Port: 80

      Path: /stockquote.asmx/GetQuote

      symbol should be placed in URLParamOne.

      Regards,

      Mark

      Author's profile photo Wilbert Karremans
      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

      Author's profile photo Wilbert Karremans
      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

      Author's profile photo Former Member
      Former Member

      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.

      Author's profile photo Diogo Awaihara
      Diogo Awaihara
      Blog 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

      Author's profile photo Former Member
      Former Member

      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 "";

      Author's profile photo Sonam Ramsinghani
      Sonam Ramsinghani

      Hi Ceren,

      Did your configuration work? I have similar scenario like i have to add 10 parameters dynamically but its giving  below error.

      "Transmitting the message using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.aii.adapter.http.api.HttpAdapterException: ERROR_OUTBOUND_PROCESSING, while trying to load from index 1 of an object array with length 1, loaded from local variable params".