Greetings.
I just started using Axis, and ran into a problem I don't understand.
We have a server with axis, and I have deployed a .jws-file as a
service. I can get a String or String[] back, but when trying to return
Vector or String[][] the program fails.
The service class on the server compiles and executes OK. The SOAP
messages sent from the server looks OK to my untrained eye; I'm not a
SOAP expert, though. The client compiles and executes 5 tests, 2
successful.
The client is compiled with the same classpath that's later used to run
the program.
I'm at a loss to explain this. I've seen on the list that a Vector
should appear as ArrayList (I think), but that indicates the function
_does_ return something, which I fail to achieve with Vector as return
class.
Anyone who can enlighten me on the issue?
///Jens Carlberg, Link�pings universitet.
The service:
============
public class ReturnTests {
public Vector getVectorArray() {
Vector tmp = new Vector();
tmp.add(new String[] {"getVectorArray.A", "getVectorArray.B"});
return tmp;
}
public Vector getVectorString() {
Vector tmp = new Vector();
tmp.add("getVectorString");
return tmp;
}
public String getString() {
return "getString";
}
public String[] getStringArray() {
return new String[] {"getStringArray.A", "getStringArray.B" };
}
public String[][] getStringMArray() {
return new String[][] {{"getStringMArray.A.A", "getStringMArray.A.B"
},{"getStringMArray.B.A", "getStringMArray.B.B" }};
}
}
The Client:
===========
public class TC2 {
public static void main(String args[]) throws Exception {
String[] methods = { "getVectorArray",
"getVectorString",
"getString",
"getStringArray",
"getStringMArray" };
String endpoint = "http://localhost:8081/axis/ReturnTests.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setProperty( Call.NAMESPACE, "http://soapinterop.org" );
for (int i=0; i<methods.length; i++) {
call.setOperationName( methods[i] );
try {
Object ret = call.invoke( new Object[] { } );
System.out.println("Method "+methods[i]+" got :
"+ret.toString());
} catch (Exception e) {
System.out.println("Error for method "+methods[i]);
}
}
}
}
The result from a run:
======================
Error for method getVectorArray
Error for method getVectorString
Method getString got : getString
Method getStringArray got : [getStringArray.A, getStringArray.B]
Error for method getStringMArray
The exception:
==============
The exceptions seems to be the same each time, so I have just included
one stack trace:
java.lang.NullPointerException
java.lang.NullPointerException
at org.xml.sax.helpers.AttributesImpl.getValue(Unknown Source)
at
org.apache.axis.encoding.DeserializationContext.getTypeFromAttributes(DeserializationContext.java,
Compiled Code)
at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java,
Compiled Code)
at
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java,
Compiled Code)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java,
Compiled Code)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java,
Compiled Code)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java, Compiled
Code)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java,
Compiled Code)
at org.apache.axis.client.Call.invoke(Call.java, Compiled Code)
at org.apache.axis.client.Call.invoke(Call.java, Compiled Code)
at org.apache.axis.client.Call.invoke(Call.java, Compiled Code)
at TC2.main(TC2.java, Compiled Code)