You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by burki <da...@segmentone.com> on 2007/09/05 21:01:36 UTC

http-conf:conduit - spring config - again ...

I generated a client for the HelloWorld sample (slightly modified) and am
able to set http-conf:conduit parameters just fine.  The client is generated
from the wsdl below.

The http-conf section looks like:

	<http-conf:conduit
name="{http://websvc.s1.com/}HelloWorldServicePort.http-conduit">
		<http-conf:client Connection="close"
						  ConnectionTimeout="3000"
						  ReceiveTimeout="10000"
						  ProxyServer="127.0.0.1"
						  ProxyServerPort="8888"/>
	 </http-conf:conduit> 

I'm passing the config to the client on the command line
(-Dcxf.config.file=...) everything works like a charm.

But the same config loaded into a client developed in code-first approach
does nothing for the http-conf section - nana, zilch.  The rest of the
config, setting interceptors, etc works just fine.

The client code is lifted from the sample in the cxf dist:

public final class HelloWorldClient {

    private HelloWorldClient() {
    }

    public static void main(String args[]) throws Exception {
        ClassPathXmlApplicationContext context 
            = new ClassPathXmlApplicationContext(new String[]
{"com/s1/wsdemo/hello/apiclient/config/client-beans.xml"});

        HelloWorld client = (HelloWorld)context.getBean("client");
        

        String response = client.sayHi("Dan");
        System.out.println("Response: " + response);
        System.exit(0);
    }
}

client-beans.xml is below.  Is there something I'm missing?  Am I using a
differently named port - or is another call to initialize cxf needed?

Thanks a bunch for any pointers!

--dan

client-beans.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
						http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
						http://cxf.apache.org/jaxws 
						http://cxf.apache.org/schema/jaxws.xsd
						http://cxf.apache.org/transports/http/configuration
						http://cxf.apache.org/schemas/configuration/http-conf.xsd
						">

	<http-conf:conduit
name="{http://websvc.s1.com/}HelloWorldServicePort.http-conduit">
		<http-conf:client Connection="close"
						  ConnectionTimeout="3000"
						  ReceiveTimeout="10000"
						  ProxyServer="127.0.0.1"
						  ProxyServerPort="8888"/>
	 </http-conf:conduit> 

    <bean id="client" class="com.s1.wsdemo.hello.api.HelloWorld" 
      factory-bean="clientFactory" factory-method="create"/>
    
	<bean id="clientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
	  <property name="serviceClass"
value="com.s1.wsdemo.hello.api.HelloWorld"/>
	  <property name="address"
value="http://localhost:8080/HelloWorld-070828/services/HelloWorld"/>
	  
	  <!-- start turn on logging -->
        <property name="inInterceptors">
            <list>
                <bean
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
            </list>
        </property>
        <property name="outInterceptors">
            <list>
                <bean
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
            </list>
        </property>
        <property name="outFaultInterceptors">
            <list>
                <bean
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
            </list>
        </property>
	  <!-- end turn on logging -->
	
	</bean>
	  
</beans>


wsdl:

<?xml version="1.0" encoding="utf-8"?><wsdl:definitions
xmlns:ns1="http://websvc.s1.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldService"
targetNamespace="http://websvc.s1.com/">
  <wsdl:types>
<xsd:schema xmlns="http://websvc.s1.com/" attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://websvc.s1.com/">
<xsd:element name="yourName" nillable="true" type="xsd:string"/>
<xsd:element name="helloMessage" nillable="true" type="xsd:string"/>
</xsd:schema>
  </wsdl:types>
  <wsdl:message name="SayHi">
    <wsdl:part element="ns1:yourName" name="yourName">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="SayHiResponse">
    <wsdl:part element="ns1:helloMessage" name="helloMessage">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="HelloWorld">
    <wsdl:operation name="SayHi">
      <wsdl:input message="ns1:SayHi" name="SayHi">
    </wsdl:input>
      <wsdl:output message="ns1:SayHiResponse" name="SayHiResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="HelloWorldServiceSoapBinding" type="ns1:HelloWorld">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="SayHi">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="SayHi">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="SayHiResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="HelloWorldService">
    <wsdl:port binding="ns1:HelloWorldServiceSoapBinding"
