@setlocal
@echo off
     
@if "%BPWS4J_HOME%"=="" goto environerror
@if "%JAVA_HOME%"=="" goto environerror

@set ENDPOINT=%1
@if "%ENDPOINT%"=="" goto help
@set OPERATION=%2
@if "%OPERATION%"=="" goto help
@set OPERATOR1=%3
@set OPERATOR2=%4

@set CP=%BPWS4J_HOME%\lib\bpws4j-samples.jar
@set CP=%CP%;%BPWS4J_HOME%\lib\soap.jar
@set CP=%CP%;%BPWS4J_HOME%\lib\xml-apis.jar
@set CP=%CP%;%BPWS4J_HOME%\lib\xercesImpl.jar
@set CP=%CP%;%JAVA_HOME%\lib\tools.jar
@set CP=%CP%;%CLASSPATH%
@%JAVA_HOME%\jre\bin\java -classpath %CP% samples.atm.ATM %ENDPOINT% %OPERATION% %OPERATOR1% %OPERATOR2%
@goto end

:environerror
  @echo. 
  @echo BPWS4J ATM Sample
  @echo   An error occurred when invoking the sample.  Please set your BPWS4J_HOME and JAVA_HOME environment variables before continuing.
  @echo. 
  @goto end
   
:help
  @echo. 
  @echo BPWS4J ATM Sample
  @echo   "Usage: ATMSample <runtime-URL> (connect|disconnect <id>|status <id>|logon <id> <name>|logoff <name>|deposit <name> <amount>|withdraw <name> <amount>)"
  @echo. 
  @goto end

:end
   @endlocal
   @echo on

