SOAPMessageV2 MID 서버 예
MID 서버를 통해 아웃바운드 SOAP 메시지를 보낼 수 있습니다.
MID 서버를 통해 메시지를 보내면 방화벽 뒤나 개인 네트워크 내에 있는 엔드포인트에 액세스할 수 있습니다. MID Server를 통해 전송되는 모든 SOAP 메시지는 비동기식입니다.
var requestBody;
var responseBody;
var status;
var sm;
try{
sm = new sn_ws.SOAPMessageV2("StockQuote", "GetQuote"); // Might throw exception if message doesn't exist or not visible due to scope
sm.setBasicAuth("admin","admin");
sm.setStringParameter("symbol", "NOW");
sm.setStringParameterNoEscape("xml_data","<data>test</data>");
sm.setMIDServer('mid_server_name');
response = sm.execute();//Might throw exception if http connection timed out or some issue with sending request itself because of encryption/decryption of password and stuff
response.waitForResponse(60);// In Seconds, Wait at most 60 seconds to get response from ECC Queue/Mid Server //Might throw exception timing out waiting for response in ECC queue
responseBody = response.haveError() ? response.getErrorMessage() : response.getBody();
status = response.getStatusCode();
} catch(ex) {
responseBody = ex.getMessage();
status = '500';
} finally {
requestBody = sm ? sm.getRequestBody():null;
}
gs.info("Request Body: " + requestBody);
gs.info("Response: " + responseBody);
gs.info("HTTP Status: " + status);