You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Paulo Ramos <pa...@multicert.com> on 2008/04/21 17:09:24 UTC

Re: Using HTTPClient as a transport

Hello,

    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?

Thanks,
    Paulo Ramos
-- 
View this message in context: http://www.nabble.com/Using-HTTPClient-as-a-transport-tp14715325p16807978.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using HTTPClient as a transport

Posted by krause <pa...@yahoo.com>.
Anyone managed to get this working?
Would you care to share your code?
I'm trying to find info on how to use digest authentication at the transport
level using CXF (i.e. not WS-Security digest password) without luck.  I
can't believe no one has done this in CXF before... in Axis 2 it is
incredibly simple; you just set the username and password, and the
underlying HttpClient does the rest.

There is a  http://issues.apache.org/jira/browse/CXF-291 Jira issue  open
for this, but there doesn't seem to be much activity.

Any feedback would be greatly appreciated.

Regards


dkulp wrote:
> 
> 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
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-HTTPClient-as-a-transport-tp14715325p21617100.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using HTTPClient as a transport

Posted by Daniel Kulp <dk...@apache.org>.
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
dkulp@apache.org
http://www.dankulp.com/blog