首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ADBException在使用WebEnv & QueryKey示例用于EFetch中的应用

ADBException在使用WebEnv & QueryKey示例用于EFetch中的应用
EN

Stack Overflow用户
提问于 2014-02-19 17:49:16
回答 1查看 525关注 0票数 2

我使用了来自WebEnv & QueryKey示例的示例代码-- ESearch部分似乎工作得很好,但EFetch却不行。我添加了命令"e.printStackTrace()“以获得完整的错误消息:

代码语言:javascript
运行
复制
WebEnv: NCID_1_160921978_130.14.18.34_9001_1392822285_1227953195  
QueryKey: 1

org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://www.ncbi.nlm.nih.gov/soap/eutils/efetch_pubmed}Affiliation  
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://www.ncbi.nlm.nih.gov/soap/eutils/efetch_pubmed}Affiliation  
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub.fromOM(EFetchPubmedServiceStub.java)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub.run_eFetch(EFetchPubmedServiceStub.java:190)  
at preparation.Client.main(Client.java:39)  
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://www.ncbi.nlm.nih.gov/soap/eutils/efetch_pubmed}Affiliation  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$AuthorType$Factory.parse(EFetchPubmedServiceStub.java:47561)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$AuthorListType$Factory.parse(EFetchPubmedServiceStub.java:12284)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$ArticleType$Factory.parse(EFetchPubmedServiceStub.java)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$MedlineCitationType$Factory.parse(EFetchPubmedServiceStub.java:27035)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubmedArticleType$Factory.parse(EFetchPubmedServiceStub.java:17841)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubmedArticleSetChoiceE$Factory.parse(EFetchPubmedServiceStub.java)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubmedArticleSet_type0$Factory.parse(EFetchPubmedServiceStub.java:54143)  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$EFetchResult$Factory.parse(EFetchPubmedServiceStub.java:48494)  
... 3 more  
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://www.ncbi.nlm.nih.gov/soap/eutils/efetch_pubmed}Affiliation  
at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$AuthorType$Factory.parse(EFetchPubmedServiceStub.java:47555)  
... 10 more  

我使用Eclipse (版本: 3.7.2)和Ubuntu12.04LTS以及java-7-OpenJDK-AMD 64作为JRE。NCBI页面提到在运行Client.java之前使用此命令:

代码语言:javascript
运行
复制
wsdl2java -uri http://eutils.ncbi.nlm.nih.gov/soap/v2.0/efetch_pubmed.wsdl

相反,我只是在控制台中包含了作为输出显示的jar文件(仅包括二进制文件),因为这对于http://www.ncbi.nlm.nih.gov/books/NBK55696/上的所有其他exapmles ( ELink示例除外)都很好:

代码语言:javascript
运行
复制
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://www.ncbi.nlm.nih.gov/soap/eutils/elink}error 

我将描述在我的项目中包含了哪些jar文件。

由于上面提到的页面上下载eutils_axis2.jar的FTP链接不起作用,所以我搜索当前路径并将其添加到我的Eclipse中。

他们的自述文件说,应该使用JDK版本7.0.45和Axis2版本1.6.2,并于2013年12月发布。

我在Google中搜索“下载wsdl2java.sh”以获得与WSDL相关的Axis2版本,并找到了axis2-eclipse-service-plugin-1.6.2.zip包。我下载了这个包并将所有jar文件添加到我的项目中:

代码语言:javascript
运行
复制
apache-mime4j-core-0.7.2.jar  
axiom-api-1.2.13.jar  
axiom-impl-1.2.13.jar  
axis2-adb-1.6.2.jar  
axis2-codegen-1.6.2.jar  
axis2-kernel-1.6.2.jar  
commons-codec-1.3.jar  
commons-fileupload-1.2.jar  
commons-httpclient-3.1.jar  
geronimo-jta_1.1_spec-1.1.jar  
geronimo-ws-metadata_2.0_spec-1.1.2.jar  
jaxen-1.1.1.jar  
jsr311-api-1.0.jar  
neethi-3.0.2.jar  
servlet-api-2.3.jar  
woden-api-1.0M9.jar  
woden-impl-commons-1.0M9.jar  
woden-impl-dom-1.0M9.jar  
wsdl4j-1.6.2.jar  
XmlSchema-1.4.7.jar  

然后,我在包中搜索剩余的错误消息:

代码语言:javascript
运行
复制
axis2-transport-http-1.6.2.jar  
axis2-transport-local-1.6.2.jar   
commons-logging-1.1.3.jar  
geronimo-javamail_1.4_spec-1.7.1.jar  
httpcore-4.3.2.jar  

我在谷歌搜索了类似的案例,但没有找到解决方案。我怎样才能修复开头提到的这个消息?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-20 16:31:03

NCBI教程中提到的相应的wsdl文件来自2010年。也许它已经过时了,但是首先,请确保创建指定的java类很好。以下步骤是否会导致错误?

下载并解压axis2-1.6.2

设置环境变量

代码语言:javascript
运行
复制
export AXIS2_HOME=<path/to/axis2-1.6.2>
export JAVA_HOME=<path/to/java-7-openjdk-amd64>

下载下列文件

代码语言:javascript
运行
复制
http://eutils.ncbi.nlm.nih.gov/soap/v2.0/efetch_pubmed.xsd
http://eutils.ncbi.nlm.nih.gov/soap/v2.0/efetch_db_pubmed.xsd
http://eutils.ncbi.nlm.nih.gov/soap/v2.0/efetch_pubmed.wsdl

并使用efetch_pubmed.wsdl文件在axis2-1.6.2目录中执行bin/wsdl2java.sh。

代码语言:javascript
运行
复制
sh wsdl2java.sh -uri <path/to/efetch_pubmed.wsdl>

中应该出现两个java类。

代码语言:javascript
运行
复制
src/gov/nih/nlm/ncbi/www/soap/eutils

(仍在axis/bin目录中)。在您的Client.java中导入并使用这些文件(指向本教程中的文件名)。

对我来说很好。希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21888354

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档