Skip to Content

i got ClassCastException when i use the Webservice Deployeble Client.

hi, i created a webservice deployeble client. when i use the proxys i got ClassCastException

here it is my code

Context ic = new InitialContext();

out.println("---- 1 ---");

Object lookuped =

ic.lookup(

"wsclients/proxies/sap.com/ClientProxyDefinition/in.mobileone.demo.proxy.WSClientProxy");

out.println("\n---- 2 ---"+lookuped.getClass());

PortableRemoteObject objPortableRemoteObject=new PortableRemoteObject();

out.println("\n-- -3 --


");

Object narrowed =

objPortableRemoteObject.narrow(lookuped, AdminOperWS.class);

out.println("\n-- -4 --" + narrowed);

AdminOperWS service = (AdminOperWS) narrowed;

out.println("---- 5 ---" + service);

AdminOperWSViDocument client = null;

ClsSuper objClsSuper = new ClsSuper();

String strErrorCode = null, strErrorMessage = null;

client =

(AdminOperWSViDocument) service.getLogicalPort(

"Config1Port_Document",

AdminOperWSViDocument.class);

out.println("---- 5 ---" + client);

objClsSuper = client.createUser("2", "lakshman", "lakshman", "ad");

i got the output:

-


1-----

-


2-----class in.mobileone.demo.proxy.AdminOperWSImpl

-


3----


java.lang.ClassCastException

plz send solu...

Thank U

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Mar 11, 2008 at 12:27 PM

    Hi Lakshman,

    can you please elaborate how you are calling this web service( where you get the stub?)

    Why are you using these lines?

    PortableRemoteObject objPortableRemoteObject=new PortableRemoteObject();

    out.println("\n---3--


    ");

    Object narrowed =

    objPortableRemoteObject.narrow(lookuped, AdminOperWS.class);

    out.println("\n---4--" + narrowed);

    These are used mailny for CORBA objects( while calling EJBs).

    Just remove these line and try.

    Please do come back with the output.

    Regards,

    Piyush

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 12, 2008 at 08:53 AM

    Hi,Piyush

    i create the standalone proxy also for the same webservice it is working fine.

    but i am use the deployeble proxy for the same webservice in a servlet i face the problem.First i cannt use the narrow() method. i got the same exception ClassCastException. my friend says use the narrow() method that's way i am used that.

    any way thanks for ur replay

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 03, 2008 at 04:56 AM

    solved

    Add comment
    10|10000 characters needed characters exceeded