简体   繁体   English

axis2:两个共享相同名称的不同Web服务

[英]axis2: two different webservices sharing the same name

I have two different webservices (each generated from a different wsdl) with the same name "getConfiguration", that I'm trying to put in the same .aar file. 我有两个具有相同名称“ getConfiguration”的不同Web服务(每个Web服务都是从不同的wsdl生成的),我试图将它们放置在相同的.aar文件中。

In the services.xml I've changed the name of the second to "getConfiguration2", so my services.xml file looks like this: 在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>

The services/listServices presents the two webservices: 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

When I access the getConfiguration wsdl url (http://host/path/services/getConfiguration?wsdl) the axis presents to me the wsdl from getConfiguration service which looks good. 当我访问getConfiguration wsdl url(http:// host / path / services / getConfiguration?wsdl)时,该轴向我展示了来自getConfiguration服务的wsdl,看起来不错。 But if I access the getConfiguration2 wsdl url (http://host/path/services/getConfiguration2?wsdl) the following error appears: 但是,如果我访问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>

The aar file contains both wsdl (the second one also renamed to getConfiguration2): aar文件包含两个wsdl(第二个也重命名为getConfiguration2):

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

Any idea why and how to solve it? 知道为什么以及如何解决吗? If I comment one of them in the services.xml file the other works fine. 如果我在services.xml文件中评论其中一个,则另一个工作正常。 My setup: Linux + Java 1.6 + Tomcat + axis 2 我的设置:Linux + Java 1.6 + Tomcat +轴2

Thanks 谢谢

It's not enough to rename the wsdl file, you also need to edit the wsdl and change the service name like this: 仅重命名wsdl文件是不够的,您还需要编辑wsdl并更改服务名称,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM