You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sathwik B P <sa...@gmail.com> on 2015/04/14 11:25:37 UTC

Need a generic service impl for any given WSDL Definition

Hi Guys,


We need to create cxf services from wsdl definitions. There would be one
generic service implementation class for any given WSDL service.

So I suppose implementation of javax.xml.ws.Provider interface would the
right choice here.

I have been working with ReflectionServiceFactoryBean and
JaxWsServiceFactoryBean but not been able to create the service at all.

Here is the code snippet,

        URL resource =
getClass().getResource("/examples/client/HelloWorld.wsdl");
        Bus bus = BusFactory.newInstance().createBus();
        ReflectionServiceFactoryBean bean = new
ReflectionServiceFactoryBean();
        bean.setWsdlURL(resource.toString());
        bean.setBus(bus);
        bean.setPopulateFromClass(false);
        bean.setServiceClass(CommonProvider.class);
        bean.create();


        @WebServiceProvider()
        @ServiceMode(value=Service.Mode.PAYLOAD)
        public class CommonProvider implements Provider<Source> {...}


*Error:org.apache.cxf.service.factory.ServiceConstructionException: Could
not find definition for service
{http://provider.example/}CommonProviderService
<http://provider.example/}CommonProviderService>.*

It's pretty much the code from ProviderServiceFactoryTest

What am I missing here?

regards,
sathwik

Re: Need a generic service impl for any given WSDL Definition

Posted by Sathwik B P <sa...@gmail.com>.
Hi Daniel,

Thanks for your pointers. It worked.

regards,
sathwik

On Wed, Apr 15, 2015 at 11:02 PM, Daniel Kulp <dk...@apache.org> wrote:

> I would likely use a generic JAX-WS Provider<Source> based service and use
> the JaxWsServerFactoryBean to start it up.   You can omit the wsdlLocation
> and such from the Provider object as long as you get all of that property
> set on the JaxWsServerFactoryBean (note:  this is JaxWsServerFactoryBean,
> NOT JaxWsServiceFactoryBean) prior to calling the create.
>
> I think a chunk of your issue is using JaxWsServiceFactoryBean.  That bean
> is used internally to the JaxWsServerFactoryBean to setup the object model
> representing the service, but the Server factory bean is what is needed to
> actually create the server that would process messages.     You’d likely
> also need to call the setServiceName(…) and possibly setEndpointName(…)
> methods on the JaxWsServerFactoryBean to denote which service/port in the
> WSDL you want the service to represent.
>
> Dan
>
>
> > On Apr 14, 2015, at 11:45 PM, Sathwik B P <sa...@gmail.com> wrote:
> >
> > Hi Adrei,
> >
> > Thanks for your response.
> >
> > The requirement is,
> > "There would be one generic service implementation class for ANY given
> WSDL
> > definition". Irrespective of the service names, port names, wsdl
> > operations, all requests coming in should land on the same service
> > implementation method.
> >
> > HelloWorld.wsdl -> CommonProviderService
> > Greeter.wsdl      -> CommonProviderService
> > Stock.wsdl        -> CommonProviderService
> >
> > Henceforth I cannot embed the portName or the service names in the
> Provider
> > class.
> >
> > This service is like a passthrough, the payload will be consumed and
> > response will be generated by our runtime components in the system.
> >
> >
> > *Update:*
> > *I could get over the previous error by explicitly setting the
> serviceName
> > and endpointName in the bean.*
> >
> > *But now I don't see the service registered under CXFNoSpringSevlet and
> > neither do I get the publised WSDL from the service.*
> >
> > regards,
> > sathwik
> >
> > On Wed, Apr 15, 2015 at 12:48 AM, Andrei Shakirin <as...@talend.com>
> > wrote:
> >
> >> Hi,
> >>
> >> The error message says that service name in your wsdl doesn't match to
> >> default service name generated on the base of CommonProvider class.
> >> You can configure service name using @WebServiceProvider annotation:
> >>
> >> @WebServiceProvider(portName = " CommonProvider", serviceName = "
> >> CommonProviderService ",
> >>                      targetNamespace = " http://provider.example/)
> >> @ServiceMode(value=Service.Mode.PAYLOAD)
> >> public class CommonProvider implements Provider<Source> {...}
> >>
> >> By the way there is more portable way to create service implementing
> >> Provider interface: using javax.xml.ws.Endpoint.
> >> Take a look this example for details:
> >>
> https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jaxws_dispatch_provider/src/main/java/demo/hwDispatch/server/Server.java
> >>
> >> Regards,
> >> Andrei.
> >>
> >>
> >>> -----Original Message-----
> >>> From: Sathwik B P [mailto:sathwik.bp@gmail.com]
> >>> Sent: Dienstag, 14. April 2015 11:26
> >>> To: users@cxf.apache.org
> >>> Subject: Need a generic service impl for any given WSDL Definition
> >>>
> >>> Hi Guys,
> >>>
> >>>
> >>> We need to create cxf services from wsdl definitions. There would be
> one
> >>> generic service implementation class for any given WSDL service.
> >>>
> >>> So I suppose implementation of javax.xml.ws.Provider interface would
> the
> >> right
> >>> choice here.
> >>>
> >>> I have been working with ReflectionServiceFactoryBean and
> >>> JaxWsServiceFactoryBean but not been able to create the service at all.
> >>>
> >>> Here is the code snippet,
> >>>
> >>>        URL resource =
> >>> getClass().getResource("/examples/client/HelloWorld.wsdl");
> >>>        Bus bus = BusFactory.newInstance().createBus();
> >>>        ReflectionServiceFactoryBean bean = new
> >> ReflectionServiceFactoryBean();
> >>>        bean.setWsdlURL(resource.toString());
> >>>        bean.setBus(bus);
> >>>        bean.setPopulateFromClass(false);
> >>>        bean.setServiceClass(CommonProvider.class);
> >>>        bean.create();
> >>>
> >>>
> >>>        @WebServiceProvider()
> >>>        @ServiceMode(value=Service.Mode.PAYLOAD)
> >>>        public class CommonProvider implements Provider<Source> {...}
> >>>
> >>>
> >>> *Error:org.apache.cxf.service.factory.ServiceConstructionException:
> >> Could not
> >>> find definition for service {
> >> http://provider.example/}CommonProviderService
> >>> <http://provider.example/}CommonProviderService>.*
> >>>
> >>> It's pretty much the code from ProviderServiceFactoryTest
> >>>
> >>> What am I missing here?
> >>>
> >>> regards,
> >>> sathwik
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: Need a generic service impl for any given WSDL Definition

Posted by Daniel Kulp <dk...@apache.org>.
I would likely use a generic JAX-WS Provider<Source> based service and use the JaxWsServerFactoryBean to start it up.   You can omit the wsdlLocation and such from the Provider object as long as you get all of that property set on the JaxWsServerFactoryBean (note:  this is JaxWsServerFactoryBean, NOT JaxWsServiceFactoryBean) prior to calling the create.

I think a chunk of your issue is using JaxWsServiceFactoryBean.  That bean is used internally to the JaxWsServerFactoryBean to setup the object model representing the service, but the Server factory bean is what is needed to actually create the server that would process messages.     You’d likely also need to call the setServiceName(…) and possibly setEndpointName(…) methods on the JaxWsServerFactoryBean to denote which service/port in the WSDL you want the service to represent.   

Dan


> On Apr 14, 2015, at 11:45 PM, Sathwik B P <sa...@gmail.com> wrote:
> 
> Hi Adrei,
> 
> Thanks for your response.
> 
> The requirement is,
> "There would be one generic service implementation class for ANY given WSDL
> definition". Irrespective of the service names, port names, wsdl
> operations, all requests coming in should land on the same service
> implementation method.
> 
> HelloWorld.wsdl -> CommonProviderService
> Greeter.wsdl      -> CommonProviderService
> Stock.wsdl        -> CommonProviderService
> 
> Henceforth I cannot embed the portName or the service names in the Provider
> class.
> 
> This service is like a passthrough, the payload will be consumed and
> response will be generated by our runtime components in the system.
> 
> 
> *Update:*
> *I could get over the previous error by explicitly setting the serviceName
> and endpointName in the bean.*
> 
> *But now I don't see the service registered under CXFNoSpringSevlet and
> neither do I get the publised WSDL from the service.*
> 
> regards,
> sathwik
> 
> On Wed, Apr 15, 2015 at 12:48 AM, Andrei Shakirin <as...@talend.com>
> wrote:
> 
>> Hi,
>> 
>> The error message says that service name in your wsdl doesn't match to
>> default service name generated on the base of CommonProvider class.
>> You can configure service name using @WebServiceProvider annotation:
>> 
>> @WebServiceProvider(portName = " CommonProvider", serviceName = "
>> CommonProviderService ",
>>                      targetNamespace = " http://provider.example/)
>> @ServiceMode(value=Service.Mode.PAYLOAD)
>> public class CommonProvider implements Provider<Source> {...}
>> 
>> By the way there is more portable way to create service implementing
>> Provider interface: using javax.xml.ws.Endpoint.
>> Take a look this example for details:
>> https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jaxws_dispatch_provider/src/main/java/demo/hwDispatch/server/Server.java
>> 
>> Regards,
>> Andrei.
>> 
>> 
>>> -----Original Message-----
>>> From: Sathwik B P [mailto:sathwik.bp@gmail.com]
>>> Sent: Dienstag, 14. April 2015 11:26
>>> To: users@cxf.apache.org
>>> Subject: Need a generic service impl for any given WSDL Definition
>>> 
>>> Hi Guys,
>>> 
>>> 
>>> We need to create cxf services from wsdl definitions. There would be one
>>> generic service implementation class for any given WSDL service.
>>> 
>>> So I suppose implementation of javax.xml.ws.Provider interface would the
>> right
>>> choice here.
>>> 
>>> I have been working with ReflectionServiceFactoryBean and
>>> JaxWsServiceFactoryBean but not been able to create the service at all.
>>> 
>>> Here is the code snippet,
>>> 
>>>        URL resource =
>>> getClass().getResource("/examples/client/HelloWorld.wsdl");
>>>        Bus bus = BusFactory.newInstance().createBus();
>>>        ReflectionServiceFactoryBean bean = new
>> ReflectionServiceFactoryBean();
>>>        bean.setWsdlURL(resource.toString());
>>>        bean.setBus(bus);
>>>        bean.setPopulateFromClass(false);
>>>        bean.setServiceClass(CommonProvider.class);
>>>        bean.create();
>>> 
>>> 
>>>        @WebServiceProvider()
>>>        @ServiceMode(value=Service.Mode.PAYLOAD)
>>>        public class CommonProvider implements Provider<Source> {...}
>>> 
>>> 
>>> *Error:org.apache.cxf.service.factory.ServiceConstructionException:
>> Could not
>>> find definition for service {
>> http://provider.example/}CommonProviderService
>>> <http://provider.example/}CommonProviderService>.*
>>> 
>>> It's pretty much the code from ProviderServiceFactoryTest
>>> 
>>> What am I missing here?
>>> 
>>> regards,
>>> sathwik
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Need a generic service impl for any given WSDL Definition

Posted by Sathwik B P <sa...@gmail.com>.
Hi Andrie,

*Background:*

I am coming from Apache ODE background.

ODE currently has Axis2 as the frontend integration layer. We are looking
for an additional integration layer using CXF.

ODE is a BPEL engine where business processes are deployed and executed. A
business process is exposed as a Web Service to the external world from the
integration layer (Axis2 now).

We need most of the  WS-* standards supported by the exposed web service
framework.


*What I am looking for*

I am looking for an equivalent implementation for the feature what Axis2
provides. Have a look at the file below.

https://github.com/apache/ode/blob/master/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java#L131

In line 131, a object of ODEMessageReceiver is created which is an
extension of Axis2 AbstractMessageReceiver. For each WSDL operation a
message receiver is set, see line 135.

All incoming service operation requests land on this receiver from which
the ODE runtime takes over for processing.

How do I do this in CXF?

regards,
sathwik

On Wed, Apr 15, 2015 at 2:24 PM, Andrei Shakirin <as...@talend.com>
wrote:

> Hi Sathwik,
>
> Regarding your requirement: in this case, do you really need to specify
> the wsdl in your provider service?
> Do you use WS-Polices or schema validation?
> If no, I would suggest just to publish it without wsdl location.
>
> Regards,
> Andrei.
>
> > -----Original Message-----
> > From: Sathwik B P [mailto:sathwik.bp@gmail.com]
> > Sent: Mittwoch, 15. April 2015 05:46
> > To: users@cxf.apache.org
> > Subject: Re: Need a generic service impl for any given WSDL Definition
> >
> > Hi Adrei,
> >
> > Thanks for your response.
> >
> > The requirement is,
> > "There would be one generic service implementation class for ANY given
> WSDL
> > definition". Irrespective of the service names, port names, wsdl
> operations, all
> > requests coming in should land on the same service implementation method.
> >
> > HelloWorld.wsdl -> CommonProviderService
> > Greeter.wsdl      -> CommonProviderService
> > Stock.wsdl        -> CommonProviderService
> >
> > Henceforth I cannot embed the portName or the service names in the
> Provider
> > class.
> >
> > This service is like a passthrough, the payload will be consumed and
> response
> > will be generated by our runtime components in the system.
> >
> >
> > *Update:*
> > *I could get over the previous error by explicitly setting the
> serviceName and
> > endpointName in the bean.*
> >
> > *But now I don't see the service registered under CXFNoSpringSevlet and
> > neither do I get the publised WSDL from the service.*
> >
> > regards,
> > sathwik
> >
> > On Wed, Apr 15, 2015 at 12:48 AM, Andrei Shakirin <as...@talend.com>
> > wrote:
> >
> > > Hi,
> > >
> > > The error message says that service name in your wsdl doesn't match to
> > > default service name generated on the base of CommonProvider class.
> > > You can configure service name using @WebServiceProvider annotation:
> > >
> > > @WebServiceProvider(portName = " CommonProvider", serviceName = "
> > > CommonProviderService ",
> > >                       targetNamespace = " http://provider.example/)
> > > @ServiceMode(value=Service.Mode.PAYLOAD)
> > >  public class CommonProvider implements Provider<Source> {...}
> > >
> > > By the way there is more portable way to create service implementing
> > > Provider interface: using javax.xml.ws.Endpoint.
> > > Take a look this example for details:
> > > https://github.com/apache/cxf/blob/master/distribution/src/main/releas
> > > e/samples/jaxws_dispatch_provider/src/main/java/demo/hwDispatch/server
> > > /Server.java
> > >
> > > Regards,
> > > Andrei.
> > >
> > >
> > > > -----Original Message-----
> > > > From: Sathwik B P [mailto:sathwik.bp@gmail.com]
> > > > Sent: Dienstag, 14. April 2015 11:26
> > > > To: users@cxf.apache.org
> > > > Subject: Need a generic service impl for any given WSDL Definition
> > > >
> > > > Hi Guys,
> > > >
> > > >
> > > > We need to create cxf services from wsdl definitions. There would be
> > > > one generic service implementation class for any given WSDL service.
> > > >
> > > > So I suppose implementation of javax.xml.ws.Provider interface would
> > > > the
> > > right
> > > > choice here.
> > > >
> > > > I have been working with ReflectionServiceFactoryBean and
> > > > JaxWsServiceFactoryBean but not been able to create the service at
> all.
> > > >
> > > > Here is the code snippet,
> > > >
> > > >         URL resource =
> > > > getClass().getResource("/examples/client/HelloWorld.wsdl");
> > > >         Bus bus = BusFactory.newInstance().createBus();
> > > >         ReflectionServiceFactoryBean bean = new
> > > ReflectionServiceFactoryBean();
> > > >         bean.setWsdlURL(resource.toString());
> > > >         bean.setBus(bus);
> > > >         bean.setPopulateFromClass(false);
> > > >         bean.setServiceClass(CommonProvider.class);
> > > >         bean.create();
> > > >
> > > >
> > > >         @WebServiceProvider()
> > > >         @ServiceMode(value=Service.Mode.PAYLOAD)
> > > >         public class CommonProvider implements Provider<Source>
> > > > {...}
> > > >
> > > >
> > > > *Error:org.apache.cxf.service.factory.ServiceConstructionException:
> > > Could not
> > > > find definition for service {
> > > http://provider.example/}CommonProviderService
> > > > <http://provider.example/}CommonProviderService>.*
> > > >
> > > > It's pretty much the code from ProviderServiceFactoryTest
> > > >
> > > > What am I missing here?
> > > >
> > > > regards,
> > > > sathwik
> > >
>

RE: Need a generic service impl for any given WSDL Definition

Posted by Andrei Shakirin <as...@talend.com>.
Hi Sathwik,

Regarding your requirement: in this case, do you really need to specify the wsdl in your provider service?
Do you use WS-Polices or schema validation?
If no, I would suggest just to publish it without wsdl location. 

Regards,
Andrei.

> -----Original Message-----
> From: Sathwik B P [mailto:sathwik.bp@gmail.com]
> Sent: Mittwoch, 15. April 2015 05:46
> To: users@cxf.apache.org
> Subject: Re: Need a generic service impl for any given WSDL Definition
> 
> Hi Adrei,
> 
> Thanks for your response.
> 
> The requirement is,
> "There would be one generic service implementation class for ANY given WSDL
> definition". Irrespective of the service names, port names, wsdl operations, all
> requests coming in should land on the same service implementation method.
> 
> HelloWorld.wsdl -> CommonProviderService
> Greeter.wsdl      -> CommonProviderService
> Stock.wsdl        -> CommonProviderService
> 
> Henceforth I cannot embed the portName or the service names in the Provider
> class.
> 
> This service is like a passthrough, the payload will be consumed and response
> will be generated by our runtime components in the system.
> 
> 
> *Update:*
> *I could get over the previous error by explicitly setting the serviceName and
> endpointName in the bean.*
> 
> *But now I don't see the service registered under CXFNoSpringSevlet and
> neither do I get the publised WSDL from the service.*
> 
> regards,
> sathwik
> 
> On Wed, Apr 15, 2015 at 12:48 AM, Andrei Shakirin <as...@talend.com>
> wrote:
> 
> > Hi,
> >
> > The error message says that service name in your wsdl doesn't match to
> > default service name generated on the base of CommonProvider class.
> > You can configure service name using @WebServiceProvider annotation:
> >
> > @WebServiceProvider(portName = " CommonProvider", serviceName = "
> > CommonProviderService ",
> >                       targetNamespace = " http://provider.example/)
> > @ServiceMode(value=Service.Mode.PAYLOAD)
> >  public class CommonProvider implements Provider<Source> {...}
> >
> > By the way there is more portable way to create service implementing
> > Provider interface: using javax.xml.ws.Endpoint.
> > Take a look this example for details:
> > https://github.com/apache/cxf/blob/master/distribution/src/main/releas
> > e/samples/jaxws_dispatch_provider/src/main/java/demo/hwDispatch/server
> > /Server.java
> >
> > Regards,
> > Andrei.
> >
> >
> > > -----Original Message-----
> > > From: Sathwik B P [mailto:sathwik.bp@gmail.com]
> > > Sent: Dienstag, 14. April 2015 11:26
> > > To: users@cxf.apache.org
> > > Subject: Need a generic service impl for any given WSDL Definition
> > >
> > > Hi Guys,
> > >
> > >
> > > We need to create cxf services from wsdl definitions. There would be
> > > one generic service implementation class for any given WSDL service.
> > >
> > > So I suppose implementation of javax.xml.ws.Provider interface would
> > > the
> > right
> > > choice here.
> > >
> > > I have been working with ReflectionServiceFactoryBean and
> > > JaxWsServiceFactoryBean but not been able to create the service at all.
> > >
> > > Here is the code snippet,
> > >
> > >         URL resource =
> > > getClass().getResource("/examples/client/HelloWorld.wsdl");
> > >         Bus bus = BusFactory.newInstance().createBus();
> > >         ReflectionServiceFactoryBean bean = new
> > ReflectionServiceFactoryBean();
> > >         bean.setWsdlURL(resource.toString());
> > >         bean.setBus(bus);
> > >         bean.setPopulateFromClass(false);
> > >         bean.setServiceClass(CommonProvider.class);
> > >         bean.create();
> > >
> > >
> > >         @WebServiceProvider()
> > >         @ServiceMode(value=Service.Mode.PAYLOAD)
> > >         public class CommonProvider implements Provider<Source>
> > > {...}
> > >
> > >
> > > *Error:org.apache.cxf.service.factory.ServiceConstructionException:
> > Could not
> > > find definition for service {
> > http://provider.example/}CommonProviderService
> > > <http://provider.example/}CommonProviderService>.*
> > >
> > > It's pretty much the code from ProviderServiceFactoryTest
> > >
> > > What am I missing here?
> > >
> > > regards,
> > > sathwik
> >

Re: Need a generic service impl for any given WSDL Definition

Posted by Sathwik B P <sa...@gmail.com>.
Hi Adrei,

Thanks for your response.

The requirement is,
"There would be one generic service implementation class for ANY given WSDL
definition". Irrespective of the service names, port names, wsdl
operations, all requests coming in should land on the same service
implementation method.

HelloWorld.wsdl -> CommonProviderService
Greeter.wsdl      -> CommonProviderService
Stock.wsdl        -> CommonProviderService

Henceforth I cannot embed the portName or the service names in the Provider
class.

This service is like a passthrough, the payload will be consumed and
response will be generated by our runtime components in the system.


*Update:*
*I could get over the previous error by explicitly setting the serviceName
and endpointName in the bean.*

*But now I don't see the service registered under CXFNoSpringSevlet and
neither do I get the publised WSDL from the service.*

regards,
sathwik

On Wed, Apr 15, 2015 at 12:48 AM, Andrei Shakirin <as...@talend.com>
wrote:

> Hi,
>
> The error message says that service name in your wsdl doesn't match to
> default service name generated on the base of CommonProvider class.
> You can configure service name using @WebServiceProvider annotation:
>
> @WebServiceProvider(portName = " CommonProvider", serviceName = "
> CommonProviderService ",
>                       targetNamespace = " http://provider.example/)
> @ServiceMode(value=Service.Mode.PAYLOAD)
>  public class CommonProvider implements Provider<Source> {...}
>
> By the way there is more portable way to create service implementing
> Provider interface: using javax.xml.ws.Endpoint.
> Take a look this example for details:
> https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jaxws_dispatch_provider/src/main/java/demo/hwDispatch/server/Server.java
>
> Regards,
> Andrei.
>
>
> > -----Original Message-----
> > From: Sathwik B P [mailto:sathwik.bp@gmail.com]
> > Sent: Dienstag, 14. April 2015 11:26
> > To: users@cxf.apache.org
> > Subject: Need a generic service impl for any given WSDL Definition
> >
> > Hi Guys,
> >
> >
> > We need to create cxf services from wsdl definitions. There would be one
> > generic service implementation class for any given WSDL service.
> >
> > So I suppose implementation of javax.xml.ws.Provider interface would the
> right
> > choice here.
> >
> > I have been working with ReflectionServiceFactoryBean and
> > JaxWsServiceFactoryBean but not been able to create the service at all.
> >
> > Here is the code snippet,
> >
> >         URL resource =
> > getClass().getResource("/examples/client/HelloWorld.wsdl");
> >         Bus bus = BusFactory.newInstance().createBus();
> >         ReflectionServiceFactoryBean bean = new
> ReflectionServiceFactoryBean();
> >         bean.setWsdlURL(resource.toString());
> >         bean.setBus(bus);
> >         bean.setPopulateFromClass(false);
> >         bean.setServiceClass(CommonProvider.class);
> >         bean.create();
> >
> >
> >         @WebServiceProvider()
> >         @ServiceMode(value=Service.Mode.PAYLOAD)
> >         public class CommonProvider implements Provider<Source> {...}
> >
> >
> > *Error:org.apache.cxf.service.factory.ServiceConstructionException:
> Could not
> > find definition for service {
> http://provider.example/}CommonProviderService
> > <http://provider.example/}CommonProviderService>.*
> >
> > It's pretty much the code from ProviderServiceFactoryTest
> >
> > What am I missing here?
> >
> > regards,
> > sathwik
>

RE: Need a generic service impl for any given WSDL Definition

Posted by Andrei Shakirin <as...@talend.com>.
Hi,

The error message says that service name in your wsdl doesn't match to default service name generated on the base of CommonProvider class.
You can configure service name using @WebServiceProvider annotation:

@WebServiceProvider(portName = " CommonProvider", serviceName = " CommonProviderService ",
                      targetNamespace = " http://provider.example/)
@ServiceMode(value=Service.Mode.PAYLOAD)
 public class CommonProvider implements Provider<Source> {...}

By the way there is more portable way to create service implementing Provider interface: using javax.xml.ws.Endpoint.
Take a look this example for details: https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jaxws_dispatch_provider/src/main/java/demo/hwDispatch/server/Server.java 

Regards,
Andrei.


> -----Original Message-----
> From: Sathwik B P [mailto:sathwik.bp@gmail.com]
> Sent: Dienstag, 14. April 2015 11:26
> To: users@cxf.apache.org
> Subject: Need a generic service impl for any given WSDL Definition
> 
> Hi Guys,
> 
> 
> We need to create cxf services from wsdl definitions. There would be one
> generic service implementation class for any given WSDL service.
> 
> So I suppose implementation of javax.xml.ws.Provider interface would the right
> choice here.
> 
> I have been working with ReflectionServiceFactoryBean and
> JaxWsServiceFactoryBean but not been able to create the service at all.
> 
> Here is the code snippet,
> 
>         URL resource =
> getClass().getResource("/examples/client/HelloWorld.wsdl");
>         Bus bus = BusFactory.newInstance().createBus();
>         ReflectionServiceFactoryBean bean = new ReflectionServiceFactoryBean();
>         bean.setWsdlURL(resource.toString());
>         bean.setBus(bus);
>         bean.setPopulateFromClass(false);
>         bean.setServiceClass(CommonProvider.class);
>         bean.create();
> 
> 
>         @WebServiceProvider()
>         @ServiceMode(value=Service.Mode.PAYLOAD)
>         public class CommonProvider implements Provider<Source> {...}
> 
> 
> *Error:org.apache.cxf.service.factory.ServiceConstructionException: Could not
> find definition for service {http://provider.example/}CommonProviderService
> <http://provider.example/}CommonProviderService>.*
> 
> It's pretty much the code from ProviderServiceFactoryTest
> 
> What am I missing here?
> 
> regards,
> sathwik