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

Discussion in 'Java' started by ses, Oct 29, 2010.

  1. ses

    ses Guest

    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?
     
    ses, Oct 29, 2010
    #1
    1. Advertising

  2. ses

    ses Guest

    Re: web Service given by ServiceFactory.createService of wrong classin glassfish

    On 29 Oct, 20:43, ses <> wrote:
    > 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
     
    ses, Oct 29, 2010
    #2
    1. Advertising

  3. ses

    ses Guest

    Re: web Service given by ServiceFactory.createService of wrong classin glassfish

    On 29 Oct, 19:51, ses <> wrote:
    > On 29 Oct, 20:43, ses <> wrote:
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > > 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


    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.
     
    ses, Oct 31, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lord0
    Replies:
    1
    Views:
    602
    Thomas Weidenfeller
    Apr 19, 2006
  2. glassfish?

    , May 24, 2006, in forum: Java
    Replies:
    1
    Views:
    500
  3. chiara
    Replies:
    6
    Views:
    502
    Barry Schwarz
    Oct 6, 2005
  4. 2Barter.net
    Replies:
    0
    Views:
    400
    2Barter.net
    Dec 13, 2006
  5. Casey Hawthorne
    Replies:
    385
    Views:
    6,044
    ng2010
    Apr 4, 2010
Loading...

Share This Page