package tutorial.sample19.client;

import java.io.IOException;
import javax.xml.rpc.ServiceException;

public class Main{

  public static void main( String[] args ){

    if( args.length == 1 ){
      new Main( args[0] );
    }else{
      throw new IllegalArgumentException( "URL of the service not specified" );
    }
  }

  public Main( String wsdlUrl ){
    try{
      HelloWorldService service = new HelloWorldService_Impl( wsdlUrl );

      HelloWorldServicePort port = 
        service.getHelloWorldServicePort( "admin", "adminadmin" );

      String result = port.helloSecureWorld();

      System.out.println( result );
    }catch( IOException e ){
      System.out.println( "Failed to create web service client:" + e );
    }catch( ServiceException e ){
      System.out.println( "Failed to create web service client:" + e );
    }
  }
}

