Hi there,

Hoping someone can shed some light on this. I'm trying to use the failover
feature on CXF but have not been able to get it working.

I've set up a cxf-client.xml which contains the failover setup:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:cxf="http://cxf.apache.org/core";
       xmlns:jaxws="http://cxf.apache.org/jaxws";
       xmlns:clustering="http://cxf.apache.org/clustering";
       xsi:schemaLocation="http://cxf.apache.org/core 
          http://cxf.apache.org/schemas/core.xsd
          http://cxf.apache.org/jaxws 
          http://cxf.apache.org/schemas/jaxws.xsd
          http://www.springframework.org/schema/beans 
          http://www.springframework.org/schema/beans/spring-beans.xsd";>

        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    
    <bean id="Random" class="org.apache.cxf.clustering.RandomStrategy"/>
    
    <jaxws:client id="AuthenticationPrimaryPortType"
name="{http://www.test.com/Authentication}AuthenticationPrimaryPortType";
createdFromAPI="true">
        <jaxws:features>
            <clustering:failover>
                <clustering:strategy>
                    <ref bean="Random"/>
                </clustering:strategy>
            </clustering:failover>
        </jaxws:features>
    </jaxws:client>

    <jaxws:client id="AuthenticationSecondaryPortType"
name="{http://www.test.com/Authentication}AuthenticationSecondaryPortType";
createdFromAPI="true">
        <jaxws:features>
            <clustering:failover>
                <clustering:strategy>
                    <ref bean="Random"/>
                </clustering:strategy>
            </clustering:failover>
        </jaxws:features>
    </jaxws:client>
    
    <jaxws:client id="AuthenticationTertiaryPortType"
name="{http://www.test.com/Authentication}AuthenticationTertiaryPortType";
createdFromAPI="true">
        <jaxws:features>
            <clustering:failover>
                <clustering:strategy>
                    <ref bean="Random"/>
                </clustering:strategy>
            </clustering:failover>
        </jaxws:features>
    </jaxws:client>
</beans>


I've got the clustered service set up in the wsdl as well: 

<service name="AuthenticationClusteredWebService">
        <port name="AuthenticationPrimaryPortType"
binding="AUTH-SCENARIO:AuthenticationWebService">
                <SOAP:address location="https://server1"/>
        </port>
        <port name="AuthenticationSecondaryPortType"
binding="AUTH-SCENARIO:AuthenticationWebService">
                <SOAP:address location="https://server2"/>
        </port>
        <port name="AuthenticationTertiaryPortType"
binding="AUTH-SCENARIO:AuthenticationWebService">
                <SOAP:address location="https://server3"/>
        </port>
</service>

But when I test the failover by taking down the service at server1, I get a
SocketConnectionException complaining of a connection timeout. It doesn't
try to use the other port types.

I also noticed that by running this to assert that the failover feature does
get set up, the assertion below returns false. Instead the conduitSelector
is of type UpfrontConduitSelector:

AuthenticationPortType proxy = new
AuthenticationClusteredWebService(getWSDL()).getAuthenticationPrimaryPortType()

ConduitSelector conduitSelector =
ClientProxy.getClient(proxy).getConduitSelector();
assertTrue(FailoverTargetSelector.class.isInstance(conduitSelector));

So for some reason the failover feature in my cxf-client.xml gets ignored.


If anyone's got any ideas that would be great. I've tried to follow the
system testing class I found at:
http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverTest.java
and how the failover.xml is setup. Maybe I'm just missing something else..


Thanks,
Lesley

-- 
View this message in context: 
http://old.nabble.com/Failover-config-for-cxf-seems-to-get-ignored-tp27703526p27703526.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to