PI 7.30 HTTP Java Adapter Test Tools
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.
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:
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″><a>test</a></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:
Hi,
QOS available in this tool are Best effort and Exactly once. But as per the below link JAVA HTTP adapter support EOIO. Is there nay way by which i can use EOIO in HTTP adapter
http://help.sap.com/saphelp_nw73/helpdata/en/b8/dda4cf99694245a4f23b0257dcb9f6/content.htm
Hello Bill,
The download link seems to be missing post the new SCN. Can you share the new download link please. Thanks for your help.
Regards,
Bhavesh
During the conversion from SDN to SCN, formating and some HTML tags were lost. TEXTAREA, which was used to contain the code is no longer allowed in the new tool. I had to make changes to the blog to include the code.
Thanks for your prompt response Bill.
Just a quick note on the HTTP Post Client - , the function is commented and <script> tag is missing at the beginning. Probably a typo when you ported the code over.
Both HTTP Get and Post works like a charm.
Regards,
Bhavesh
Thanks, Bhavesh. I have corrected the error.
Regards,
Bill
Hi William
I am using your HTML code to post the data to PI using HTTP AAE. But I am getting the below error
"Error in processing caused by: com.sap.aii.adapter.http.api.HttpAdapterException: ERROR_IN_MODULECHAIN".
I did not find any solution for this problem in SDN.
Can you please tell me why I am getting this error.
Please double-check the HTTP comm chan configuration:
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/e4/a451e997364386a1f6f090c9ea17b6/frameset.htm
Regards,
William
Hi Indrajit,
Even i'm getting the same error "Error in processing caused by: com.sap.aii.adapter.http.api.HttpAdapterException: ERROR_IN_MODULECHAIN".
Were you able to resolve it?
Hi Rashmi,
I am getting the same error, can you please let me know the solution?
Regards,
Mani
Hi Indrajit,
I am getting the same error, can you please let me know the solution?
Regards,
Mani
Hi,
I've updated the HTML code in the blog with another one which combines POST and GET into a single HTML. Hopefully, this will also resolve the error. I have been using this without any problem.
Regards,
William Li
Hi William,
I am not getting any results, please let me know further on this.
Regards
Mani
Hi Mani,
I just did a re-test of the HTML, It executed successfully.
When the HTML is loaded, make sure you allow "blocked content" for the activeX control.
Make sure the QOS is "Best Effort" for synch interface.
Also, start on a new browser session. When you click on "Send", you should receive a request for username/password. If you did not, then the msg was never sent to PI. The HTML post was never executed.
Regards,
William
Hi Wiliam,
It was not asking me to provide user credential and the response was
"Error: ERROR_IN_MODULECHAIN;ERROR_IN_MODULECHAIN, senderChannel '7c398051ba61344d91f2eb48fa59ed62': Catching exception calling messaging system"
Also tried to publish data form source system :SAP Sourcing and got below error:
Sourcing was unable to publish Copy of Message to SAP ERP Server returned HTTP response code:500 for URL:http://HOST:PORT/HttpAdapter/HttpMessageServlet?interfaceNamespace=NAMESPACE&senderService=BUSINESS SYSTEM&qos=BE&interface=INTERFACE
Contact your system administrator
is it related to user authorization? if so please list of authorization if you know
or any other setting need to be done in PI? its plain HTTP request from Source system
PI Version 7.31 SP01
Regards,
Mani
Hi,
Have you tried using another adapter, e.g. SOAP, to see if error resulted? Just to eliminate possible problem with HTTP adapter.
Regards,
William
Hi Li,
I copy-n-paste the code that you provided in the blog.
as result, i can see the url generated, but not prompt was raised asking for credentials.
i started a new browser session and the option "allow Blocked content" was selected.
any idea??
Regards
Rodrigo
Thank you for this tool Wiliam!
Doing some tests with it I noticed that we are receiving back the generic "ERROR_IN_MODULECHAIN;ERROR_IN_MODULECHAIN" 500 error in the case where validation by the adapter is activated in the ICO and we are sending an invalid XML request.
On the old ABAP HTTP adapter instead of this generic error we would receive back an exact error description from the parser for the same interface and payload.
Do you know if this could be a faulty setting on our side or if it is a "feature" of the AAE adapter?
Thank you very much, it is working flawlessly.
For anyone interested, with a PI release of 7.1x:
Replace these lines in the beginning of the document (different parameter names) and use method "POST" to get it working with PI 7.1x
reqString = reqString + document.MessageParameters.Port.value + "/sap/xi/adapter_plain?";
reqString = reqString + "namespace=" + senderNamespace;
reqString = reqString + "&interface=" + document.MessageParameters.SenderInterface.value;
reqString = reqString + "&service=" + document.MessageParameters.SenderService.value;
Hi William,
I am trying to post to HTTP_AAE adapter on AEX, however server throws authorisation error.
What are the parameters to specify Basic authentication?
Thanks in advance,
Vikas
If you are using a browser, then you will be prompted for userid and password. If you are using a program, then you will have to do this programmatically.
There is no URL parameters to enter such information, as it is not secure.
Actually, there is.
Add Username and password to the URL with &j_username=USERNAME&j_password=PASSWORD
It does surely not offer any security and should be crosschecked with the security-responsible, but technically it works.
Thanks William for reply.
I have implemented Basic authentication but struggling with testing as I dont have authorisation for HTTP post.
@Everyone: Any help with testing will be helpful in releasing the tool to everyone.
https://sappihttpclient.codeplex.com/releases/view/612164
Thanks William, nice blog.
If did not receive a request for username/password. can using firefox HttpRequester to test the url.
William Li - Thanks for the wonderful informative blog! I see the code what you have shared will work only on IE. Have you shared or modified the code anytime after this so that its flexible on all the Web Browsers? We do not get any response URL or authentication pop up if used on Mozilla/Safari/Chrome. As I see for PI folks, by far this is the best tool for HTTP_AAE testing! 😉 . Kindly share your inputs with us!
Regards
Nitin
Hi,
I am using this tool to test HTTP_ AAE, it is not giving any response.
It displays only Error on Page.
I am trying it on IE.
Is it that ia ma missing any thing. Please help.
Thanks & Regards,
Akshay Ruia
Dear All,
I used the HTTP_AAE tool. But there is "ERROR_IN_MODULECHAIN" error. Anyone knows the reason? The pi version is 7.4 java single stack with AEX.
Appreciate your input.
Error:
Many thanks & best regards,
Hubery
Hubery,
Checkin module tab of your sender channel if you have Module as below , if still the problem persists you can raise a separate thread
br,
Manoj
The module name is existing. I will raise a new ticket. Thank Manoj for your timely reply.
Many thanks & best regards,
Hubery
Hi Hubery,
"Error in modulechain" refers to an execution error in the backend-system. At least that's my experience.
The following could help:
Hope that helps.
Cheers
Jochen
Dear Jochen,
Thank you for your advice. I just have a try. It does not work. Thank you again.
Many thanks & best regards,
Hubery
Hi Hubery,
What is the scenario you're using? http to SAP XI-Proxy or a SAP function module?
Cheers
Jochen
edit: perhaps we should discuss this in a separate thread. You can open up a new thread and post the link if you want