HTTP_AAE Sender Adapter를 만든 후 Test 해보고 싶을 때 아래 코드로 .html 파일로 만든 후에 호출 하면 된다.
주의점은 해당 소스는 HTTP Adapter가 아닌 HTTP_AAE Adapter다.
HTML AAE Test 730 Post
<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; reqString = reqString + "&" + document.MessageParameters.MainPayload.value + "="; reqString = reqString + encodeURIComponent(document.MessageParameters.xmlData.value); var xhttp = new ActiveXObject("msxml2.xmlhttp"); xhttp.open ("GET", 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; } //--> </script> <head></head> <body> <h3>Client HTTP_AAE Adapter Test - Get </h3> <form name="MessageParameters"> <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> <label>Main Payload Parameter Name:</label> <input type="text" id="mainPayload" name="MainPayload" value="" size="40" /> <P> <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="6" name="URL" cols="104"></textarea></p> Response Text: <textarea name="response" rows="5" cols="100"></textarea> </form> </body> </html>
HTML AAE Test 730 Get
<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"); 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; } //--> </script> <head></head> <body> <h3>Client HTTP_AAE Adapter Test - Post </h3> <form name="MessageParameters"> <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>
'EAI > XI/PI' 카테고리의 다른 글
[XI/PI] Introduction to Context Handling in Message Mapping (0) | 2013.08.07 |
---|---|
[XI/PI] JDBC Adapter "Database Transaction Level" Setting (0) | 2013.08.05 |
[XI/PI] FILE ADAPTER에서 파일명 얻어오는 방법 (0) | 2013.08.01 |
[XI/PI] About PI Queue (0) | 2013.08.01 |
[XI/PI] Soap Adapter 인증없이 사용하기 (1) | 2013.07.29 |