name="HelloWorldServicePort">
      <soap:address
location="http://localhost:8080/HelloWorld-070828/services/HelloWorld"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
-- 
View this message in context: http://www.nabble.com/http-conf%3Aconduit---spring-config---again-...-tf4387489.html#a12508832
Sent from the cxf-user mailing list archive at Nabble.com.


Re: http-conf:conduit - spring config - again ...

Posted by burki <da...@segmentone.com>.
Hey thanks for the workaround and the explanation!

--burki


Willem2 wrote:
> 
> Hi Burki,
> 
> This issue is caused by current CXF bus will not load the configuration 
> when the clients are created from spring configuration. Here is a 
> JIRA[1] for tracing it, currently I provide a walk around method in the 
> JIRA comments. I think it will take some time to really fix it after we 
> do some refactoring work on the configuration part.
> [1]https://issues.apache.org/jira/browse/CXF-922
> 
> Willem.
> 
> burki wrote:
>> I generated a client for the HelloWorld sample (slightly modified) and am
>> able to set http-conf:conduit parameters just fine.  The client is
>> generated
>> from the wsdl below.
>>
>> The http-conf section looks like:
>>
>> 	<http-conf:conduit
>> name="{http://websvc.s1.com/}HelloWorldServicePort.http-conduit">
>> 		<http-conf:client Connection="close"
>> 						  ConnectionTimeout="3000"
>> 						  ReceiveTimeout="10000"
>> 						  ProxyServer="127.0.0.1"
>> 						  ProxyServerPort="8888"/>
>> 	 </http-conf:conduit> 
>>
>> I'm passing the config to the client on the command line
>> (-Dcxf.config.file=...) everything works like a charm.
>>
>> But the same config loaded into a client developed in code-first approach
>> does nothing for the http-conf section - nana, zilch.  The rest of the
>> config, setting interceptors, etc works just fine.
>>
>> The client code is lifted from the sample in the cxf dist:
>>
>> public final class HelloWorldClient {
>>
>>     private HelloWorldClient() {
>>     }
>>
>>     public static void main(String args[]) throws Exception {
>>         ClassPathXmlApplicationContext context 
>>             = new ClassPathXmlApplicationContext(new String[]
>> {"com/s1/wsdemo/hello/apiclient/config/client-beans.xml"});
>>
>>         HelloWorld client = (HelloWorld)context.getBean("client");
>>         
>>
>>         String response = client.sayHi("Dan");
>>         System.out.println("Response: " + response);
>>         System.exit(0);
>>     }
>> }
>>
>> client-beans.xml is below.  Is there something I'm missing?  Am I using a
>> differently named port - or is another call to initialize cxf needed?
>>
>> Thanks a bunch for any pointers!
>>
>> --dan
>>
>> client-beans.xml:
>>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> 	xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
>> 	xsi:schemaLocation="http://www.springframework.org/schema/beans 
>> 						http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
>> 						http://cxf.apache.org/jaxws 
>> 						http://cxf.apache.org/schema/jaxws.xsd
>> 						http://cxf.apache.org/transports/http/configuration
>> 						http://cxf.apache.org/schemas/configuration/http-conf.xsd
>> 						">
>>
>> 	<http-conf:conduit
>> name="{http://websvc.s1.com/}HelloWorldServicePort.http-conduit">
>> 		<http-conf:client Connection="close"
>> 						  ConnectionTimeout="3000"
>> 						  ReceiveTimeout="10000"
>> 						  ProxyServer="127.0.0.1"
>> 						  ProxyServerPort="8888"/>
>> 	 </http-conf:conduit> 
>>
>>     <bean id="client" class="com.s1.wsdemo.hello.api.HelloWorld" 
>>       factory-bean="clientFactory" factory-method="create"/>
>>     
>> 	<bean id="clientFactory"
>> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>> 	  <property name="serviceClass"
>> value="com.s1.wsdemo.hello.api.HelloWorld"/>
>> 	  <property name="address"
>> value="http://localhost:8080/HelloWorld-070828/services/HelloWorld"/>
>> 	  
>> 	  <!-- start turn on logging -->
>>         <property name="inInterceptors">
>>             <list>
>>                 <bean
>> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>             </list>
>>         </property>
>>         <property name="outInterceptors">
>>             <list>
>>                 <bean
>> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>             </list>
>>         </property>
>>         <property name="outFaultInterceptors">
>>             <list>
>>                 <bean
>> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>             </list>
>>         </property>
>> 	  <!-- end turn on logging -->
>> 	
>> 	</bean>
>> 	  
>> </beans>
>>
>>
>> wsdl:
>>
>> <?xml version="1.0" encoding="utf-8"?><wsdl:definitions
>> xmlns:ns1="http://websvc.s1.com/"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldService"
>> targetNamespace="http://websvc.s1.com/">
>>   <wsdl:types>
>> <xsd:schema xmlns="http://websvc.s1.com/"
>> attributeFormDefault="unqualified"
>> elementFormDefault="qualified" targetNamespace="http://websvc.s1.com/">
>> <xsd:element name="yourName" nillable="true" type="xsd:string"/>
>> <xsd:element name="helloMessage" nillable="true" type="xsd:string"/>
>> </xsd:schema>
>>   </wsdl:types>
>>   <wsdl:message name="SayHi">
>>     <wsdl:part element="ns1:yourName" name="yourName">
>>     </wsdl:part>
>>   </wsdl:message>
>>   <wsdl:message name="SayHiResponse">
>>     <wsdl:part element="ns1:helloMessage" name="helloMessage">
>>     </wsdl:part>
>>   </wsdl:message>
>>   <wsdl:portType name="HelloWorld">
>>     <wsdl:operation name="SayHi">
>>       <wsdl:input message="ns1:SayHi" name="SayHi">
>>     </wsdl:input>
>>       <wsdl:output message="ns1:SayHiResponse" name="SayHiResponse">
>>     </wsdl:output>
>>     </wsdl:operation>
>>   </wsdl:portType>
>>   <wsdl:binding name="HelloWorldServiceSoapBinding"
>> type="ns1:HelloWorld">
>>     <soap:binding style="document"
>> transport="http://schemas.xmlsoap.org/soap/http"/>
>>     <wsdl:operation name="SayHi">
>>       <soap:operation soapAction="" style="document"/>
>>       <wsdl:input name="SayHi">
>>         <soap:body use="literal"/>
>>       </wsdl:input>
>>       <wsdl:output name="SayHiResponse">
>>         <soap:body use="literal"/>
>>       </wsdl:output>
>>     </wsdl:operation>
>>   </wsdl:binding>
>>   <wsdl:service name="HelloWorldService">
>>     <wsdl:port binding="ns1:HelloWorldServiceSoapBinding"
>> name="HelloWorldServicePort">
>>       <soap:address
>> location="http://localhost:8080/HelloWorld-070828/services/HelloWorld"/>
>>     </wsdl:port>
>>   </wsdl:service>
>> </wsdl:definitions>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/http-conf%3Aconduit---spring-config---again-...-tf4387489.html#a12523298
Sent from the cxf-user mailing list archive at Nabble.com.


