package dk.daoas.PumpClient; import org.datacontract.schemas._2004._07.DaoMqPump2.StatusData; import org.tempuri.RemoteControlLocator; import Samples.ServiceModel.Microsoft.IRemoteControl; public class PumpClientMain { final static int EXIT_OK = 0; final static int EXIT_WARN = 1; final static int EXIT_CRIT = 2; final static int EXIT_UNKNOWN = 3; public static void main(String[] args) { if (args.length != 1) { System.out.println("Missing Commandline argument: transport name" ); System.exit(EXIT_CRIT); } try { RemoteControlLocator loc = new RemoteControlLocator(); IRemoteControl remote = loc.getBasicHttpBinding_IRemoteControl(); StatusData status = remote.getTransportStatus( args[0] ); if (status.getTransportEnabled() == true) { if (status.getLastrunOk() == true) { System.out.println("Transport running OK"); System.exit(EXIT_OK); } else { System.out.println("Transport error: " + status.getLastErrorMessage() ); System.exit(EXIT_CRIT); } } else { System.out.println("Transport disabled"); System.exit(EXIT_WARN); } System.out.println( status.getTransportEnabled() ); } catch (Exception e) { System.out.println("Communication error: " + e.getMessage() ); System.exit(EXIT_UNKNOWN); } } }