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:[email protected]]
> Sent: Dienstag, 14. April 2015 11:26
> To: [email protected]
> 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

Reply via email to