tomj 2002/07/02 09:13:16
Modified: java/src/org/apache/axis/providers/java RPCProvider.java
Log:
Fix a long standing problem with document style services.
When we get a request with no body, look for an operation
with no arguments and use the first one we find as
the operation.
This isn't a very useful case, but the soapbuilders docLit
echoViod operation tests this boundry condition.
This is NOT for Beta 3
Revision Changes Path
1.71 +28 -2
xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
Index: RPCProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- RPCProvider.java 2 Jul 2002 16:07:29 -0000 1.70
+++ RPCProvider.java 2 Jul 2002 16:13:16 -0000 1.71
@@ -57,6 +57,7 @@
import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
+import org.apache.axis.enum.Style;
import org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ServiceDesc;
import org.apache.axis.description.ParameterDesc;
@@ -153,10 +154,35 @@
}
}
+ // special case code for a document style operation with no
+ // arguments (which is a strange thing to have, but whatever)
if (body == null) {
- // throw something
- throw new Exception(JavaUtils.getMessage("noBody00"));
+ // throw an error if this isn't a document style service
+ if (!serviceDesc.getStyle().equals(Style.DOCUMENT)) {
+ throw new Exception(JavaUtils.getMessage("noBody00"));
+ }
+
+ // look for a method in the service that has no arguments,
+ // use the first one we find.
+ ArrayList ops = serviceDesc.getOperations();
+ for (Iterator iterator = ops.iterator(); iterator.hasNext();) {
+ OperationDesc desc = (OperationDesc) iterator.next();
+ if (desc.getNumInParams() == 0) {
+ // found one with no parameters, use it
+ msgContext.setOperation(desc);
+ // create an empty element
+ body = new RPCElement(desc.getName());
+ // stop looking
+ break;
+ }
+ }
+
+ // If we still didn't find anything, report no body error.
+ if (body == null) {
+ throw new Exception(JavaUtils.getMessage("noBody00"));
+ }
}
+
String methodName = body.getMethodName();
Vector args = body.getParams();
int numArgs = args.size();