Hi, I tryed to make a web service using the wsdl2java tool (Axis beta1).
First everything went fine. I was able to compile the code, to deploy the
the service and to invoke the service using my client application. I got no
problems sending Strings, Vectors etc. and recieving Strings or Booleans.
The only problem is recieving a Vector.
The ServiceImplementation methode that should return the vector is:
public Vector getVal(String key) throws java.rmi.RemoteException,
beepingSoap.sessionXmpl.WrongKeyException {
if(logedUsers.containsKey(key)==true)
{
Vector valueList = new
Vector(((User)logedUsers.get(key)).getList());
return valueList;
}
else
{
throw new WrongKeyException("Illegal Session Key");
}
}
The corresponding part of the SoapBindingStub is:
public java.util.Vector getVal(java.lang.String in0) throws
java.rmi.RemoteException, beepingSoap.sessionXmpl.WrongKeyException{
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call call = getCall();
javax.xml.rpc.namespace.QName p0QName = new
javax.xml.rpc.namespace.QName("", "in0");
call.addParameter(p0QName, new
javax.xml.rpc.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
call.setReturnType(new
javax.xml.rpc.namespace.QName("http://xml.apache.org/xml-soap", "Vector"));
call.setUseSOAPAction(true);
call.setSOAPActionURI("");
call.setOperationStyle("rpc");
call.setOperationName(new
javax.xml.rpc.namespace.QName("urn:sessionXmpl", "getVal"));
Object resp = call.invoke(new Object[] {in0});
if (resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)resp;
}
else {
return (java.util.Vector) resp; // This is line 180 !!!
}
}
But when I try to invoke the getVal Methode by:
ServiceAppService service = new ServiceAppServiceLocator();
ServiceApp port = service.getServiceApp();
Vector valueList = new Vector(port.getVal(key));
I get the following error message:
java.lang.ClassCastException: [Ljava.lang.Object;
at
beepingSoap.sessionXmpl.ServiceAppSoapBindingStub.getVal(ServiceAppSo
apBindingStub.java:180)
at beepingSoap.sessionXmpl.ValueGet.communicate(ValueGet.java:43)
at beepingSoap.sessionXmpl.ProcederGUI.getVals(ProcederGUI.java:175)
at
beepingSoap.sessionXmpl.ProcederGUI.actionPerformed(ProcederGUI.java:
143)
at java.awt.Button.processActionEvent(Button.java:329)
at java.awt.Button.processEvent(Button.java:302)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
3)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
So why can't the object returned to the stub be casted to a vector? I even
tryed to cast it to a String, in case the returned object was a fault
message, but I got the same exception.
Can you help me?
Martina