You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by xinxinwang <wa...@bah.com> on 2009/08/14 16:34:39 UTC

How to get BindingProvider from a service that implements Provider

I Created my service this way:

Service service = Service.create(new QName(namespace, serviceName));
QName portQName = new QName(namespace, portTypeName);
service.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, endPoint);
dispatchPayload = service.createDispatch(portQName, Source.class,
Service.Mode.PAYLOAD);

I tried to cast the service to a BindingProvider and got an exception:
Exception in thread "main" java.lang.ClassCastException:
javax.xml.ws.Service cannot be cast to javax.xml.ws.BindingProvider
	at
mil.army.soa.adsl.client.DataServiceClient.initHandlers(DataServiceClient.java:77)
	at
mil.army.soa.adsl.client.DataServiceClient.<init>(DataServiceClient.java:66)
	at mil.army.soa.adsl.tester.FuncTester.main(FuncTester.java:10)

Thanks for any help.
-- 
View this message in context: http://www.nabble.com/How-to-get-BindingProvider-from-a-service-that-implements-Provider%3CSource%3E-tp24972739p24972739.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to get BindingProvider from a service that implements Provider

Posted by Daniel Kulp <dk...@apache.org>.
public interface Dispatch<T>
        extends BindingProvider

The Dispatch object obtained from createDistpatch extends the BindingProvider 
interface.  Just cast it.

Dan



On Fri August 14 2009 10:34:39 am xinxinwang wrote:
> I Created my service this way:
>
> Service service = Service.create(new QName(namespace, serviceName));
> QName portQName = new QName(namespace, portTypeName);
> service.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, endPoint);
> dispatchPayload = service.createDispatch(portQName, Source.class,
> Service.Mode.PAYLOAD);
>
> I tried to cast the service to a BindingProvider and got an exception:
> Exception in thread "main" java.lang.ClassCastException:
> javax.xml.ws.Service cannot be cast to javax.xml.ws.BindingProvider
> 	at
> mil.army.soa.adsl.client.DataServiceClient.initHandlers(DataServiceClient.j
>ava:77) at
> mil.army.soa.adsl.client.DataServiceClient.<init>(DataServiceClient.java:66
>) at mil.army.soa.adsl.tester.FuncTester.main(FuncTester.java:10)
>
> Thanks for any help.

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog