导入网络服务:
我正在尝试导入以下网络服务: http://www.biomart.org/biomart/martwsdl
对服务 getResistry() 使用 curl :一切正常:
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>
(...)
OK。
但是,当使用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=[]
为什么?我应该怎么做才能使这段代码正常工作?
非常感谢
皮埃尔
I'm trying to import the following web service: http://www.biomart.org/biomart/martwsdl
Using curl for the service getResistry() : everything is OK:
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
it returns:
<?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>
(...)
OK.
But when this service is generated using CXF/wsdl2java ( or even 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
the generated client returns an empty list for getRegistry():
Invoking getRegistry...
getRegistry.result=[]
why ? what should I do, to make this code work ?
Many thanks
Pierre
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在客户端类中有一个 main 方法,您可以在其中调用 getRegistry 操作。
它可能看起来像这样
In the client class have a main method in which you invoke getRegistry operation.
It may look like this