[ 
https://issues.apache.org/jira/browse/CXF-922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522934
 ] 

willem Jiang commented on CXF-922:
----------------------------------

I just checked CXF HttpConduit code,  and wrote a test case for it. I got the 
exception that you mentioned.
CXF uses the bus as the CXF components repository which also holds  the 
configuration object. When we create the client from the JaxWsProxyFactoryBean, 
the http conduit will be configured by  the configuration object from bus.

The key reason of this issue is that  when we create the client bean from the 
JaxWsProxyFactoryBean by spring, the  bus which holds the configuration beans 
is not create yet, and the JaxWsProxyFactoryBean will use the default bus to 
create the client. So the customer configuration will not be applied to the 
http-conduit.

Here is a way to work around, you separate the configuration beans' spring 
configuration file  with the client bean's spring configuration file.
Load the bus with the configuration beans' file first , and set the default bus 
with this created bus. Then create the client bean's context with the client 
bean's spring configuration file .
        
        // http conduit configuration file , it supports wildcard 
        URL config = getClass().getResource("resources/BethalClientConfig.cxf");
        // the client bean configuration file
        URL beans = getClass().getResource("resources/BethalClientBeans.xml");
        // We go through the back door, setting the default bus.
        new DefaultBusFactory().createBus(config);
        // Init the context which contains the client bean, 
        // and we use the already loaded bus to set the configuration
        BusApplicationContext context = new BusApplicationContext(beans, false);
        Greeter bethal = (Greeter)context.getBean("Bethal");        
        // verify the client side's setting
        verifyBethalClient(bethal);         

You can find the detail  demo code from [1]'s   testGetClientFromSpringContext()
[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java

> HTTP Conduit configuration is not loaded
> ----------------------------------------
>
>                 Key: CXF-922
>                 URL: https://issues.apache.org/jira/browse/CXF-922
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>            Reporter: Julio Arias
>            Assignee: willem Jiang
>
> The http conduit config is not been loaded while creating the client using 
> spring configuration. The conduit tlsClientParameters are never set thus the 
> connection to a https address fails.
> This is the spring context file:
> <?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:sec="http://cxf.apache.org/configuration/security";
>       xmlns:http="http://cxf.apache.org/transports/http/configuration";
>       xmlns:jaxws="http://java.sun.com/xml/ns/jaxws";
>       xsi:schemaLocation="
>       http://cxf.apache.org/configuration/security
>       http://cxf.apache.org/schemas/configuration/security.xsd
>       http://cxf.apache.org/transports/http/configuration
>       http://cxf.apache.org/schemas/configuration/http-conf.xsd
>       http://www.springframework.org/schema/beans
>       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>       <bean id="studentWebServiceClient" 
> class="com.ecot.crm.webservice.client.ws.student.StudentService" 
> factory-bean="studentWebServiceClientFactory" factory-method="create">
>       </bean>
>       <bean id="studentWebServiceClientFactory" 
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>               <property name="serviceClass" 
> value="com.ecot.crm.webservice.client.ws.student.StudentService"/>
>               <property name="address" 
> value="${webservices.url}/StudentService"/>
>       </bean>
>       <http:conduit 
> name="{http://client.webservice.crm.ecot.com/ws/student}StudentService.http-conduit";>
>               <http:tlsClientParameters>
>               </http:tlsClientParameters>
>       </http:conduit>
> </beans>
> There is also a post on the mailing list about this, the original messages is 
> this: 
> http://mail-archives.apache.org/mod_mbox/incubator-cxf-user/200708.mbox/[EMAIL
>  PROTECTED]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to