Topic
  • 1 reply
  • Latest Post - ‏2009-04-07T11:20:07Z by SystemAdmin
SystemAdmin
SystemAdmin
11979 Posts

Pinned topic ClassCastException while invoking webservice

‏2009-01-05T13:09:34Z |
Hi,
I have created WSDL File (Attachment:DataBase1.wsdl)successfully.I have also create client(Test1.java). while invoking a webservice through client it gives an error "Class Cast Exception".
Test1.java is a class that invoke webservice from client side.
**Test1.java**

package services;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;

import services.Account;
import services.AccountClassStub;
import services.DataBase1_ServiceLocator;
import services.DataBase1_Service;
import services.Response;
import services.DataBase1_PortTypeProxy;

public class Test1 {
public static void main(String[] args){
System.out.println("inside try block***");
try{
DataBase1_ServiceLocator myserviceLocator = new DataBase1_ServiceLocator();
System.out.println("inside try block***");
AccountClassStub stub= new AccountClassStub(new URL("https://localhost:9443/DataBase1/services/AccountClass"),myserviceLocator);
System.out.println("inside try block111***");
Account accnt=new Account();
Response resp= new Response();
String successFlag= null;

String acc="VR000024";
System.out.println("Account Number is***"+acc);
accnt.setAccNo(acc);
resp=stub.validation(accnt);
successFlag=resp.getSuccessFlag();
System.out.println("Success Flag is***"+successFlag);

} catch (RemoteException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
}

}
}

It gives error in Stub class on that line:--

super.engine = ((com.ibm.ws.webservices.engine.client.Service) super.service).getEngine();

and the error is ::

Exception in thread "main" java.lang.ClassCastException: services.DataBase1_ServiceLocator incompatible with com.ibm.ws.webservices.engine.client.Service
at services.AccountClassStub.<init>(AccountClassStub.java:19)
at services.Test1.main(Test1.java:19)
I have used Websphere process server V6.1 And RAD 7.0(Web Application Server V6.1).
Same code work on Eclipse and tomcate server 5.0 successfully.
Updated on 2009-04-07T11:20:07Z at 2009-04-07T11:20:07Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    11979 Posts

    Re: ClassCastException while invoking webservice

    ‏2009-04-07T11:20:07Z  
    Hi Reem@Gupt@,

    Did you get anywhere with this? I am having the same problem and it's driving me nuts :)

    Geoff