axis2:共享相同名称的两个不同的Web服务 [英] axis2: two different webservices sharing the same name

查看:63
本文介绍了axis2:共享相同名称的两个不同的Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个名称相同的Web服务(每个Web服务都是从不同的wsdl生成的),它们的名称都为"getConfiguration",我正尝试将其放置在相同的.aar文件中.

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.

在services.xml中,我将第二个名称更改为"getConfiguration2", 所以我的services.xml文件看起来像这样:

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>

services/listServices提供了两个Web服务:

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

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

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>

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

The aar file contains both wsdl (the second one also renamed to getConfiguration2):

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

任何想法为何以及如何解决? 如果我在services.xml文件中评论其中一个,则另一个工作正常. 我的设置:Linux + Java 1.6 + Tomcat +轴2

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

谢谢

推荐答案

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

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>

这篇关于axis2:共享相同名称的两个不同的Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