cancel
Showing results for 
Search instead for 
Did you mean: 

Client Adapter

sunilachyut
Contributor
0 Kudos

I have created a scenario http->xi->r/3 and everything is working as it should be. Currently am using an html file to test my scenario, however when I want move this scenario to qa/prod do I still use the same JavaScript code to invoke XI or is there any other way? The HTML file sometimes get correct response but sometimes it throws 500 Internal Server Error and shows message mapping as the issue. When I test the same test case with Runtime Workbench it works fine.

Thanks in advance for any suggestions.

Sunil Achyut

Accepted Solutions (1)

Accepted Solutions (1)

moorthy
Active Contributor
0 Kudos

Hi,

Have a look into this SAP Note- 804124,807000 .

Regards,

Moorthy

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Sunil,

you can Microsofts wfetch or following html requestor script:

<html>
 
<script type="text/javascript">;
<!--
function button1_onclick() {
var result = "Result: ";
var payload = "<?xml version="1.0" encoding="UTF-8" ?>"; 
// escape "http://"
var senderNamespace = escape(document.MessageParameters.SenderNamespace.value);
 
var reqString = "http://"
reqString = reqString + document.MessageParameters.Server.value+":";
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;
reqString = reqString + "&party=" + document.MessageParameters.SenderParty.value;
reqString = reqString + "&agency=" + document.MessageParameters.SenderAgency.value;
reqString = reqString + "&scheme=" + document.MessageParameters.SenderScheme.value;
reqString = reqString + "&QOS=" + document.MessageParameters.Qos.value;
reqString = reqString + "&sap-user=xiappluser&sap-password=xipass";
reqString = reqString + "&sap-client=" + document.MessageParameters.Client.value + "&sap-language=D";
 
var xhttp = new ActiveXObject("msxml2.xmlhttp"); 
xhttp.open ("POST", reqString, false);
 
if (document.MessageParameters.Source[0].checked == true) {
payload = "<?xml version="1.0" encoding="UTF-8" ?> "+ 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 = result + "n" + xhttp.responseText;
xhttp.close;
document.MessageParameters.response.value=result;
}
//-->
</script>
<head></head>
 
<body>
 
<h3>Client Http Adapter </h3>
<form name="MessageParameters">
<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="sapcoe01" size="20"/> </td>
<td width="10%"><label>ServerPort</label> </td>
<td width="22%"><input type="text" id="port" name="Port" value="8000" size="10"/> </td>
</tr>
<tr>
<td width="10%">Client</td>
<td width="22%">
<input type="text" id="client" name="Client" 
value="020" size="3"/></td>
<td width="10%"> </td>
<td width="22%"> </td>
</tr>
<tr>
<td width="10%"><label>SenderService</label> </td>
<td width="22%"><input type="text" id="senderService" 
name="SenderService" value="TravelAgencyCS" size="40"/> </td>
<td width="10%">QOS</td>
<td width="22%"><input type="text" id="qos" name="Qos" value="EO" size="4"/> </td>
</tr>
<tr>
<td width="10%"><label>SenderInterface</label> </td>
<td width="22%"><input type="text" id="senderInterface" 
name="SenderInterface" value="BookingOrdersOut" size="40"/> </td>
<td width="10%"><label>SenderNamespace</label> </td>
<td width="22%">
<input type="text" id="senderNamespace" 
name="SenderNamespace" value="http://sap.com/xi/rkt/CaseStudy/group99" 
size="40"/></td>
</tr>
</tbody>
</table>
 
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<h4>Optional Parameters</h4>
<tbody>
<tr>
<td width="10%">SenderParty</td>
<td width="22%"><input type="text" id="senderParty" name="SenderParty" 
size="40"/> </td>
</tr>
<tr>
<td width="10%">SenderAgency</td>
<td width="22%"><input type="text" id="senderAgency" name="SenderAgency" 
size="40"/> </td>
<td width="10%">SenderScheme</td>
<td width="22%"><input type="text" id="senderScheme" name="SenderScheme" 
size="40"/> </td>
</tr>
</tbody>
</table>
 
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<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"/> </td>
</tr>
</tbody>
</table>
<p>
<input type="button" value="Send" id="button1" name="button1" LANGUAGE="javascript" onclick="button1_onclick()"/>
</p>
<hr/>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<h4>Result</h4>
<tbody>
<tr>
<td width="50%"><textarea name="response" rows="5" cols="60"></textarea></td>
</tr>
</tbody>
</table>
</form>
 
</body>
 
</html>

Regards,

Udo

dirk_roeckmann
Participant
0 Kudos

Hi Sunil,

you can use every piece of software which can throw out an HTPP post request as trigger for the HTTP plain adapter of the XI.

Almost every script language has this possibility. Besides, many non SAP ERP systems have HTTP interfaces.

Hope this helps, if not tell us more about your scenario.

regards

Dirk