webMethods API를 이용해서 IntegrationServer의 shutdown 명령을 처리하는 방법
첨부의 소스에 서버접속 정보입력후 처리가능함
현재 8.0 버전 환경기준으로 첨부의 소스가 참고하는 lib는 wm-isclient.jar , wm-g11nutils.jar, enttoolkit.jar, mail.jar 임
SoftwareAG인스톨 경로의 common\lib 경로에서 찾을수 있습니다.
import com.wm.app.b2b.client.*;
import com.wm.util.*;
public class B2BShutdown {
public static String hostName = null;
public static String port = null;
public static String userName = null;
public static String password = null;
public static String errorMsg = null;
public static int numSecs = 15;
public static String tmpStr = null;
Context context = null;
public boolean connected = false;
public static void main(String[] args) {
errorMsg = "";
// Create an instance of this class
B2BShutdown b2bServer = new B2BShutdown();
System.out.println();
b2bServer.connect(true);
if (!b2bServer.connected) {
System.exit(1);
}
b2bServer.shutdown();
b2bServer.disconnect();
System.exit(0);
}
public void connect(boolean dispMsg) {
context = new Context();
try {
System.out.println("Try to connect .....");
context.connect("127.0.0.1:5555", "test", "test");
// context.connect(hostName + ":" + port, userName, password);
connected = true;
} catch (Exception e) {
System.out.println("General Exception");
// System.out.println(e.toString());
}
}
public void shutdown() {
try {
System.out.println("Shutting down B2B Server... ");
Values input = new Values();
input.put("option", "force");
context.invoke("wm.server.admin", "shutdown", input);
} catch (ServiceException e) {
System.out.println(e.toString());
System.exit(1);
}
}
/***********************************************************************/
/* Delay printing the console message until the server is really down. */
/***********************************************************************/
public void disconnect() {
for (int iCtr = 0; (connected) && (iCtr < 3); iCtr++) {
context.disconnect();
try {
Thread.sleep(numSecs * 1000);
} catch (InterruptedException ie) {
}
connect(false);
}
if (context != null)
context.disconnect();
System.out.println("B2B Server shutdown complete.");
}
public B2BShutdown() {
System.out.println();
System.out.println("******B2B Server shutdown utility*******");
System.out.println();
}
}
'EAI > webMethods' 카테고리의 다른 글
| [webMethods] SAP Adapter Listener 연결오류 관련 (1) | 2013.08.05 |
|---|---|
| [webMethods] Apache HTTPClient 라이브러리를 활용한 webMethods TN receive 호출 샘플소스 (0) | 2013.08.05 |
| [webMethods] [사례] SAP PI와의 인터페이스(웹서비스) (0) | 2013.08.02 |
| [webMethods] Java서비스에서 server LOG에 Write할때 (0) | 2013.08.01 |
| [webMethods] stats Log 각 필드 의미 (0) | 2013.08.01 |
