加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 生成Web服务客户端时出现Apache意外的子元素异常

发布时间:2020-05-25 13:24:36 所属栏目:Java 来源:互联网
导读:我正在尝试使用来自axis2(版本1.6.1)的wsdl2 java生成一个Web服务客户端. ./wsdl2java.sh -uri http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/v2.0/efetch_snp.wsdl 当我打电话给这项服务时,我得到一个例外. org.apache.axis2.AxisFault:org.apache.axis2

我正在尝试使用来自axis2(版本1.6.1)的wsdl2 java生成一个Web服务客户端.

./wsdl2java.sh -uri http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/v2.0/efetch_snp.wsdl

当我打电话给这项服务时,我得到一个例外.

org.apache.axis2.AxisFault:org.apache.axis2.databinding.ADBException:意外的子元素{http://www.ncbi.nlm.nih.gov/soap/eutils/efetch_snp}Rs

try {
        EFetchSnpServiceStub fetchService = new EFetchSnpServiceStub();
        EFetchSnpServiceStub.EFetchRequest reqIdSnp = new EFetchSnpServiceStub.EFetchRequest();
        reqIdSnp.setId("193925233");
        EFetchSnpServiceStub.EFetchResult resIdSnp = fetchService.run_eFetch(reqIdSnp);
    } catch (Exception e) {
        System.out.println(e.toString());
    }

但是在soaptest中,我可以在结果中看到Rs标签.

<Rs rsId="193925233" snpClass="snp" snpType="notwithdrawn" molType="genomic" bitField="050000000005000000000100" taxId="3702">

我该如何解决这个异常? WSDL不在我的控制之下.

解决方法

在ADB数据绑定类型的Axis2中,主要发生意外的子元素错误.当SOAP响应中的标记序列与由wsdl形成的java类中的属性序列不同时.

例如,

If response or request XML must have a,b,c elements in a sequence
and actual XML has a,d,c elements in the sequence,then Axis2 would
complain saying that it received an Unexpected element named d.

它可以通过更改wsdl中的标记序列来解决.

注意:If this is not the case,check here for other reasons

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读