Re: http-conf:conduit - spring config - again ...

Posted by Willem Jiang <ni...@iona.com>.
Hi Burki,

This issue is caused by current CXF bus will not load the configuration 
when the clients are created from spring configuration. Here is a 
JIRA[1] for tracing it, currently I provide a walk around method in the 
JIRA comments. I think it will take some time to really fix it after we 
do some refactoring work on the configuration part.
[1]https://issues.apache.org/jira/browse/CXF-922

Willem.

burki wrote:
> I generated a client for the HelloWorld sample (slightly modified) and am
> able to set http-conf:conduit parameters just fine.  The client is generated
> from the wsdl below.
>
> The http-conf section looks like:
>
> 	<http-conf:conduit
> name="{http://websvc.s1.com/}HelloWorldServicePort.http-conduit">
> 		<http-conf:client Connection="close"
> 						  ConnectionTimeout="3000"
> 						  ReceiveTimeout="10000"
> 						  ProxyServer="127.0.0.1"
> 						  ProxyServerPort="8888"/>
> 	 </http-conf:conduit> 
>
> I'm passing the config to the client on the command line
> (-Dcxf.config.file=...) everything works like a charm.
>
> But the same config loaded into a client developed in code-first approach
> does nothing for the http-conf section - nana, zilch.  The rest of the
> config, setting interceptors, etc works just fine.
>
> The client code is lifted from the sample in the cxf dist:
>
> public final class HelloWorldClient {
>
>     private HelloWorldClient() {
>     }
>
>     public static void main(String args[]) throws Exception {
>         ClassPathXmlApplicationContext context 
>             = new ClassPathXmlApplicationContext(new String[]
> {"com/s1/wsdemo/hello/apiclient/config/client-beans.xml"});
>
>         HelloWorld client = (HelloWorld)context.getBean("client");
>         
>
>         String response = client.sayHi("Dan");
>         System.out.println("Response: " + response);
>         System.exit(0);
>     }
> }
>
> client-beans.xml is below.  Is there something I'm missing?  Am I using a
> differently named port - or is another call to initialize cxf needed?
>
> Thanks a bunch for any pointers!
>
> --dan
>
> client-beans.xml:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans 
> 						http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
> 						http://cxf.apache.org/jaxws 
> 						http://cxf.apache.org/schema/jaxws.xsd
> 						http://cxf.apache.org/transports/http/configuration
> 						http://cxf.apache.org/schemas/configuration/http-conf.xsd
> 						">
>
> 	<http-conf:conduit
> name="{http://websvc.s1.com/}HelloWorldServicePort.http-conduit">
> 		<http-conf:client Connection="close"
> 						  ConnectionTimeout="3000"
> 						  ReceiveTimeout="10000"
> 						  ProxyServer="127.0.0.1"
> 						  ProxyServerPort="8888"/>
> 	 </http-conf:conduit> 
>
>     <bean id="client" class="com.s1.wsdemo.hello.api.HelloWorld" 
>       factory-bean="clientFactory" factory-method="create"/>
>     
> 	<bean id="clientFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
> 	  <property name="serviceClass"
> value="com.s1.wsdemo.hello.api.HelloWorld"/>
> 	  <property name="address"
> value="http://localhost:8080/HelloWorld-070828/services/HelloWorld"/>
> 	  
> 	  <!-- start turn on logging -->
>         <property name="inInterceptors">
>             <list>
>                 <bean
> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>             </list>
>         </property>
>         <property name="outInterceptors">
>             <list>
>                 <bean
> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>             </list>
>         </property>
>         <property name="outFaultInterceptors">
>             <list>
>                 <bean
> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>             </list>
>         </property>
> 	  <!-- end turn on logging -->
> 	
> 	</bean>
> 	  
> </beans>
>
>
> wsdl:
>
> <?xml version="1.0" encoding="utf-8"?><wsdl:definitions
> xmlns:ns1="http://websvc.s1.com/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldService"
> targetNamespace="http://websvc.s1.com/">
>   <wsdl:types>
> <xsd:schema xmlns="http://websvc.s1.com/" attributeFormDefault="unqualified"
> elementFormDefault="qualified" targetNamespace="http://websvc.s1.com/">
> <xsd:element name="yourName" nillable="true" type="xsd:string"/>
> <xsd:element name="helloMessage" nillable="true" type="xsd:string"/>
> </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="SayHi">
>     <wsdl:part element="ns1:yourName" name="yourName">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:message name="SayHiResponse">
>     <wsdl:part element="ns1:helloMessage" name="helloMessage">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:portType name="HelloWorld">
>     <wsdl:operation name="SayHi">
>       <wsdl:input message="ns1:SayHi" name="SayHi">
>     </wsdl:input>
>       <wsdl:output message="ns1:SayHiResponse" name="SayHiResponse">
>     </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="HelloWorldServiceSoapBinding" type="ns1:HelloWorld">
>     <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="SayHi">
>       <soap:operation soapAction="" style="document"/>
>       <wsdl:input name="SayHi">
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="SayHiResponse">
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="HelloWorldService">
>     <wsdl:port binding="ns1:HelloWorldServiceSoapBinding"
> name="HelloWorldServicePort">
>       <soap:address
> location="http://localhost:8080/HelloWorld-070828/services/HelloWorld"/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>