【问题标题】:axis2: two different webservices sharing the same nameaxis2:两个不同的网络服务共享相同的名称
【发布时间】:2011-10-20 04:44:42
【问题描述】:

我有两个不同的 web 服务(每个都从不同的 wsdl 生成)具有相同的名称“getConfiguration”,我试图将它们放入同一个 .aar 文件中。

在 services.xml 中,我将第二个名称更改为“getConfiguration2”, 所以我的 services.xml 文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<serviceGroup>
<service name="getConfiguration">
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="wi.xpto.webservice.GetConfigurationMessageReceiverInOut"/>
        </messageReceivers>
        <parameter name="ServiceClass">wi.xpto.webservice.GetConfigurationSkeleton</parameter>
        <parameter name="useOriginalwsdl">true</parameter>
        <parameter name="modifyUserWSDLPortAddress">false</parameter>
        <operation name="getConfiguration" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://6.xpto.com/v/i/wsd/getConfiguration">
            <actionMapping>v_i_wsd_getConfiguration_Binder_getConfiguration</actionMapping>
            <outputActionMapping>http://6.xpto.com/v/i/wsd/getConfiguration/getConfiguration_PortType/getConfigurationResponse</outputActionMapping>
        </operation>
    </service>  

    <service name="getConfiguration2">
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="wi.xpto.webservice2.GetConfigurationMessageReceiverInOut"/>
        </messageReceivers>
        <parameter name="ServiceClass">wi.xpto.webservice2.GetConfigurationSkeleton</parameter>
        <parameter name="useOriginalwsdl">true</parameter>
        <parameter name="modifyUserWSDLPortAddress">false</parameter>
        <operation name="getConfiguration" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://7.xpto.com/VResouce_I/wsd/getConfiguration">
            <actionMapping>VResouce_I_wsd_getConfiguration_Binder_getConfiguration</actionMapping>
            <outputActionMapping>http://7.xpto.com/VResouce_I/wsd/getConfiguration/getConfiguration_PortType/getConfigurationResponse</outputActionMapping>
        </operation>
    </service>

</serviceGroup>

services/listServices 展示了两个 web 服务:

-> getConfiguration
Service EPR : http://host/path/services/getConfiguration
Service Description : getConfiguration
Service Status : Active
Available Operations
getConfiguration

-> getConfiguration2
Service EPR : http://host/path/services/getConfiguration2
Service Description : getConfiguration2
Service Status : Active
Available Operations
getConfiguration

当我访问 getConfiguration wsdl url (http://host/path/services/getConfiguration?wsdl) 时,轴会向我显示来自 getConfiguration 服务的 wsdl,看起来不错。 但是如果我访问 getConfiguration2 wsdl url (http://host/path/services/getConfiguration2?wsdl) 会出现以下错误:

<error>
  <description>Unable to generate WSDL 1.1 for this service</description>
  <reason>If you wish Axis2 to automatically generate the WSDL 1.1, then please +set useOriginalwsdl as false in your services.xml</reason>
</error>

aar 文件包含两个 wsdl(第二个也重命名为 getConfiguration2):

META-INF/getconfiguration.wsdl
META-INF/getConfiguration2.wsdl

知道为什么以及如何解决它吗? 如果我在 services.xml 文件中评论其中一个,则另一个可以正常工作。 我的设置:Linux + Java 1.6 + Tomcat + 轴 2

谢谢

【问题讨论】:

    标签: java web-services axis2


    【解决方案1】:

    仅重命名 wsdl 文件是不够的,您还需要编辑 wsdl 并更改服务名称,如下所示:

    <wsdl:service name="getConfiguration2">
          <wsdl:port name="..." binding="tns:...">
             <soap:address location="http://hostname:port/path/..."/>
          </wsdl:port>
    </wsdl:service>
    

    【讨论】:

      猜你喜欢
      • 2014-06-04
      • 2016-12-16
      • 2023-03-07
      • 2013-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多