You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrei Shakirin <as...@talend.com> on 2012/07/23 11:48:55 UTC
ServiceConstructionException by using "-db source" option for code
generation
Hi,
I am trying to use "-db source" option for WSDL code generation. Use case is using SAX data source together with spring/blueprint configuration.
Regarding https://issues.apache.org/jira/browse/CXF-3885 it should be supported in CXF 2.5.0. I test it with CXF 2.6.0.
Code is successfully generated, I see @DataBinding(org.apache.cxf.databinding.source.SourceDataBinding.class) annotation in my interface.
But when client tries to send request, following exception is occurs:
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Service class org.talend.benchmark.Benchmark met
hod oneWay part {http://www.talend.org/benchmark}parameters cannot be mapped to schema. Check for use of a JAX-WS-specif
ic type without the JAX-WS service factory bean.
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createBareMessage(ReflectionServiceFactoryBean.ja
va:1215)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBea
n.java:484)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:685)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBe
an.java:536)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:248)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java
:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:156)
at org.apache.cxf.jaxws.spring.JaxWsProxyFactoryBeanDefinitionParser$JAXWSSpringClientProxyFactoryBean.create(Ja
xWsProxyFactoryBeanDefinitionParser.java:79)
at org.apache.cxf.jaxws.spring.JaxWsProxyFactoryBeanDefinitionParser$JAXWSSpringClientProxyFactoryBean.getObject
(JaxWsProxyFactoryBeanDefinitionParser.java:83)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRe
gistrySupport.java:142)
Looking in source code: ReflectionServiceFactoryBean.createBareMessage goes through the all message parts and fills the XmlSchemaElement. If the message part typeQName and xmlSchema properties are null (it is exactly the case for SourceDataBinding), ServiceConstructionException will be thrown.
Are the additional configuration/properties needed for spring/blueprint client for this case?
Any ideas?
Regards,
Andrei.
Re: ServiceConstructionException by using "-db source" option for code generation
Posted by Daniel Kulp <dk...@apache.org>.
The key is line:
at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:685)
For the "source" databinding to work, you MUST provide it with a WSDL so it
goes into the buildServiceFromWSDL. We don't have any types or anything to
be able to generate a proper wsdl so you need to supply one.
If you add:
@WebService(wsdlLocation="classpath:/CustomerService.wsdl",
targetNamespace = "http://customerservice.example.com/",
serviceName="CustomerServiceService", portName="CustomerServicePort")
to the top of CustomerServiceImpl, it will likely work better.
Dan
On Monday, July 23, 2012 09:48:55 AM Andrei Shakirin wrote:
> Hi,
>
> I am trying to use "-db source" option for WSDL code generation. Use case
> is using SAX data source together with spring/blueprint configuration.
> Regarding https://issues.apache.org/jira/browse/CXF-3885 it should be
> supported in CXF 2.5.0. I test it with CXF 2.6.0.
>
> Code is successfully generated, I see
> @DataBinding(org.apache.cxf.databinding.source.SourceDataBinding.class)
> annotation in my interface.
>
> But when client tries to send request, following exception is occurs:
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
> Service class org.talend.benchmark.Benchmark met hod oneWay part
> {http://www.talend.org/benchmark}parameters cannot be mapped to schema.
> Check for use of a JAX-WS-specif ic type without the JAX-WS service
> factory bean.
> at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createBareMes
> sage(ReflectionServiceFactoryBean.ja va:1215)
> at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceF
> romClass(ReflectionServiceFactoryBea n.java:484)
> at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClas
> s(JaxWsServiceFactoryBean.java:685) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeSer
> viceModel(ReflectionServiceFactoryBe an.java:536)
> at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Reflec
> tionServiceFactoryBean.java:248) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceF
> actoryBean.java:205) at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(A
> bstractWSDLBasedEndpointFactory.java
> :101)
>
> at
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:9
> 0) at
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryB
> ean.java:155) at
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.j
> ava:156) at
> org.apache.cxf.jaxws.spring.JaxWsProxyFactoryBeanDefinitionParser$JAXWSSp
> ringClientProxyFactoryBean.create(Ja
> xWsProxyFactoryBeanDefinitionParser.java:79)
> at
> org.apache.cxf.jaxws.spring.JaxWsProxyFactoryBeanDefinitionParser$JAXWSSp
> ringClientProxyFactoryBean.getObject
> (JaxWsProxyFactoryBeanDefinitionParser.java:83)
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGe
> tObjectFromFactoryBean(FactoryBeanRe gistrySupport.java:142)
>
> Looking in source code: ReflectionServiceFactoryBean.createBareMessage
> goes through the all message parts and fills the XmlSchemaElement. If the
> message part typeQName and xmlSchema properties are null (it is exactly
> the case for SourceDataBinding), ServiceConstructionException will be
> thrown.
>
> Are the additional configuration/properties needed for spring/blueprint
> client for this case? Any ideas?
>
> Regards,
> Andrei.
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com