我正在尝试导入以下网络服务: http: //www.biomart.org/biomart/martwsdl
使用curl服务getResistry():一切正常:
curl --header 'Content-Type: text/xml' --data '<?xml version="1.0"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mar="http://www.biomart.org:80/MartServiceSoap">
<soapenv:Header/>
<soapenv:Body>
<mar:getRegistry/>
</soapenv:Body>
</soapenv:Envelope>' http://www.biomart.org:80/biomart/martsoap
它返回:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.o
rg/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Body>
<getRegistryResponse xmlns="http://www.biomart.org:80/MartServiceSoap">
<mart>
<name xsi:type="xsd:string">ensembl</name>
<displayName xsi:type="xsd:string">ENSEMBL GENES 57 (SANGER UK)</displayName>
<database xsi:type="xsd:string">ensembl_mart_57</database>
(...)
好的。
但是当使用CXF/wsdl2java(甚至 wsimport)生成此服务时
mkdir src
wsdl2java -keep -d src -client "http://www.biomart.org/biomart/martwsdl"
javac -g -d src -sourcepath src src/org/biomart/_80/martservicesoap/MartServiceSoap_BioMartSoapPort_Client.java
java -cp src org.biomart._80.martservicesoap.MartServiceSoap_BioMartSoapPort_Client
生成的客户端为getRegistry ()返回一个空列表:
Invoking getRegistry...
getRegistry.result=[]
为什么 ?我应该怎么做才能使这段代码工作?
非常感谢
皮埃尔