You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jingfei Hu <ji...@hotmail.com> on 2019/04/11 04:12:06 UTC
Stuck when migrating XFire to CXF
Hi team,
Recently we began to migrate XFire to CXF due to its incompatibility with Spring 4.x. And our environment is a heavy Spring environment. Below is our Spring beans definition configuration file snippets used in client side to connect to server side which exports WS service using XFire as well.
<?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:sofa="http://schema.recon.com/sofa/schema/slite"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://schema.recon.com/sofa/schema/slite
http://schema.recon.com/sofa/slite.xsd">
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>
<bean id="wsParent" abstract="true">
<property name="serviceFactory">
<ref bean="xfire.serviceFactory" />
</property>
<property name="lookupServiceOnStartup">
<value>false</value>
</property>
</bean>
<!-- Easy to use -->
<bean id="dataBankService" class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean" parent="wsParent">
<property name="serviceClass">
<value>com.batch.service.facade.databank.DataBankService</value>
</property>
<property name="wsdlDocumentUrl">
<value>http://batch.test.recon.net:8080/batch/dataBankService?wsdl</value>
</property>
<property name="properties">
<props>
<prop key="http.timeout">30000</prop>
<prop key="http.connection.timeout">3000</prop>
</props>
</property>
</bean>
</beans>
Follow the migration guide, i convert it to below CXF file
<?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:sofa="http://schema.recon.com/sofa/schema/slite"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://schema.recon.com/sofa/schema/slite
http://schema.recon.com/sofa/slite.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<bean id="dataBankServiceProxyFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass">
<value>com.batch.service.facade.databank.DataBankService</value>
</property>
<property name="wsdlURL">
<value>http://batch.test.recon.net:8080/batch/dataBankService?wsdl</value>
</property>
<property name="properties">
<props>
<prop key="http.timeout">30000</prop>
<prop key="http.connection.timeout">3000</prop>
</props>
</property>
</bean>
<bean id="dataBankService" class="com.batch.service.facade.databank.DataBankService" factory-bean="dataBankServiceProxyFactory" factory-method="create">
</bean>
</beans>
However, it fails due to below error.
11:59:05,274 DEBUG spring.ConfigurerImpl: Could not find a definition for bean with id {http://databank.facade.service.batch/}DataBankServicePort.jaxws-client.proxyFactory - no injection will be performed.
11:59:05,280 INFO factory.ReflectionServiceFactoryBean: Creating Service {http://databank.facade.service.batch/}DataBankServiceService from WSDL: http://batch.test.recon.net:8080/batch/dataBankService?wsdl
11:59:05,345 DEBUG spring.ConfigurerImpl: Could not determine bean name for instance of class org.apache.cxf.wsdl11.WSDLManagerImpl.
11:59:05,346 DEBUG resource.DefaultResourceManager: resolving resource <org.apache.cxf.wsdl11.WSDLManagerImpl/bus> type <interface org.apache.cxf.Bus>
11:59:05,348 DEBUG resource.DefaultResourceManager: resolving resource <null> type <interface org.apache.cxf.Bus>
11:59:05,413 DEBUG spring.ConfigurerImpl: Could not determine bean name for instance of class org.apache.cxf.binding.xml.wsdl11.XMLWSDLExtensionLoader.
11:59:05,423 DEBUG spring.ConfigurerImpl: Could not determine bean name for instance of class org.apache.cxf.ws.addressing.impl.AddressingWSDLExtensionLoader.
11:59:05,446 DEBUG spring.ConfigurerImpl: Could not determine bean name for instance of class org.apache.cxf.transport.http.HTTPWSDLExtensionLoader.
11:59:05,478 DEBUG spring.ConfigurerImpl: Could not determine bean name for instance of class org.apache.cxf.catalog.OASISCatalogManager.
11:59:05,499 DEBUG spring.ConfigurerImpl: Could not determine bean name for instance of class org.apache.cxf.transport.http.HTTPTransportFactory.
11:59:05,537 DEBUG spring.ConfigurerImpl: Could not find a definition for bean with id {http://cxf.apache.org}TransportURIResolver.http-conduit - no injection will be performed.
11:59:05,537 DEBUG spring.ConfigurerImpl: Could not find a definition for bean with id http://batch.test.recon.net:8080/batch/dataBankService - no injection will be performed.
11:59:05,544 DEBUG http.HTTPConduit: Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been (re)configured for plain http.
11:59:05,544 DEBUG http.HTTPConduit: No Trust Decider configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
11:59:05,545 DEBUG http.HTTPConduit: No Auth Supplier configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
11:59:05,545 DEBUG http.HTTPConduit: Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been configured for plain http.
11:59:05,546 DEBUG http.HTTPConduit: registering incoming observer: org.apache.cxf.transport.TransportURIResolver$1@7ce29a2d
11:59:05,562 DEBUG http.Headers: Accept: */*
11:59:05,562 DEBUG http.HTTPConduit: No Trust Decider for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'. An afirmative Trust Decision is assumed.
11:59:05,804 WARN support.ClassPathXmlApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataBankService' defined in class path resource [META-INF/spring/tmp/common-integration.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.Object]: Factory method 'create' threw exception; nested exception is org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://databank.facade.service.batch/}DataBankServiceService.
The highlighted String is the targetNameSpace in the WSDL document. I believe there are something misconfigured, since the service name should be com.batch.service.facade.databank.DataBankService instead of a string in form of {targetNamespace/}DataBankServiceService but fail to know where. Could you help me to get out of this?
For better troubleshooting, i present below WDSL document outline with details removed. I can attach the full document if you insist.
<wsdl:definitions xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://databank.facade.service.batch" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://result.common.core" xmlns:ns1="http://order.facade.service.batch" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:ns4="http://result.facade.service.batch" xmlns:ns3="http://code.result.common.core" targetNamespace="http://databank.facade.service.batch">
<wsdl:types>...</wsdl:types>
<wsdl:message name="pagingRecoveryResponse">...</wsdl:message>
<wsdl:message name="dealFileRequest">...</wsdl:message>
<wsdl:message name="receiveMessageResponse">...</wsdl:message>
<wsdl:message name="pushLogicBatchRepeatableResponse">...</wsdl:message>
<wsdl:message name="parseFileAndClearRequest">...</wsdl:message>
<wsdl:message name="pagingRecoveryRequest">...</wsdl:message>
<wsdl:message name="parseFileAndClearResponse">...</wsdl:message>
<wsdl:message name="receiveMessageRequest">...</wsdl:message>
<wsdl:message name="recoverySlipDataRequest">...</wsdl:message>
<wsdl:message name="recoverySlipDataResponse">...</wsdl:message>
<wsdl:message name="triggerCollectionTaskResponse">...</wsdl:message>
<wsdl:message name="pushLogicBatchRepeatableRequest">...</wsdl:message>
<wsdl:message name="dealFileResponse">...</wsdl:message>
<wsdl:message name="triggerCollectionTaskRequest">...</wsdl:message>
<wsdl:portType name="8080/batch/dataBankServicePortType">...</wsdl:portType>
<wsdl:binding name="8080/batch/dataBankServiceHttpBinding" type="tns:8080/batch/dataBankServicePortType">...</wsdl:binding>
<wsdl:service name="8080/batch/dataBankService">...</wsdl:service>
</wsdl:definitions>
Best Regards,
Balin