package tutorial.sample23.client;

import java.util.List;
import java.util.ArrayList;

import java.io.IOException;

import javax.xml.namespace.QName;

import javax.xml.rpc.ServiceException;
import javax.xml.rpc.Stub;

public class Main{

  public static void main( String[] args ){

    System.setProperty( "weblogic.webservice.verbose", "true" );

    if( args.length == 1 ){
      new Main( args[0] );
    }else{
      throw new IllegalArgumentException( "URL of the service not specified" );
    }
  }

  public Main( String routerURL ){
    try{
      SimpleTest service = new SimpleTest_Impl();
      SimpleTestSoap port = service.getSimpleTestSoap();

      ((Stub)port)._setProperty( Stub.ENDPOINT_ADDRESS_PROPERTY, routerURL );

      String result = port.echoString( "hi there" );

      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 );
    }
  }
}

