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

@set ENDPOINT=%1
@if "%ENDPOINT%"=="" goto help
@set FIRSTNAME=%2
@if "%FIRSTNAME%"=="" goto help
@set LASTNAME=%3
@if "%LASTNAME%"=="" goto help
@set AMOUNT=%4
@if "%AMOUNT%"=="" goto help

@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.loanapproval.Customer %ENDPOINT% %FIRSTNAME% %LASTNAME% %AMOUNT%
@goto end

:environerror
  @echo. 
  @echo BPWS4J Loan Approval 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 Loan Approval Sample
  @echo   "Usage: LoanApprovalSample <runtime-URL> <first-name> <last-name> <amount>"
  @echo. 
  @goto end

:end
   @endlocal
   @echo on

