cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: question about creating junit test for cxf
Date Wed, 17 Dec 2008 18:37:54 GMT

The problem is with your spring-test.xml file.    Nowhere do you actually 
startup a service on that port/url.  You have the service factory configured, 
but nothing actually uses it.   I've included a new spring-test.xml below 
that allows the test to pass.

Dan



On Wednesday 17 December 2008 1:54:45 am shrimpywu wrote:
> Hi everyone, i am new with CXF, just recently jump into it.
>
> I do search from google, and there is a small sample for cxf with maven(i
> am big fans of maven),
> but unfortunately the test doesn`t run, i always get exception as what i
> paste below.
>
> i try to run it without junit tests, it work just fine, i can see the WSDL
> file from the broswer, but i really want the tests work as well...
>
> i am wondering the server cannot start properly or something, but don`t
> know how to solve it.
>
> Here is the source code i am working on, just very tiny small demo.
> http://sites.google.com/site/shrimpysface/Home/cxfSample1.zip?attredirects=
>0
>
> can anyone spend some minutes to help me find out why it always doesn`t
> work?


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


<?xml version="1.0" encoding="UTF-8"?>

<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:cxf="http://cxf.apache.org/core"
       xsi:schemaLocation="http://cxf.apache.org/core
        http://cxf.apache.org/schemas/core.xsd
        http://cxf.apache.org/jaxws
        http://cxf.apache.org/schemas/jaxws.xsd
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
    <!-- Enable message logging using the CXF logging feature -->
    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus>
    
	<!-- Aegis data binding -->
	<bean id="aegisBean"
		class="org.apache.cxf.aegis.databinding.AegisDatabinding"
		scope="prototype" />


    <bean id="jaxwsAndAegisServiceFactory"
          class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
          scope="prototype"> 
        <property name="dataBinding" ref="aegisBean"/>
        <property name="serviceConfigurations">
          <list>
            <bean 
class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
            <bean 
class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
            <bean 
class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/> 
          </list>
        </property>
    </bean>

    <!-- Service endpoint -->
    <!-- See http://incubator.apache.org/cxf/faq.html regarding CXF + Spring 
AOP -->
    <jaxws:endpoint id="contactUsService"
            implementor="contactus.ContactUsServiceImpl"
            address="http://localhost:9090/CxfSample1/contactus">
        <jaxws:serviceFactory>
            <ref bean="jaxwsAndAegisServiceFactory"/>
        </jaxws:serviceFactory>
    </jaxws:endpoint>
    
	<!-- Client code for unit test (or for injecting in webapp as done in the 
article) -->
	
	<!-- Factory to create the dynamic proxy for client -->
	<bean id="contactUsFactory"
		class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
		<property name="serviceClass"
			value="contactus.ContactUsService" />
		<property name="address"
			value="http://localhost:9090/CxfSample1/contactus" />
		<property name="serviceFactory"
			ref="jaxwsAndAegisServiceFactory" />
	</bean>

	<!--  Web service dynamic proxy -->
	<bean id="contactUsServiceClient" class="contactus.ContactUsService"
		factory-bean="contactUsFactory" factory-method="create" />

</beans>




Mime
View raw message