super(WSDL_LOCATION, SERVICE, features);异常

本文详细介绍了如何通过降低jax-ws规约版本至jax-ws2.1,使得代码能够在java6环境下正常编译和执行。重点解决了因版本不兼容导致的构造函数错误,并提供了具体的命令操作步骤。
[url]http://ahaoo0712.iteye.com/blog/1452688[/url]

其不能正常编译通过是由于jax-ws2.2规约与java6冲突。 但程序又不能仅以java5来编译,故需要降低jax-ws规约版本,可以这样处理: 执行命令
wsdl2java -frontend jaxws21 -client *.xml

这样以jax-ws2.1生成的代码就可以在java6中编译通过并可执行。修改 *_Client.java,这个是测试的主方法,录入参数执行,即可调用远程服务.



注:我将这两次生成的客户端代码进行比较,唯一的区别就是用后者生成的客户端代码将报错的3个构造函数移除了。也就是说,我们只需要将这3个出错的构造器删除就可以处理此异常。
package com.fh.proxy.xjhis; import com.fh.util.hc.SysPartyRules; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; import javax.xml.ws.Service; /** * This class was generated by Apache CXF 3.1.14 * 2022-05-30T16:37:01.390+08:00 * Generated source version: 3.1.14 * */ @WebServiceClient(name = "LABService", // wsdlLocation = "http://172.16.97.6/ZYZLService/LabInterface/LABService.svc?wsdl", targetNamespace = "http://tempuri.org/") public class LABService extends Service { public final static URL WSDL_LOCATION; public final static QName SERVICE = new QName("http://tempuri.org/", "LABService"); public final static QName BasicHttpBindingILABService = new QName("http://tempuri.org/", "BasicHttpBinding_ILABService"); static { URL url = null; String str = SysPartyRules.XJHIS_URL; try { url = new URL(str); } catch (MalformedURLException e) { java.util.logging.Logger.getLogger(LABService.class.getName()) .log(java.util.logging.Level.INFO, "Can not initialize the default wsdl from {0}", str); } WSDL_LOCATION = url; } public LABService(URL wsdlLocation) { super(wsdlLocation, SERVICE); } public LABService(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public LABService() { super(WSDL_LOCATION, SERVICE); } public LABService(WebServiceFeature ... features) { super(WSDL_LOCATION, SERVICE, features); } public LABService(URL wsdlLocation, WebServiceFeature ... features) { super(wsdlLocation, SERVICE, features); } public LABService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { super(wsdlLocation, serviceName, features); } /** * * @return * returns ILABService */ @WebEndpoint(name = "BasicHttpBinding_ILABService") public ILABService getBasicHttpBindingILABService() { return super.getPort(BasicHttpBindingILABService, ILABService.class); } /** * * @param features * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. * @return * returns ILABService */ @WebEndpoint(name = "BasicHttpBinding_ILABService") public ILABService getBasicHttpBindingILABService(WebServiceFeature... features) { return super.getPort(BasicHttpBindingILABService, ILABService.class, features); } } 中文解释一下
最新发布
06-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值