cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javawerks <javawe...@msn.com>
Subject Re: How to create a Spring-CXF Client Proxy
Date Tue, 06 May 2008 17:31:23 GMT

In the interim, I found the following workaround:

<beans xmlns="http://www.springframework.org/schema/beans"
	  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:context="http://www.springframework.org/schema/context"
	  xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context
         
http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <context:component-scan
base-package="com.wdw.avail.service.consumer.food.beverage.facility"/>

    <bean id="bus"
class="org.apache.cxf.bus.extension.ExtensionManagerBus"/>
    
    <bean id="foodBeverageFacilityServiceProxyFactory"
             class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
        <property name="serviceClass"
value="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"/>
        <property name="address"
value="${food.beverage.facility.service.provider.url}"/>
        <property name="bus" ref="bus"/>
    </bean>

    <bean id="foodBeverageFacilityServiceProxy"
            
class="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"
          factory-bean="foodBeverageFacilityServiceProxyFactory"
          factory-method="create"/>
</beans>

I used an ExtensionManagerBus, which gave me a non-null
DestinationFactoryManager and a client proxy.


javawerks wrote:
> 
> Thanks for the pointer, Willem. Sadly it did not work:
> 
>     <import resource="classpath:META-INF/cxf/cxf.xml"/>
>     <import resource="classpath*:META-INF/cxf/cxf-extension-*.xml"/>
>  
>     <context:component-scan
> base-package="com.wdw.avail.service.consumer.food.beverage.facility"/>
> 
>     <bean id="foodBeverageFacilityServiceProxyFactory"
>           class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>         <property name="serviceClass"
> value="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"/>
>         <property name="address"
> value="${food.beverage.facility.service.provider.url}"/>
>         <property name="bus" ref="cxf"/>
>     </bean>
> 
>     <bean id="foodBeverageFacilityServiceProxy"
>          
> class="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"
>           factory-bean="foodBeverageFacilityServiceProxyFactory"
>           factory-method="create"/>
> 
> The same exception is thrown:
> 
> Caused by: java.lang.NullPointerException
> 	at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:155)
> 	at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:97)
> 	at
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
> 	at
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:92)
> 
> I get your point on the 'cxf' bus being initialized via the cxf.xml. But
> the DestinationFactoryManager appears to be null, despite being created as
> well (and being on the classpath in cxf-2.0.6.jar).
> 
> Has anybody successfully created a JAX-WS client proxy and deployed via a
> war file? Again, the above Spring configuration works outside of a war in
> a unit test.
> 
> Thanks!
> 
> 
> willem.jiang wrote:
>> 
>> Aha, another bus issue.
>> Please see my comments in the mail.
>> Javawerks wrote:
>>> I have been unable to create a Spring-CXF client proxy. This is my
>>> spring
>>> context:
>>>  
>>>     <import resource="classpath:META-INF/cxf/cxf.xml"/>
>>>     <import resource="classpath*:META-INF/cxf/cxf-extension-*.xml"/>
>>>  
>>>     <context:component-scan
>>> base-package="com.wdw.avail.service.consumer.food.beverage.facility"/>
>>>  
>>>     <bean id="bus" class="org.apache.cxf.bus.CXFBusImpl"/>
>>>   
>> You should not define the bus explicitly without any other cxf 
>> components (such as the DestinationFactoryManager instance) injected.
>> 
>>>  
>>>     <bean id="foodBeverageFacilityServiceProxyFactory"
>>>           class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>>>         <property name="clientFactoryBean">
>>>             <bean class="org.apache.cxf.jaxws.JaxWsClientFactoryBean"/>
>>>         </property>
>>>         <property name="serviceClass"
>>> value="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"/>
>>>         <property name="address"
>>> value="${food.beverage.facility.service.provider.url}"/>
>>>         <property name="bus" ref="bus"/>
>>>   
>> You need to change the reference bean's name to "cxf ", which is the 
>> default bus that you import with "META-INF/cxf/cxf.xml"[1]
>>>     </bean>
>>>  
>>>     <bean id="foodBeverageFacilityServiceProxy"
>>>          
>>> class="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"
>>>           factory-bean="foodBeverageFacilityServiceProxyFactory"
>>>           factory-method="create"/>
>>>  
>>> I have tried creating the above client proxy with or without the 'bus'
>>> and
>>> 'clientFactoryBean'. Either way, I always get this exception:
>>>  
>>> Caused by: java.lang.NullPointerException
>>> 	at
>>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:155)
>>> 	at
>>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:97)
>>> 	at
>>> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
>>> 	at
>>> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:92)
>>>  
>>> We all know the offending code:
>>>  
>>> 154.                DestinationFactoryManager dfm =
>>> getBus().getExtension(DestinationFactoryManager.class);
>>> 155.                df = dfm.getDestinationFactoryForUri(getAddress());
>>>  
>>> That said, my unit (integration) test works like a charm. Once I deploy
>>> the
>>> above client proxy in a web app to WAS6.1, though, the exception occurs.
>>> FWIW, I have followed the WAS cxf wiki instructions, which did not alter
>>> the
>>> outcome.
>>>  
>>> Any thoughts?
>>>  
>>> Thanks!
>>>   
>> [1] 
>> https://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
>> 
>> Willem
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-create-a-Spring-CXF-Client-Proxy-tp17068045p17088276.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message