1

我正在尝试按照此配置通过 mule 中的单个端点公开多个服务接口:每个服务接口都有一个稍微不同的 url (1) http://localhost/services/Login (2) http://localhost/services/行政

但是我收到错误“Soap 1.1 端点已在地址上注册”

关于如何做到这一点的任何提示?我只想使用 cxf 服务在 SOAP 和 Java 之间编组/解组,并在以后提供 ws-security。

<flow name="flow_Services">
    <http:inbound-endpoint address="http://localhost/services" exchange-pattern="request-response">

    <choice>
        <when expression="inbound:http.request=/services/Login" evaluator="header">
            <cxf:jaxws-service serviceClass="com.ws.client.generated.Login" />
            <component><spring-object bean="Login"/></component>
        </when>

        <when expression="inbound:http.request=/services/Admin" evaluator="header">
            <cxf:jaxws-service serviceClass="com.ws.client.generated.Admin" />
            <component><spring-object bean="Admin"/></component>
        </when>
    </choice>
4

1 回答 1

1

您可以拥有多个具有相同主机名和端口但路径不同的 http 入站端点。这是我测试的一个简单示例:

<flow name="Flow" doc:name="EchoFlow">
    <http:inbound-endpoint exchange-pattern="request-response" 
         host="localhost" port="8084" path="services/hello" />
    <cxf:jaxws-service port="80" serviceClass="mypackage.ServiceInterface" />
    <component class="mypackage.ServiceClass" />
</flow>
<flow name="Flow2" doc:name="EchoFlow2">
    <http:inbound-endpoint exchange-pattern="request-response" 
         host="localhost" port="8084" path="services/goodbye" />
    <cxf:jaxws-service port="80" serviceClass="mypackage.ServiceInterfaceTwo" />
    <component class="mypackage.ServiceClassTwo" />
</flow>

在这里,我们托管了两个 Web 服务;两个端点 URL 都开始

http://localhost:8084/services/ 

但有不同的结局(你好和再见)。ServiceInterface 类如下所示:

package mypackage;
import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public interface ServiceInterface {
    @WebMethod
    String sayHello(String name);
}

ServiceClass 看起来像这样:

package mypackage;
import javax.jws.WebService;

@WebService(endpointInterface = "mypackage.ServiceInterface")
public class ServiceClass implements ServiceInterface {
    public String sayHello(String name) {
        return "Hello "+name;
    } 
}

ServiceInterfaceTwo 和 ServiceClassTwo 是相同的,但它不是 sayHello(),而是 sayGoodbye()。

于 2013-03-20T09:57:16.587 回答