동적으로 스텁을 생성해서 웹서비스를 콜할수 있는 클라이언트 예제

AXIS 패키지 사용

src
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;


public static void main(String[] args) throws ServiceException,
    MalformedURLException, RemoteException 
{
  Service service = new Service();
  Call call = (Call) service.createCall();
  call.setTargetEndpointAddress(new URL("http://localhost:9090/axis/DiceWS.jws?wsdl"));
  call.setOperationName("getRandomNumber");
    
  int[] result = (int[]) call.invoke(new Object[]{new Integer(6), new Integer(5)});
  for(int i = 0; i < result.length; i++)
    System.out.println(result[i]);
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2008-08-27 17:32:32
Processing time 0.0078 sec