cancel
Showing results for 
Search instead for 
Did you mean: 

i got ClassCastException when i use the Webservice Deployeble Client.

former_member185875
Contributor
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member185875
Contributor
0 Kudos

solved

former_member185875
Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Lakshman,

Definetely the object which you are trying to use for casting doesn't match with which you got from JNDI reference.

Try to see the code of your both classes. This is the only solution for this problem,

Regards,

Piyush

Former Member
0 Kudos

Hi Lakshman,

In case of Deployable proxy projects, you shold be creating objects of the Service End Point Interfaces (SEI) generated in the Proxy Project, and not the way you are doing it.

You can refere the following link for this.

[Creating a Client Bean|http://help.sap.com/saphelp_nw04/helpdata/en/81/12703e5da3e946e10000000a114084/frameset.htm]

Regards,

Alka.

Former Member
0 Kudos

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