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();
	}
}




Posted by INSPIEN
,