on 11-26-2007 7:09 PM
Hi All,
I've created a Deployable proxy for my webservice and deployed the EAR. I can see JNDI registry in the visual administrator.
I am now writing a simple java client to call the proxy.
1.
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL, "localhost:50104");
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("/wsclients/proxies/sap.com/flight");
FlightListService ser=(FlightListService)obj;
}
Lookup went fine but I am getting classcastexception at the stsetment "FlightListService ser=(FlightListService)obj;"
2.
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL, "localhost:50104");
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("/wsclients/proxies/sap.com/flight/com.sap.flight");
FlightListService ser=(FlightListService)obj;
}
In the above case Lookup itself failed.
Please let me knowthe solution.
Regards,Anilkumar
Hi!
Did you ensure that the EAR which contains your WebService Proxy is running properly. When an EAR gets an Exception normally also gets stopped, throwing a ClassCastException in future calls.
Hope this helps.
Eneko.
Message was edited by:
Eneko Rodriguez
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anilkumar,
the easiest way to help yourself is to debug your application and set a breakpoint before you cast and investicate the obj, which is returned from jndi-lookup.
if you develop on CE or java5 based webas use annotations instead of jndi.
Regards, Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Anikumar,
i think the problem is in direct casting <b>obj</b> to <b>FlightListService</b>.
Please try following code:
...
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("/wsclients/proxies/sap.com/flight");
...
FlightListService ser = (FlightListService)javax.rmi.PortableRemoteObject.narrow(obj, SubjektHome.class );
...
regards,
mz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
AnilKumar,
I have consumed similar Deployable WebService from an EJB and I remeber that I gave the Deployed Webservice EAR (Deployed WebService Proxy EAR) as a Application level reference in the application-j2ee-engine XML of the EAR surrounding the consuming EJB (Application EAR).
How have you defined reference in your case.
Also I had a lookup as below
InitialContext ctx = new InitialContext();
ZPointtoPointServiceService zpserv = (ZPointtoPointServiceService) ctx.lookup("wsclients/proxies/sap.com/DeployableWebServices/com.web.comp.RFCWebService");
ZPointtoPointService zpp =(ZPointtoPointService) zpserv.getLogicalPort();
Regards,
Sudharshan N A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.