On Monday 21 April 2008, Paulo Ramos wrote:
>     I am a trying to use HTTPClient to send request i CXF HTTP
> transport. I have implemented the Conduit API with HTTPClient but i
> don't understand how do i configure CXF to use my implementation.
> Can anyone help me?

You'll want to create two files:

1) META-INF/cxf/cxf.extension 
This file would just contain the line:
META-INF/cxf/cxf-extension-http-commons.xml
which points to file #2:

2) META-INF/cxf/cxf-extension-http-commons.xml
Is a spring module that would look something like:

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:foo="http://cxf.apache.org/configuration/foo";
       xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd";>

    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
        
    <bean 
class="org.apache.cxf.transport.http_commons.CommonsHTTPTransportFactory"
          id="org.apache.cxf.transport.http_commons.CommonsHTTPTransportFactory"
        lazy-init="false"       
depends-on="org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory">
        <property name="bus" ref="cxf"/>
        <property name="transportIds">
            <list>
                <value>http://schemas.xmlsoap.org/soap/http</value>
                <value>http://schemas.xmlsoap.org/wsdl/http/</value>
                <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
                    
<value>http://www.w3.org/2003/05/soap/bindings/HTTP/</value>
                
<value>http://cxf.apache.org/transports/http/configuration</value>
                <value>http://cxf.apache.org/bindings/xformat</value>
            </list>
        </property>
    </bean>
</beans>


What that file does it forces your bean to be created/registered after 
the "standard" one we have in CXF.  Your TransportFactory would then 
have a @PostConstruct method that would register your factory with the 
bus's ConduitInitiatorManager.   Since you would be called after the 
standard "ClientOnlyHTTPTransport", you would overwrite what it 
registers and your Conduit stuff would be called.


-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to