Reputation: 11
I am trying to expose multiple service interfaces via a single endpoint in mule as per this configuration: Each service interface has a slightly different url (1) http://localhost/services/Login (2) http://localhost/services/Admin
However I get the error "Soap 1.1 endpoint already registered on address"
Any tips on how to do this? I merely want to use the cxf service to marshall/unmarshall between SOAP and Java and at a later date to provide 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>
Upvotes: 1
Views: 1446
Reputation: 19
You can have multiple http inbound-endpoints with the same hostname and port, but different paths. Here's a simple example I tested:
<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>
Here we're hosting two web services; both endpoint URLs start
http://localhost:8084/services/
but have different endings (hello and goodbye). The ServiceInterface class looks like this:
package mypackage;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface ServiceInterface {
@WebMethod
String sayHello(String name);
}
And the ServiceClass looks like this:
package mypackage;
import javax.jws.WebService;
@WebService(endpointInterface = "mypackage.ServiceInterface")
public class ServiceClass implements ServiceInterface {
public String sayHello(String name) {
return "Hello "+name;
}
}
ServiceInterfaceTwo and ServiceClassTwo are the same, but instead of sayHello() it has sayGoodbye().
Upvotes: 1