导入网络服务:

发布于 2024-08-26 05:24:17 字数 1960 浏览 7 评论 0原文

我正在尝试导入以下网络服务: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小猫一只 2024-09-02 05:24:17

在客户端类中有一个 main 方法,您可以在其中调用 getRegistry 操作。

它可能看起来像这样

MartServiceSoap_BioMartSoapPort_Client client = new MartServiceSoap_BioMartSoapPort_Client();
System.out.println(client.getRegistry());

In the client class have a main method in which you invoke getRegistry operation.

It may look like this

MartServiceSoap_BioMartSoapPort_Client client = new MartServiceSoap_BioMartSoapPort_Client();
System.out.println(client.getRegistry());
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文