butek 02/03/15 09:15:52
Modified: java/src/org/apache/axis/client Call.java
java/src/org/apache/axis/utils resources.properties
java/test/outparams TestOutParams.java
Log:
An addendum to Glen's change which was: if addParameters was called
but setReturnType was not, an exception is thrown. But AXIS was not
doing the converse: if setReturnType was called but addParameter was
not. It's not QUITE that simple because if there are no parameters there's
no need to call addParameter, so a check against the actual parameters
also has to be made.
Revision Changes Path
1.99 +10 -0 xml-axis/java/src/org/apache/axis/client/Call.java
Index: Call.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- Call.java 15 Mar 2002 15:35:07 -0000 1.98
+++ Call.java 15 Mar 2002 17:15:51 -0000 1.99
@@ -1498,6 +1498,16 @@
"Call::invoke(ns, meth, args)") );
}
+ /**
+ * Since JAX-RPC requires us to specify all or nothing, if setReturnType
+ * was called (returnType != null) and we have args but addParameter
+ * wasn't called (paramTypes == null), then toss a fault.
+ */
+ if (returnType != null && args != null && args.length != 0
+ && paramTypes == null) {
+ throw new AxisFault(JavaUtils.getMessage("mustSpecifyParms"));
+ }
+
RPCElement body = new RPCElement(namespace, method, args);
Object ret = invoke( body );
1.73 +4 -1 xml-axis/java/src/org/apache/axis/utils/resources.properties
Index: resources.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- resources.properties 15 Mar 2002 15:35:07 -0000 1.72
+++ resources.properties 15 Mar 2002 17:15:52 -0000 1.73
@@ -767,4 +767,7 @@
typeMap03=the TypeMappingRegistry of the service, which
typeMap04=is the reason why registration is only needed for the first call.
mustSetStyle=must set encoding style before registering serializers
-mustSpecifyReturnType=No returnType was specified to the Call object! You must
call setReturnType() if you have called addParameter().
\ No newline at end of file
+
+# NOTE: in mustSpecifyReturnType and mustSpecifyParms, do not translate
"addParameter()" and "setReturnType()"
+mustSpecifyReturnType=No returnType was specified to the Call object! You must
call setReturnType() if you have called addParameter().
+mustSpecifyParms=No parameters specified to the Call object! You must call
addParameter() for all parameters if you have called setReturnType().
1.11 +4 -0 xml-axis/java/test/outparams/TestOutParams.java
Index: TestOutParams.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/outparams/TestOutParams.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TestOutParams.java 13 Mar 2002 19:50:59 -0000 1.10
+++ TestOutParams.java 15 Mar 2002 17:15:52 -0000 1.11
@@ -74,6 +74,10 @@
SOAPEnvelope envelope = new SOAPEnvelope();
msgContext.setRequestMessage(new Message(envelope));
+ client.addParameter(
+ new QName("", "string"),
+ XMLType.XSD_STRING,
+ javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
client.setReturnType(XMLType.XSD_INT);
// Invoke the Axis server
Object ret = client.invoke(serviceURN, "method",