JAX客户端代码

JAX是webservice常用的工具,下面是JAX客户端配置的过程

1.事前准备
lib包:
jaxws-api.jar
jaxws-rt.jar
streambuffer.jar
jaxb-impl.jar
stax-ex.jar
(这些只是我在项目中新加的包,其它需要的包因为项目本就存在,所以不做测试)
下载地址: http://download.csdn.net/detail/gdclx/4963199

2.客户端代码生成:
wsimport -keep -s c:/develop -p test.client http://127.0.0.1:8080/services/WebService?wsdl

3.生成后客户端调用方法:
public static void main(String[] args) {
		String username = "username";
		String password = "password";
		WebServiceImplService service = new WebServiceImplService();
		IWebService client = service.getWebServiceImplPort();
        String reply =  client.queryMethod(username,password);
        System.out.println(reply);
	}

你可能感兴趣的:(java,webservice,jax)