gdaniels 02/04/30 18:50:50
Modified: java/src/org/apache/axis/deployment/wsdd WSDDOperation.java
java/src/org/apache/axis/providers/java RPCProvider.java
java/src/org/apache/axis/description OperationDesc.java
Log:
Store operation return information (QName/XMLType/JavaType)
as a ParameterDesc, and use it if available in the return RPCParam.
Revision Changes Path
1.18 +19 -33
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java
Index: WSDDOperation.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- WSDDOperation.java 12 Apr 2002 22:24:47 -0000 1.17
+++ WSDDOperation.java 1 May 2002 01:50:50 -0000 1.18
@@ -54,21 +54,16 @@
*/
package org.apache.axis.deployment.wsdd;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.apache.axis.encoding.SerializationContext;
-import org.apache.axis.utils.XMLUtils;
-import org.apache.axis.utils.JavaUtils;
import org.apache.axis.description.OperationDesc;
-import org.apache.axis.description.ServiceDesc;
import org.apache.axis.description.ParameterDesc;
-import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.description.ServiceDesc;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.utils.XMLUtils;
+import org.w3c.dom.Element;
import org.xml.sax.helpers.AttributesImpl;
import javax.xml.rpc.namespace.QName;
import java.io.IOException;
-import java.util.HashMap;
import java.util.ArrayList;
import java.util.Iterator;
@@ -88,16 +83,17 @@
OperationDesc desc = new OperationDesc();
/**
- * Set operation descriptor
- * @throws WSDDException
+ * Constructor
*/
public WSDDOperation(OperationDesc desc) {
this.desc = desc;
}
/**
+ * Constructor from XML
*
- * @param e (Element) XXX
+ * @param e (Element) the <operation> element
+ * @param parent our ServiceDesc.
* @throws WSDDException XXX
*/
public WSDDOperation(Element e, ServiceDesc parent)
@@ -105,6 +101,7 @@
{
super(e);
+ desc.setParent(parent);
desc.setName(e.getAttribute("name"));
String qNameStr = e.getAttribute("qname");
@@ -115,33 +112,16 @@
if (retQNameStr != null && !retQNameStr.equals(""))
desc.setReturnQName(XMLUtils.getQNameFromString(retQNameStr, e));
+ String retTypeStr = e.getAttribute("returnType");
+ if (retTypeStr != null && !retTypeStr.equals(""))
+ desc.setReturnType(XMLUtils.getQNameFromString(retTypeStr, e));
+
Element [] parameters = getChildElements(e, "parameter");
for (int i = 0; i < parameters.length; i++) {
Element paramEl = parameters[i];
WSDDParameter parameter = new WSDDParameter(paramEl, desc);
desc.addParameter(parameter.getParameter());
}
-
- // FIXME: No longer needed now that we have the qname attribute on the
- // operation itself.
- /*
- if (parent.getStyle() == ServiceDesc.STYLE_DOCUMENT) {
- Element [] mappingElements = getChildElements(e, "elementMapping");
- if (mappingElements.length > 1) {
- // Can only have one for now
- throw new WSDDException(JavaUtils.getMessage("onlyOneMapping"));
- }
-
- if (mappingElements.length > 0) {
- // Register a mapping from an Element QName to a particular
- // method so we can dispatch for doc/lit services.
- Element el = mappingElements[0];
- String elString = el.getAttribute("qname");
- QName elQName = XMLUtils.getQNameFromString(elString, el);
- desc.setElementQName(elQName);
- }
- }
- */
}
/**
@@ -155,6 +135,12 @@
attrs.addAttribute("", "returnQName", "returnQName",
"CDATA",
context.qName2String(desc.getReturnQName()));
+ }
+
+ if (desc.getReturnType() != null) {
+ attrs.addAttribute("", "returnType", "returnType",
+ "CDATA",
+ context.qName2String(desc.getReturnType()));
}
if (desc.getName() != null) {
1.55 +1 -0
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.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- RPCProvider.java 9 Apr 2002 23:42:57 -0000 1.54
+++ RPCProvider.java 1 May 2002 01:50:50 -0000 1.55
@@ -242,6 +242,7 @@
returnQName = new QName("", methodName + "Return");
}
RPCParam param = new RPCParam(returnQName, objRes);
+ param.setParamDesc(operation.getReturnParamDesc());
resBody.addParam(param);
}
1.10 +16 -23 xml-axis/java/src/org/apache/axis/description/OperationDesc.java
Index: OperationDesc.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/description/OperationDesc.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- OperationDesc.java 29 Apr 2002 19:41:17 -0000 1.9
+++ OperationDesc.java 1 May 2002 01:50:50 -0000 1.10
@@ -58,7 +58,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.lang.reflect.Method;
-import java.lang.reflect.Array;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -86,17 +85,6 @@
/** An XML QName which should dispatch to this method */
private QName elementQName;
- /** The return QName (if it should be different from <method>Result) */
- private QName returnQName;
-
- /** The return type */
- private QName returnType;
-
- /** The return class */
- private Class returnClass;
-
- // FIXME : Just have a return ParamDesc???
-
/** The actual Java method associated with this operation, if known */
private Method method;
@@ -112,6 +100,8 @@
/** Faults for this operation */
private ArrayList faults = null;
+ private ParameterDesc returnDesc = new ParameterDesc();
+
/**
* Default constructor.
*/
@@ -123,7 +113,7 @@
*/
public OperationDesc(String name, ParameterDesc [] parameters, QName
returnQName) {
this.name = name;
- this.returnQName = returnQName;
+ returnDesc.setQName(returnQName);
for (int i = 0; i < parameters.length; i++) {
addParameter(parameters[i]);
}
@@ -144,28 +134,28 @@
}
public QName getReturnQName() {
- return returnQName;
+ return returnDesc.getQName();
}
public void setReturnQName(QName returnQName) {
- this.returnQName = returnQName;
+ returnDesc.setQName(returnQName);
}
public QName getReturnType() {
- return returnType;
+ return returnDesc.getTypeQName();
}
public void setReturnType(QName returnType) {
log.debug("@" + Integer.toHexString(hashCode()) + "setReturnType(" +
returnType +")");
- this.returnType = returnType;
+ returnDesc.setTypeQName(returnType);
}
public Class getReturnClass() {
- return returnClass;
+ return returnDesc.getJavaType();
}
public void setReturnClass(Class returnClass) {
- this.returnClass = returnClass;
+ returnDesc.setJavaType(returnClass);
}
public QName getElementQName() {
@@ -304,11 +294,10 @@
}
if ((param == null) || (param.getMode() == ParameterDesc.IN)) {
- if (returnQName == null || qname.equals(returnQName)) {
- param = new ParameterDesc();
+ if (returnDesc.getQName() == null ||
+ qname.equals(returnDesc.getQName())) {
+ param = returnDesc;
param.setQName(qname);
- param.setTypeQName(returnType);
- param.setJavaType(returnClass);
}
}
@@ -339,6 +328,10 @@
public ArrayList getFaults()
{
return faults;
+ }
+
+ public ParameterDesc getReturnParamDesc() {
+ return returnDesc;
}
}