Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

At PI 7.11 and before, the HTTP adapter is an ABAP adapter. PI 7.3 introduces a new HTTP adapter (HTTP_AAE) based on the java stack, using the java Adapter Framework.

In this blog, we will take a look at a couple of test tools that we can use to test the HTTP_AAE adapter.

Introduction

In PI 7.3, in addition to the exiting HTTP adapter in ABAP, a java adapter (HTTP_AAE) has also been added. This new java adapter uses a java service to send the payload to the AAE of PI 7.3. The java adapter also provides two different methods of sending the payload, GET and POST, therefore, the need for 2 different test tools.

One of the benefits of using the HTTP_AAE adapter is to bypass the ABAP stack during message processing, which can increase the performance by as much as 10X. In addition, this adapter is a must-use when we install a java-only PI system without ABAP.

HTTP_AAE Adapter Overview

The URL to send the payload will be generated by the test tool with the following information. This is also the URL used for POST.

http://server:port/HttpAdapter/HttpMessageServlet?interfaceNamespace=sender-interface-namespace&inte...

    sender-business-component-name               

          Business Component name or Business System name used in the Integrated Configuration

    quality-of-service

          must be either BE or EO

With GET, the following URL is generated by the test tool. It is identical to the *POST* URL, except for the last parameter:

http://server:port/HttpAdapter/HttpMessageServlet?interfaceNamespace=sender-interface-namespace&inte...

    Main-Payload-Parameter-Name

          the Main Payload Parameter Name used in the HTTP_AAE communication channel configuration

    the pay load

          must be URL encoded so that special characters, e.g. "<" and ">" can be sent without problem.

  • POST

Sample input screen:

Sample result screen, with response:

The HTML code has been updated to combine POST and GET into a single HTML.

HTML code which can be copy-n-pasted to a file with a file extension of .html, e.g. http_aae_Test_730.html.


<html>


<script type="text/javascript">;
<!--
function button1_onclick() {
  var result = "";
  var payload = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
  var senderNamespace = escape(document.MessageParameters.SenderNamespace.value);


  var reqString = "http://"
  reqString = reqString + document.MessageParameters.Server.value+":";
  reqString = reqString + document.MessageParameters.Port.value + "/HttpAdapter/HttpMessageServlet?";
  reqString = reqString + "interfaceNamespace=" + senderNamespace;
  reqString = reqString + "&interface=" + document.MessageParameters.SenderInterface.value;
  reqString = reqString + "&senderService=" + document.MessageParameters.SenderService.value;
  reqString = reqString + "&qos=" + document.MessageParameters.Qos.value;
  var xhttp = new ActiveXObject("msxml2.xmlhttp");
  if (document.MessageParameters.getpost.value == "GET") {
   reqString = reqString + "&" + document.MessageParameters.MainPayload.value + "=";
   reqString = reqString + encodeURIComponent(document.MessageParameters.xmlData.value);


   xhttp.open ("GET", reqString, false);
  }
  else {
xhttp.open ("POST", reqString, false);
  }
  document.MessageParameters.URL.value=reqString;


  if (document.MessageParameters.Source[0].checked == true) {
    payload = document.MessageParameters.xmlData.value;
   xhttp.send (payload);
  }
  else{
    var xmlDoc = new ActiveXObject("microsoft.xmldom");
   xmlDoc.async=false;
   xmlDoc.load (document.MessageParameters.xmlFile.value);
   xhttp.send (xmlDoc);
  }
  result = xhttp.responseText;
  xhttp.close;
  document.MessageParameters.response.value=result;
}


function getFile() {
  var mypath = document.MessageParameters.xmlFile.value;
var ForReading  = 1;
objFSO          = new ActiveXObject("Scripting.FileSystemObject");
objTextFile     = objFSO.OpenTextFile(mypath, ForReading);


var filearray   = "";


for(var n=0;!objTextFile.AtEndOfStream;n++) {
  sRead = objTextFile.ReadLine();
  filearray += sRead + "\n";
}
objTextFile.Close();


document.MessageParameters.xmlData.value = filearray;
}


function showHide() {
if (document.MessageParameters.getpost.value == "GET") {
  document.getElementById("parameter").style.display = "block";
  document.MessageParameters.URL.rows = 6;
}
else {
  document.getElementById("parameter").style.display = "none";
  document.MessageParameters.URL.rows = 2;
}
}


//-->
</script>
<head></head>


<body>


<h3>Client HTTP_AAE Adapter Test</h3>
<form name="MessageParameters">
<label>Method:</label>
<select name="getpost" onchange="showHide()">
<option value="POST" SELECTED>POST</option>
<option value="GET" >GET</option>
</select>
<div id="parameter" style="display:none;">
   <label>Main Payload Parameter Name:</label>
   <input type='text' id='mainPayload' name='MainPayload' value='' size='40' />
   <br>(Caution:  The query string size is limited.  The payload should be less then 1000 characters.)
</div>
<p>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
   <h4>Header</h4>
    <tbody>
    <tr>
      <td width="10%"><label>ServerHost</label> </td>
      <td width="22%"><input type="text" id="host" name="Server" value="" size="20" /> </td>
      <td width="10%"><label>ServerPort</label> </td>
      <td width="22%"><input type="text" id="port" name="Port" value="" size="10" /> </td>
    </tr>
    <tr>
      <td width="10%"><label>SenderService</label> </td>
      <td width="22%">
      <input type="text" id="senderService" name="SenderService" value="" size="40" /> </td>
      <td width="10%">QOS</td>
      <td width="22%">
  <select id="qos" name="Qos">
  <option value="BE" selected>Best Effort</option>
  <option value="EO" >Exactly Once</option>
  </select>
      </td>
    </tr>
    <tr>
      <td width="10%"><label>SenderInterface</label> </td>
      <td width="22%">
      <input type="text" id="senderInterface" name="SenderInterface" value="" size="40" /> </td>
      <td width="10%"><label>SenderNamespace</label> </td>
      <td width="22%">
      <input type="text" id="senderNamespace" name="SenderNamespace" value="" size="40" /></td>
    </tr>
  </tbody>
  </table>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
   <br>
   <h4>Payload</h4>
    <tbody>
    <tr>
      <fieldset style="padding: 2">
       <td width="50%"><input type="radio" name="Source" value="Textarea" checked="checked" />Type in XML</td>
       <td width="50%"><input type="radio" name="Source" value="File" />Upload File</td>
      </fieldset>
    </tr>
    <tr>
      <td width="50%"><textarea name="xmlData" rows="10" cols="60">&lt;a&gt;test&lt;/a&gt;</textarea></td>
      <td width="50%"><input type="file" name="xmlFile" size="40"  onChange="return getFile()" /> </td>
    </tr>
   </tbody>
  </table>
  <p>
  <input type="button" value="Send" id="button1" name="button1" LANGUAGE="javascript" onclick="button1_onclick()" />
  </p>
  <hr />
  <h4 align="left">Result</h4>
  <p align="left">URL: <textarea rows="2" name="URL" cols="104"></textarea></p>
  Response Text:
  <textarea name="response" rows="5" cols="100"></textarea>
</form>


</body>


</html>



  • GET

Sample input screen:

Sample result screen, with response:

31 Comments