Right. That would do it. Since Jetty subclasses the same stuff as the ClientOnly stuff, it would also replace the client only stuff with it's version.
Dan On Jul 29, 2008, at 2:50 AM, jian wu wrote:
Hi Dan, It seems that I just need change my cxf-extension-commons-http.xml to depends on "JettyHTTPTransportFactory" instead and my simple CommonsHTTPClientConduit prototype was called finally. It would begreat that you can confirm that is the right way to inject HTTP Conduitinto CXF Client. Thanks a lot for your help! JianOn Mon, Jul 28, 2008 at 11:24 PM, jian wu <[EMAIL PROTECTED]> wrote:Hi Dan, Just want to add that cxf-extension-http-jetty.xml in cxf-2.1.1.jar has a similar configuration as: ===================================================== <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_jetty.JettyHTTPTransportFactory" id="org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory"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> ============================================================= Thanks a lot! JianOn Mon, Jul 28, 2008 at 11:04 PM, jian wu <[EMAIL PROTECTED]> wrote:Hi Dan, I just went to some code debugging, it seems like that: AbstractConduitSelector.getSelectedConduit(), which is called byUpfrontConduitSelector.selectConduit(), returns JettyHTTPTransportFactory for "http://schemas.xmlsoap.org/soap/http", it'll initiate HTTPConduit,I just quickly searched cxf configuration file, I'm not sure that thefollowing configuration in bus-extensions.xml in cxf-2.1.1.jar is related to this: ==================================================<extension class ="org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory"deferred="true"> <namespace>http://schemas.xmlsoap.org/wsdl/soap/http</namespace> <namespace>http://schemas.xmlsoap.org/soap/http</namespace><namespace>http://www.w3.org/2003/05/soap/bindings/HTTP/</ namespace><namespace>http://schemas.xmlsoap.org/wsdl/http/</namespace><namespace>http://cxf.apache.org/transports/http/configuration</ namespace><namespace>http://cxf.apache.org/bindings/xformat</namespace> </extension> ================================================== Any suggestion or tip to resolve this would be really appreciated. Thanks a lot for your help! JianOn Mon, Jul 28, 2008 at 12:58 PM, jian wu <[EMAIL PROTECTED]> wrote:Hi Dan,The ClientOnly factory should register first (since you depend on it), then yours should get called and register. (You have a @PostConstruct method, right?)The following is my code snippet for PostConstruct: ============================================================= @PostConstruct public void registerWithBindingManager() { // ... ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class); if (null != cim && null != activationNamespaces) { for (String ns : activationNamespaces) { try { ConduitInitiator initor = cim.getConduitInitiator( ns ); if ( initor != null ) {System.out.println( "For " + ns + ", " + initor.getClass().getName() );cim.deregisterConduitInitiator( ns ); } else { System.out.println( "For " + ns + ", null" ); } } catch (BusException e) { e.printStackTrace(); } cim.registerConduitInitiator(ns, this); } System.out.println(); System.out.println( "Checking ConduitInitiator Mapping:" ); for (String ns : activationNamespaces) { try { ConduitInitiator initor = cim.getConduitInitiator( ns ); if ( initor != null ) {System.out.println( "For " + ns + ", " + initor.getClass().getName() );} else { System.out.println( "For " + ns + ", null" ); } } catch (BusException e) { e.printStackTrace(); } } } initHttpClient(); if ( this.httpClientInitialized.get() ) { System.out.println( "Commons HttpClient Initialized" ); } else { System.out.println( "Commons HttpClient Failed to initialize" ); } //... } ========================================================= with output: ========================================================= For http://schemas.xmlsoap.org/soap/http, org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory For http://schemas.xmlsoap.org/wsdl/http/, org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory For http://schemas.xmlsoap.org/wsdl/soap/http, org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory For http://www.w3.org/2003/05/soap/bindings/HTTP/, org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory For http://cxf.apache.org/transports/http/configuration, org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory For http://cxf.apache.org/bindings/xformat, org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory Checking ConduitInitiator Mapping: For http://schemas.xmlsoap.org/soap/http, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://schemas.xmlsoap.org/wsdl/http/, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://schemas.xmlsoap.org/wsdl/soap/http, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://www.w3.org/2003/05/soap/bindings/HTTP/, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://cxf.apache.org/transports/http/configuration, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://cxf.apache.org/bindings/xformat, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory Commons HttpClient Initialized ==================================================But, I can see my Client still is still using HTTPConduit. Is it too lateror any other configuration point or name "org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory" is referenced? so far I can only make it work by renaming them as ClientOnlyHTTPTransportFactory and delete the original one from cxf-2.1.1.jar.I guess my suggestion would be to put breakpoints in the Conduit manager stuffto see what is registered.I'll try to do it. Thanks a lot for your help! JianOn Mon, Jul 28, 2008 at 6:48 AM, Daniel Kulp <[EMAIL PROTECTED]> wrote:Not really sure. That all looks completely correct. The ClientOnly factory should register first (since you depend on it), then yours should get called and register. (You have a @PostConstruct method, right?) I guess my suggestion would be to put breakpoints in the Conduit manager stuffto see what is registered. Dan On Jul 26, 2008, at 4:35 AM, jian wu wrote:Hi Dan and Ulhas, Thanks a lot for answering my previous message!I tried to create a simple CommonsHttpClientTransportFactory with a simple CommonsHttpClientConduit, and I tried to follow the suggestion Dan gaveat: http://www.nabble.com/Using-HTTPClient-as-a-transport-td14715325.html#a16815394 I created a simple cxf-extension-commons-http.xml as: ===================================================<import resource="classpath:META-INF/cxf/cxf-extension- http.xml" /><beanclass = "org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory"id = "org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory"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> ==================================================== I created a simple WSDL2Java generated client, and I can see my client logging output as: ==================================================== Jul 26, 2008 12:28:11 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml] Jul 26, 2008 12:28:12 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-commons-http.xml] Jul 26, 2008 12:28:12 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-http.xml] Jul 26, 2008 12:28:12 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-object-binding.xml] ====================================================Also, from my registerWithBindingManager() method, I tried to ensurethat the following namespaces are registered with the new CommonsHTTPClientTransportFactory as: ==================================================== For http://schemas.xmlsoap.org/soap/http, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://schemas.xmlsoap.org/wsdl/http/, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://schemas.xmlsoap.org/wsdl/soap/http, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://www.w3.org/2003/05/soap/bindings/HTTP/, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://cxf.apache.org/transports/http/configuration, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory For http://cxf.apache.org/bindings/xformat, org.apache.cxf.transport.http.CommonsHTTPClientTransportFactory ===================================================But, my client still uses the HTTPConduit as the following code snippet================================================== Client client = ClientProxy.getClient( port );System .out.println( client.getConduit().getClass().getSimpleName() ); System .out .println( client.getConduitSelector().getClass().getSimpleName()); System.out.println( client.getEndpoint().getEndpointInfo().getTransportId() ); ================================================== with output: HTTPConduit UpfrontConduitSelector http://schemas.xmlsoap.org/soap/httpIs there any extra configuration steps required to let CXF Client usemy CommonsHttpClientConduit? I really appreciate any tip and suggestion from your guys. Thanks a lot for your help! Jian--- Daniel Kulp [EMAIL PROTECTED] http://www.dankulp.com/blog
--- Daniel Kulp [EMAIL PROTECTED] http://www.dankulp.com/blog
