Java 使用WebEnv&;EFetch的QueryKey示例

Java 使用WebEnv&;EFetch的QueryKey示例,java,eclipse,web-services,exception,axis2,Java,Eclipse,Web Services,Exception,Axis2,我使用了来自的示例代码“UsingWebEnv&QueryKey示例”-ESearch部分似乎工作正常,但不是EFetch。我添加了命令“e.printStackTrace()”以获取完整的错误消息: WebEnv: NCID_1_160921978_130.14.18.34_9001_1392822285_1227953195 QueryKey: 1 org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException

我使用了来自的示例代码“UsingWebEnv&QueryKey示例”-ESearch部分似乎工作正常,但不是EFetch。我添加了命令“e.printStackTrace()”以获取完整的错误消息:

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),Ubuntu 12.04 LTS和java-7-openjdk-amd64作为JRE。NCBI页面提到在运行Client.java之前使用此命令:

wsdl2java -uri http://eutils.ncbi.nlm.nih.gov/soap/v2.0/efetch_pubmed.wsdl
相反,我只是简单地包含了在控制台中显示为输出的jar文件(只有二进制文件),因为这对于除ELink示例之外的所有其他exapmles都很好:

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中搜索“download wsdl2java.sh”以获得与WSDL相关的Axis2版本,并找到了包Axis2-eclipse-service-plugin-1.6.2.zip。我下载了包并将所有jar文件添加到我的项目中:

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  
然后我在包中搜索剩余的错误消息:

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  

我用谷歌搜索了类似的案例,但没有找到解决方案。如何修复开头提到的此消息?

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

下载并摘录

设置环境变量

export AXIS2_HOME=<path/to/axis2-1.6.2>
export JAVA_HOME=<path/to/java-7-openjdk-amd64>
并使用efetch_pubmed.wsdl文件在axis2-1.6.2目录中执行bin/wsdl2java.sh

sh wsdl2java.sh -uri <path/to/efetch_pubmed.wsdl>
(仍在axis/bin目录中)。在Client.java中导入并使用这些文件(指向教程中的文件名)

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

sh wsdl2java.sh -uri <path/to/efetch_pubmed.wsdl>
src/gov/nih/nlm/ncbi/www/soap/eutils