Java – Apache unexpected child element exception when generating web service client
•
Java
I am trying to generate a web service client using wsdl2 Java from Axis2 (version 1.6.1)
./wsdl2java.sh -uri http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/v2.0/efetch_snp.wsdl
When I called the service, I got an exception
org. apache. axis2. AxisFault:org. apache. axis2. databinding. Adbexception: unexpected child element{ 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()); }
But in soaptest, I can see the RS tag in the result
<Rs rsId="193925233" snpClass="snp" snpType="notwithdrawn" molType="genomic" bitField="050000000005000000000100" taxId="3702">
How can I resolve this exception? WSDL is not under my control
Solution
In Axis2 of ADB data binding type, unexpected child element errors mainly occur When the tag sequence in the soap response is different from the attribute sequence in the Java class formed by WSDL
For example,
It can be solved by changing the tag sequence in WSDL
Note: if this is not the case, check here for other reasons
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码