简体   繁体   中英

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.

In the services.xml I've changed the name of the second to "getConfiguration2", so my services.xml file looks like this:

<?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:

-> 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. But if I access the getConfiguration2 wsdl url (http://host/path/services/getConfiguration2?wsdl) the following error appears:

<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):

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. My setup: Linux + Java 1.6 + Tomcat + axis 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:service name="getConfiguration2">
      <wsdl:port name="..." binding="tns:...">
         <soap:address location="http://hostname:port/path/..."/>
      </wsdl:port>
</wsdl:service>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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