使MyEclipse调用Axis的wsdl2java 通过wsdl生成客户端

之前喝别人对接系统的时候,别人给了个wsdl文档,让我对接。如何使用wsdl生成客户端测试代码呢?本来通过myeplise直接生成的,但是由于wsdl文档不完整,生成失败!所以想着利用axsi去生成。下面看步骤:

1、导入所需要的jar


 2、设置主方法参数

主方法必须是WSDL2Java



arguments:设置wsdl文档的连接地址

other:表示测试代码生成的路径 

3、点击Run进行测试代码生成。

 

4、编写测试代码测试

以上代理类都生成了,但是怎么用呢?

import com.yiliaosoft.health.heartElect.front.webservice.IFrontProxyAPIRemoteHandlerLocator;
import com.yiliaosoft.health.heartElect.front.webservice.IFrontProxyAPIRemoteHandlerPortType;

public class Test {
	public static void main(String[] args) throws Exception{
		//IFrontProxyAPIRemoteHandler是接口名称,也就是wsdl文档的名字:IFrontProxyAPIRemoteHandler
		IFrontProxyAPIRemoteHandlerLocator servince = new IFrontProxyAPIRemoteHandlerLocator();//生成代理服务
		IFrontProxyAPIRemoteHandlerPortType client = servince.getIFrontProxyAPIRemoteHandlerHttpPort();//生成代理客户端
		String xmlDoc = client.getDemoInfo();//此处为ws提供的方法
		String xmlDoc2 = client.getDemoInfo2("测试啊!hello");//此处为ws提供的方法
		System.out.println(xmlDoc+"---->"+xmlDoc2);
	}
}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值