You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Javawerks <ja...@msn.com> on 2008/05/05 20:37:35 UTC

How to create a Spring-CXF Client Proxy

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"/>
 
    <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"/>
    </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!
-- 
View this message in context: http://www.nabble.com/How-to-create-a-Spring-CXF-Client-Proxy-tp17068045p17068045.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to create a Spring-CXF Client Proxy

Posted by javawerks <ja...@msn.com>.
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.


Re: How to create a Spring-CXF Client Proxy

Posted by javawerks <ja...@msn.com>.
Hi, Dan

I'm using CXF 2.0.6.

I have tried the cxf-all.xml option, the no *.xml option and about every
other *.xml option you can imagine, to no avail. I have not tried the
jaxws:client approach.

No matter how I configured a client proxy, I consistently received a npe on
DestinationFactoryManager that I detail else where in this thread. And that
would seem to indicate that I was consistently using an improperly
initialized bus.

Keep in mind virtually any client proxy configuration worked in a unit test.
It was when I deployed a client proxy in a war to Websphere 6.1 that I had
problems.

In the war, I was deploying 3 web service providers, in addition to 2 web
service consumers (or client proxies). Although I haven't had time to verify
this line of thought, I wonder if loading a cxf.xml Spring context for each
web service consumer and provider is a good idea. Would it make more sense
to load a cxf.xml Spring context once in the web app Spring context, for
instance? Of course, I'm just guessing, and this whole challenge with client
proxies might be some exotic class loader issue with Websphere (although I
have the class loader policies finely tuned to work around 'all' the
problems that ship with WAS;) I should note that the CXF wiki entry on WAS
configuration was not relevant to solving this problem.

I noticed other folks have been having the same problem I have had with
client proxies. So, perhaps, someone with more knowledge of CXF internals
(and time) can get to the bottom of this issue.

Thanks, Mike


dkulp wrote:
> 
> 
> Are you on CXF 2.1 or 2.0.6?
> 
> If so, I would suggest just doing:
> 
>    <import resource="classpath:META-INF/cxf/cxf-all.xml"/>
> 
> That will get all the cxf stuff with a single import and not need the  
> wildcard (which in spring is pretty slow).
> 
> 
> Next question:
> Have you tried using the jaxws:client bean definition we show at the  
> bottom of:
> http://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html
> Your two bean defs can drop to a single line.
> 
> <jaxws:client
>      id="foodBeverageFacilityServiceProxy"
>       
> serviceClass 
> ="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"
>      address="${food.beverage.facility.service.provider.url}"/>
> 
> Actually, the other option might be to not import any of the cxf stuff  
> and DON'T set the bus property on the factory.   In that case, it may  
> create  a default bus which would load everything anyway.
> 
> Dan
> 
> 
> On May 6, 2008, at 4:31 AM, 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-tp17068045p17078285.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
> 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 
> 
> 
> 

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


Re: How to create a Spring-CXF Client Proxy

Posted by Daniel Kulp <dk...@apache.org>.
Are you on CXF 2.1 or 2.0.6?

If so, I would suggest just doing:

   <import resource="classpath:META-INF/cxf/cxf-all.xml"/>

That will get all the cxf stuff with a single import and not need the  
wildcard (which in spring is pretty slow).


Next question:
Have you tried using the jaxws:client bean definition we show at the  
bottom of:
http://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html
Your two bean defs can drop to a single line.

<jaxws:client
     id="foodBeverageFacilityServiceProxy"
      
serviceClass 
="com.wdpr.core.facility.wsdl.FoodBeverageFacilityServiceSEI"
     address="${food.beverage.facility.service.provider.url}"/>

Actually, the other option might be to not import any of the cxf stuff  
and DON'T set the bus property on the factory.   In that case, it may  
create  a default bus which would load everything anyway.

Dan


On May 6, 2008, at 4:31 AM, 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-tp17068045p17078285.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog




Re: How to create a Spring-CXF Client Proxy

Posted by javawerks <ja...@msn.com>.
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-tp17068045p17078285.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to create a Spring-CXF Client Proxy

Posted by Willem Jiang <wi...@gmail.com>.
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