web Service given by ServiceFactory.createService of wrong class in glassfish

S

ses

OK so I'm trying to write a client for a SOAP web service using the
dynamic proxy method.

My code is pretty much the standard:

String wsdlURL = SERVICE_WSDL;
String namespace = SERVICE_NAMESPACE;
String serviceName = SERVICE_NAME;
QName serviceQN = new QName(namespace, serviceName);
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service requestedService =
(Service) serviceFactory.createService(new URL(wsdlURL), serviceQN);

However I get from glassfish:

ClassCastException com.sun.xml.rpc.client.dii.ConfiguredService cannot
be cast to javax.xml.ws.Service

I really don't get it as the import is javax.xml.ws.Service and I'm
not trying to use DII, everything else seems fine so I can only
conclude glassfish is interpreting ServiceFactory.newInstance()
wrongly, please can anyone help?
 
S

ses

OK so I'm trying to write a client for a SOAP web service using the
dynamic proxy method.

My code is pretty much the standard:

String wsdlURL = SERVICE_WSDL;
String namespace = SERVICE_NAMESPACE;
String serviceName = SERVICE_NAME;
QName serviceQN = new QName(namespace, serviceName);
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service requestedService =
        (Service) serviceFactory.createService(new URL(wsdlURL), serviceQN);

However I get from glassfish:

ClassCastException com.sun.xml.rpc.client.dii.ConfiguredService cannot
be cast to javax.xml.ws.Service

I really don't get it as the import is javax.xml.ws.Service and I'm
not trying to use DII, everything else seems fine so I can only
conclude glassfish is interpreting ServiceFactory.newInstance()
wrongly, please can anyone help?

Actually I was wrong, javax.xml.rpc.ServiceFactory was being used...
this could be the problem
 
S

ses

Actually I was wrong, javax.xml.rpc.ServiceFactory was being used...
this could be the problem

For anyone interested, strangely I found that if I used
ConfiguredService, the whole thing worked as though using a Dynamic
Proxy, perhaps in glassfish ConfiguredService = using web service via
dynamic proxy.

I suppose given the many stages JAX-WS has gone through to become what
it is now, there are inevitably different ways of doing things
particularly with different application servers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top