My project has a bucketload of JUnit tests that used XFire's 'xfire' Spring
bean to get an XFireProxyFactory object, and create a local instance of the
service.
This code works like this:
XFire xfire = (XFire) applicationContext.getBean("xfire");
ServiceRegistry serviceRegistry = xfire.getServiceRegistry();
Service service = serviceRegistry.getService(name);
XFireProxyFactory factory = new XFireProxyFactory(xfire);
return (WebServiceBase) factory.create(service, "xfire.local://" +
name);
I've been trying to get CXF to use the LocalTransport and I think I have it
mostly working - it calls into the service and returns, but the return value
is ALWAYS null. I created a micro-project to test that setup without
anything else in it, and I'm able to re-create the only-null-return issue.
Our stuff uses Spring, JAXWS and Aegis and the configuration file looks like
this:
<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:soap="http://cxf.apache.org/bindings/soap"
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/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
<bean id='jaxws-aegis-factory'
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>
<bean class="org.apache.cxf.transport.local.LocalTransportFactory"
lazy-init="false">
<property name="transportIds">
<list>
<value>http://cxf.apache.org/transports/local</value>
<value>http://schemas.xmlsoap.org/soap/http</value>
<value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
</list>
</property>
</bean>
<jaxws:endpoint name="localtest" address="local://localtest"
implementor="net.bixbys.svc.CXFLocalTestServiceImpl">
<jaxws:serviceFactory>
<ref bean='jaxws-aegis-factory'/>
</jaxws:serviceFactory>
</jaxws:endpoint>
</beans>
The interface and implementation of the service:
@WebService(name = "ServiceTwo")
public interface CXFLocalTestService {
public String theMethod(String str1, int int2, Long long3);
}
public class CXFLocalTestServiceImpl implements CXFLocalTestService {
public String theMethod(String str1, int int2, Long long3) {
System.out.println("str1 = " + str1);
System.out.println("int2 = " + int2);
System.out.println("long3 = " + long3);
String combined = str1 + " -- " + int2 + " -- " + long3;
System.out.println("combined = " + combined);
return combined;
}
}
We use Spring dependency injection test classes for our JUnit tests; some
tests use transactional tests so we can modify the DB, and it will roll back
on exit. Other tests just do read-only and skip the transactional part.
The sample's client test:
public class TestLocalService extends
AbstractDependencyInjectionSpringContextTests {
protected String[] getConfigLocations() {
setAutowireMode(AUTOWIRE_BY_NAME);
return new String[]{"classpath*:spring-config.xml"};
}
public void testServiceCall() throws Exception {
ClientProxyFactoryBean cf = new ClientProxyFactoryBean();
cf.setAddress("local://localtest");
cf.setServiceClass(CXFLocalTestService.class); // Optionally specify
the service interface
CXFLocalTestService lts = (CXFLocalTestService) cf.create();
System.out.println("lts.theMethod(\"calling\",10,20L) = " +
lts.theMethod("calling", 10, 20L));
}
}
When I run this, I get the console output:
str1 = calling
int2 = 10
long3 = 20
combined = calling -- 10 -- 20
lts.theMethod("calling",10,20L) = null
I've tried stepping into the CXF source, but I don't know my way around very
well. I have no idea if I have a configuration issue, a bug, or what.
Any ideas?
--
View this message in context:
http://www.nabble.com/Still-having-problems-with-LocalTransport-tp14942855p14942855.html
Sent from the cxf-user mailing list archive at Nabble.com.