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
[EMAIL PROTECTED]
http://www.dankulp.com/blog