wsimport -s F:\temp -p cn.ljl.sand.jws.chapter3.client.wsimport http://localhost:6666/service/interpret?wsdl
wsimport -d F:\temp -clientjar interpret-wsimport.jar -p cn.ljl.sand.jws.chapter3.client.wsimport http://localhost:6666/service/interpret?wsdl
package cn.ljl.sand.jws.chapter3.client; import java.net.MalformedURLException; import java.net.URL; import org.junit.Assert; import org.junit.Test; import cn.ljl.sand.jws.chapter3.client.wsimport.InterpretService; import cn.ljl.sand.jws.chapter3.client.wsimport.InterpretServiceImplService; public class WSIClient { @Test public void test() { InterpretServiceImplService ss = new InterpretServiceImplService(); InterpretService service = ss.getInterpretServiceImplPort(); String chnum = service.interpret(112358); Assert.assertEquals("一一二三五八", chnum); } @Test public void test2() throws MalformedURLException { URL url = new URL("http://localhost:6666/service/interpret?wsdl"); InterpretServiceImplService ss = new InterpretServiceImplService(url); InterpretService service = ss.getInterpretServiceImplPort(); String chnum = service.interpret(112358); Assert.assertEquals("一一二三五八", chnum); } }
原文:http://www.cnblogs.com/ywjy/p/5196064.html