gdaniels 02/03/29 07:05:21
Modified: java/samples/echo EchoService.java deploy.wsdd
java/src/org/apache/axis/client AdminClient.java
java/src/org/apache/axis/description ServiceDesc.java
java/src/org/apache/axis/utils Admin.java
Log:
Begin removing vestigial remnants of "deploy.xml" format, in particular
change the namespace of AdminClient non-deployment "commands"
to match WSDD, and process them in processWSDD().
Start framing in support for Skeleton metadata, and switch echo sample
over to WSDD metadata.
Revision Changes Path
1.22 +17 -241 xml-axis/java/samples/echo/EchoService.java
Index: EchoService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/EchoService.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- EchoService.java 27 Mar 2002 16:46:55 -0000 1.21
+++ EchoService.java 29 Mar 2002 15:05:21 -0000 1.22
@@ -55,14 +55,12 @@
package samples.echo ;
+import org.apache.axis.encoding.Hex;
+
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
-import org.apache.axis.encoding.Hex;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.namespace.QName;
-
/**
* Test implementation of the echo interop service. Original description of
* this was found at http://www.xmethods.net/ilab/ . The current definition
@@ -72,237 +70,15 @@
* @author Simon Fell <[EMAIL PROTECTED]>
*/
-public class EchoService implements org.apache.axis.wsdl.Skeleton {
-
- private static org.apache.axis.wsdl.SkeletonImpl skel = null;
-
+public class EchoService {
public EchoService() {
- init() ;
- }
-
- public QName getParameterName(String opName, int i) {
- return skel.getParameterName(opName, i);
- }
-
- public static QName getParameterNameStatic(String opName, int i) {
- init();
- return skel.getParameterName(opName, i);
- }
-
- public ParameterMode getParameterMode(String opName, int i) {
- return skel.getParameterMode(opName, i);
- }
-
- public static ParameterMode getParameterModeStatic(String opName, int i) {
- init();
- return skel.getParameterMode(opName, i);
- }
-
- protected static void init() {
- if (skel != null)
- return;
- skel = new org.apache.axis.wsdl.SkeletonImpl();
- skel.add("echoString",
- new String[] {
- "return",
- "inputString"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoStringArray",
- new String[] {
- "return",
- "inputStringArray"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoInteger",
- new String[] {
- "return",
- "inputInteger"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoIntegerArray",
- new String[] {
- "return",
- "inputIntegerArray"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoFloat",
- new String[] {
- "return",
- "inputFloat"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoFloatArray",
- new String[] {
- "return",
- "inputFloatArray"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoStruct",
- new String[] {
- "return",
- "inputStruct"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoStructArray",
- new String[] {
- "return",
- "inputStructArray"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoVoid",
- new String[] {
- },
- new ParameterMode[] {}, null, null, null);
- skel.add("echoBase64",
- new String[] {
- "return",
- "inputBase64"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoHexBinary",
- new String[] {
- "return",
- "inputHexBinary"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoDate",
- new String[] {
- "return",
- "inputDate"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoDecimal",
- new String[] {
- "return",
- "inputDecimal"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoBoolean",
- new String[] {
- "return",
- "inputBoolean"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoMap",
- new String[] {
- "return",
- "inputMap"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoMapArray",
- new String[] {
- "return",
- "inputMapArray"
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoStructAsSimpleTypes",
- new String[] {
- null,
- "inputStruct",
- "outputString",
- "outputInteger",
- "outputFloat",
- },
- new ParameterMode[] {
- null,
- ParameterMode.IN,
- ParameterMode.OUT,
- ParameterMode.OUT,
- ParameterMode.OUT,
- }, null, null, null);
- skel.add("echoSimpleTypesAsStruct",
- new String[] {
- "return",
- "inputString",
- "inputInteger",
- "inputFloat",
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN,
- ParameterMode.IN,
- ParameterMode.IN,
- }, null, null, null);
- skel.add("echo2DStringArray",
- new String[] {
- "return",
- "input2DStringArray",
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoNestedStruct",
- new String[] {
- "return",
- "inputStruct",
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
- skel.add("echoNestedArray",
- new String[] {
- "return",
- "inputStruct",
- },
- new ParameterMode[] {
- ParameterMode.OUT,
- ParameterMode.IN
- }, null, null, null);
}
-
+
/**
* This method accepts a single string and echoes it back to the client.
*/
public String echoString(String input) {
- return input;
+ return input;
}
/**
@@ -311,7 +87,7 @@
public String[] echoStringArray(String[] input) {
return input;
}
-
+
/**
* This method accepts an single integer and echoes it back to the client.
*/
@@ -320,7 +96,7 @@
}
/**
- * This method accepts an array of integers and echoes it back to the
+ * This method accepts an array of integers and echoes it back to the
* client.
*/
public int[] echoIntegerArray(int[] input) {
@@ -342,16 +118,16 @@
}
/**
- * This method accepts a single structure and echoes it back to the
- * client.
+ * This method accepts a single structure and echoes it back to the
+ * client.
*/
public SOAPStruct echoStruct(SOAPStruct input) {
return input;
}
/**
- * This method accepts an array of structures and echoes it back to the
- * client. The structure used is the same defined in the description of
+ * This method accepts an array of structures and echoes it back to the
+ * client. The structure used is the same defined in the description of
* the "echoStruct" method.
*/
public SOAPStruct[] echoStructArray(SOAPStruct[] input) {
@@ -359,7 +135,7 @@
}
/**
- * This method exists to test the "void" return case. It accepts no
+ * This method exists to test the "void" return case. It accepts no
* arguments, and returns no arguments.
*/
public void echoVoid() {
@@ -399,7 +175,7 @@
public boolean echoBoolean(boolean input) {
return input;
}
-
+
/**
* This method accepts a Map and echoes it back to the client.
*/
@@ -413,10 +189,10 @@
public HashMap [] echoMapArray(HashMap [] input) {
return input;
}
-
- public void echoStructAsSimpleTypes(SOAPStruct inputStruct,
- javax.xml.rpc.holders.StringHolder
outputString,
- javax.xml.rpc.holders.IntHolder
outputInteger,
+
+ public void echoStructAsSimpleTypes(SOAPStruct inputStruct,
+ javax.xml.rpc.holders.StringHolder
outputString,
+ javax.xml.rpc.holders.IntHolder
outputInteger,
javax.xml.rpc.holders.FloatHolder
outputFloat) {
outputString.value = inputStruct.getVarString() ;
outputInteger.value = inputStruct.getVarInt() ;
1.18 +61 -1 xml-axis/java/samples/echo/deploy.wsdd
Index: deploy.wsdd
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/deploy.wsdd,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- deploy.wsdd 27 Mar 2002 17:53:05 -0000 1.17
+++ deploy.wsdd 29 Mar 2002 15:05:21 -0000 1.18
@@ -97,12 +97,72 @@
<handler type="java:samples.echo.echoHeaderStructHandler"/>
</responseFlow>
- <operation name="echoStructAsSimpleTypes">
+ <operation returnQName="return" name="echoString">
+ <parameter name="input"/>
+ </operation>
+ <operation returnQName="return" name="echoStringArray">
+ <parameter name="inputStringArray"/>
+ </operation>
+ <operation returnQName="return" name="echoInteger">
+ <parameter name="inputInteger"/>
+ </operation>
+ <operation returnQName="return" name="echoIntegerArray">
+ <parameter name="inputIntegerArray"/>
+ </operation>
+ <operation returnQName="return" name="echoFloat">
+ <parameter name="inputFloat"/>
+ </operation>
+ <operation returnQName="return" name="echoFloatArray">
+ <parameter name="inputFloatArray"/>
+ </operation>
+ <operation returnQName="return" name="echoStruct">
+ <parameter name="inputStruct"/>
+ </operation>
+ <operation returnQName="return" name="echoStructArray">
+ <parameter name="inputStructArray"/>
+ </operation>
+ <operation returnQName="return" name="echoVoid"/>
+ <operation returnQName="return" name="echoBase64">
+ <parameter name="inputBase64"/>
+ </operation>
+ <operation returnQName="return" name="echoHexBinary">
+ <parameter name="inputHexBinary"/>
+ </operation>
+ <operation returnQName="return" name="echoDate">
+ <parameter name="inputDate"/>
+ </operation>
+ <operation returnQName="return" name="echoDecimal">
+ <parameter name="inputDecimal"/>
+ </operation>
+ <operation returnQName="return" name="echoBoolean">
+ <parameter name="inputBoolean"/>
+ </operation>
+ <operation returnQName="return" name="echoMap">
+ <parameter name="inputMap"/>
+ </operation>
+ <operation returnQName="return" name="echoMapArray">
+ <parameter name="inputMapArray"/>
+ </operation>
+ <operation returnQName="return" name="echoSimpleTypesAsStruct">
+ <parameter name="inputString"/>
+ <parameter name="inputInteger"/>
+ <parameter name="inputFloat"/>
+ </operation>
+ <operation returnQName="return" name="echoStructAsSimpleTypes">
<parameter name="inputStruct" xmlns:ns="http://soapinterop.org/xsd"
type="ns:SOAPStruct"/>
<parameter name="outputString" type="xsd:string" mode="OUT"/>
<parameter name="outputInteger" type="xsd:int" mode="OUT"/>
<parameter name="outputFloat" type="xsd:float" mode="OUT"/>
+ </operation>
+ <operation returnQName="return" name="echo2DStringArray">
+ <parameter name="input2DStringArray"/>
+ </operation>
+ <operation returnQName="return" name="echoNestedStruct">
+ <parameter name="inputNestedStruct"/>
+ </operation>
+ <operation returnQName="return" name="echoNestedArray">
+ <parameter name="inputNestedArray"/>
</operation>
</service>
</deployment>
1.56 +5 -5 xml-axis/java/src/org/apache/axis/client/AdminClient.java
Index: AdminClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AdminClient.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- AdminClient.java 25 Feb 2002 17:38:14 -0000 1.55
+++ AdminClient.java 29 Mar 2002 15:05:21 -0000 1.56
@@ -144,7 +144,7 @@
public String list() throws Exception {
log.debug( JavaUtils.getMessage("doList00") );
- String str = "<m:list xmlns:m=\"AdminService\"/>" ;
+ String str = "<m:list
xmlns:m=\"http://xml.apache.org/axis/wsdd/\"/>" ;
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
return process(input);
}
@@ -156,14 +156,14 @@
public String quit() throws Exception {
log.debug(JavaUtils.getMessage("doQuit00"));
- String str = "<m:quit xmlns:m=\"AdminService\"/>";
+ String str = "<m:quit
xmlns:m=\"http://xml.apache.org/axis/wsdd/\"/>";
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
return process(input);
}
public String undeployHandler(String handlerName) throws Exception {
log.debug(JavaUtils.getMessage("doQuit00"));
- String str = "<m:undeploy xmlns:m=\"AdminService\">" +
+ String str = "<m:undeployment
xmlns:m=\"http://xml.apache.org/axis/wsdd/\">" +
"<handler name=\"" + handlerName + "\"/>"+
"</m:undeploy>" ;
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
@@ -172,7 +172,7 @@
public String undeployService(String serviceName) throws Exception {
log.debug(JavaUtils.getMessage("doQuit00"));
- String str = "<m:undeploy xmlns:m=\"AdminService\">" +
+ String str = "<m:undeployment
xmlns:m=\"http://xml.apache.org/axis/wsdd/\">" +
"<service name=\"" + serviceName + "\"/>"+
"</m:undeploy>" ;
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
@@ -241,7 +241,7 @@
log.error(JavaUtils.getMessage("needPwd00"));
return null;
}
- String str = "<m:passwd xmlns:m=\"AdminService\">";
+ String str = "<m:passwd
xmlns:m=\"http://xml.apache.org/axis/wsdd/\">";
str += args[i + 1];
str += "</m:passwd>";
input = new ByteArrayInputStream(str.getBytes());
1.8 +85 -36 xml-axis/java/src/org/apache/axis/description/ServiceDesc.java
Index: ServiceDesc.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ServiceDesc.java 29 Mar 2002 00:01:26 -0000 1.7
+++ ServiceDesc.java 29 Mar 2002 15:05:21 -0000 1.8
@@ -57,12 +57,14 @@
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.encoding.TypeMappingRegistry;
+import org.apache.axis.wsdl.Skeleton;
import javax.xml.rpc.namespace.QName;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
/**
* A ServiceDesc is an abstract description of a service.
@@ -115,6 +117,14 @@
/** Place to store user-extensible service-related properties */
private HashMap properties = null;
+ /**
+ * Is the implementation a Skeleton? If this is true, it will generate
+ * a Fault to provide OperationDescs via WSDD.
+ */
+ private boolean isSkeletonClass = false;
+ /** Cached copy of the skeleton "getParameterDescStatic" method */
+ private Method skelMethod = null;
+
/** Lookup caches */
private HashMap name2OperationsMap = null;
private HashMap qname2OperationMap = null;
@@ -173,6 +183,9 @@
public void setImplClass(Class implClass) {
this.implClass = implClass;
+ if (Skeleton.class.isAssignableFrom(implClass)) {
+ isSkeletonClass = true;
+ }
}
public TypeMapping getTypeMapping() {
@@ -320,17 +333,24 @@
for (j = 0; j < paramTypes.length; j++) {
Class type = paramTypes[j];
ParameterDesc param = oper.getParameter(j);
- // See if they match
- Class paramClass = tm.getClassForQName(
- param.getTypeQName());
-
- // This is a match if the paramClass is somehow
- // convertable to the "real" parameter type.
- if (JavaUtils.isConvertable(paramClass, type)) {
+ // If no type is specified, just use the Java type
+ QName typeQName = param.getTypeQName();
+ if (typeQName == null) {
+ param.setJavaType(type);
+ param.setTypeQName(tm.getTypeQName(type));
+ } else {
+ // A type was specified - see if they match
+ Class paramClass = tm.getClassForQName(
+ param.getTypeQName());
+
+ // This is a match if the paramClass is somehow
+ // convertable to the "real" parameter type. If not,
+ // break out of this loop.
+ if (!JavaUtils.isConvertable(paramClass, type))
+ break;
+
param.setJavaType(type);
- continue;
}
- break;
}
if (j != paramTypes.length) {
@@ -437,7 +457,9 @@
* Make an OperationDesc from a Java method.
*
* In the absence of deployment metadata, this code will introspect a
- * Method and create an appropriate OperationDesc, using parameter names
+ * Method and create an appropriate OperationDesc. If the class
+ * implements the Skeleton interface, we will use the metadata from there
+ * in constructing the OperationDesc. If not, we use parameter names
* from the bytecode debugging info if available, or "in0", "in1", etc.
* if not.
*/
@@ -447,42 +469,69 @@
return;
}
- // Make an OperationDesc
+ // Make an OperationDesc, fill in common stuff
OperationDesc operation = new OperationDesc();
operation.setName(method.getName());
operation.setMethod(method);
+ operation.setReturnClass(method.getReturnType());
+ operation.setReturnType(tm.getTypeQName(method.getReturnType()));
+
Class [] paramTypes = method.getParameterTypes();
- String [] paramNames =
- JavaUtils.getParameterNamesFromDebugInfo(method);
- for (int k = 0; k < paramTypes.length; k++) {
- Class type = paramTypes[k];
- ParameterDesc paramDesc = new ParameterDesc();
- // If we have a name for this param, use it, otherwise call
- // it "in*"
- if (paramNames != null) {
- paramDesc.setName(paramNames[k+1]);
- } else {
- paramDesc.setName("in" + k);
+ if (isSkeletonClass) {
+ if (skelMethod == null) {
+ // Grab metadata from the Skeleton for parameter info
+ try {
+ skelMethod = implClass.getDeclaredMethod(
+ "getOperationDescByName",
+ new Class [] { int.class });
+ } catch (NoSuchMethodException e) {
+ } catch (SecurityException e) {
+ }
+ if (skelMethod == null) {
+ // FIXME : Throw an error?
+ return;
+ }
}
- paramDesc.setJavaType(type);
+ try {
+ OperationDesc skelDesc =
+ (OperationDesc)skelMethod.invoke(implClass,
+ new Object [] { method.getName() });
+ } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException e) {
+ } catch (InvocationTargetException e) {
+ }
+ //operation.setParameters(skelDesc.getParameters());
+ } else {
+ String [] paramNames =
+ JavaUtils.getParameterNamesFromDebugInfo(method);
+
+ for (int k = 0; k < paramTypes.length; k++) {
+ Class type = paramTypes[k];
+ ParameterDesc paramDesc = new ParameterDesc();
+ // If we have a name for this param, use it, otherwise call
+ // it "in*"
+ if (paramNames != null) {
+ paramDesc.setName(paramNames[k+1]);
+ } else {
+ paramDesc.setName("in" + k);
+ }
+ paramDesc.setJavaType(type);
- // If it's a Holder, mark it INOUT and set the type to the
- // held type. Otherwise it's IN with its own type.
+ // If it's a Holder, mark it INOUT and set the type to the
+ // held type. Otherwise it's IN with its own type.
- Class heldClass = JavaUtils.getHolderValueType(type);
- if (heldClass != null) {
- paramDesc.setMode(ParameterDesc.INOUT);
- paramDesc.setTypeQName(tm.getTypeQName(heldClass));
- } else {
- paramDesc.setMode(ParameterDesc.IN);
- paramDesc.setTypeQName(tm.getTypeQName(type));
+ Class heldClass = JavaUtils.getHolderValueType(type);
+ if (heldClass != null) {
+ paramDesc.setMode(ParameterDesc.INOUT);
+ paramDesc.setTypeQName(tm.getTypeQName(heldClass));
+ } else {
+ paramDesc.setMode(ParameterDesc.IN);
+ paramDesc.setTypeQName(tm.getTypeQName(type));
+ }
+ operation.addParameter(paramDesc);
}
- operation.addParameter(paramDesc);
}
-
- operation.setReturnClass(method.getReturnType());
- operation.setReturnType(tm.getTypeQName(method.getReturnType()));
addOperationDesc(operation);
method2OperationMap.put(method, operation);
1.106 +36 -2 xml-axis/java/src/org/apache/axis/utils/Admin.java
Index: Admin.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- Admin.java 25 Feb 2002 17:38:16 -0000 1.105
+++ Admin.java 29 Mar 2002 15:05:21 -0000 1.106
@@ -179,11 +179,45 @@
return result;
}
- protected static Document processWSDD(AxisEngine engine, Element root)
+ protected static Document processWSDD(MessageContext msgContext,
+ AxisEngine engine,
+ Element root)
throws Exception
{
Document doc = null ;
+ String action = root.getLocalName();
+ if (action.equals("passwd")) {
+ String newPassword = root.getFirstChild().getNodeValue();
+ engine.setAdminPassword(newPassword);
+ doc = XMLUtils.newDocument();
+ doc.appendChild( root = doc.createElementNS("", "Admin" ) );
+ root.appendChild( doc.createTextNode( JavaUtils.getMessage("done00") )
);
+ return doc;
+ }
+
+ if (action.equals("quit")) {
+ log.error(JavaUtils.getMessage("quitRequest00"));
+ if (msgContext != null) {
+ // put a flag into message context so listener will exit after
+ // sending response
+ msgContext.setProperty(msgContext.QUIT_REQUESTED, "true");
+ }
+ doc = XMLUtils.newDocument();
+ doc.appendChild( root = doc.createElementNS("", "Admin" ) );
+ root.appendChild( doc.createTextNode( JavaUtils.getMessage("quit00",
"") ) );
+ return doc;
+ }
+
+ if ( action.equals("list") ) {
+ return listConfig(engine);
+ }
+
+ if (action.equals("clientdeploy")) {
+ // set engine to client engine
+ engine = engine.getClientEngine();
+ }
+
WSDDDocument wsddDoc = new WSDDDocument(root);
EngineConfiguration config = engine.getConfig();
if (config instanceof FileProvider) {
@@ -262,7 +296,7 @@
// If this is WSDD, process it correctly.
if (rootNS != null && rootNS.equals(WSDDConstants.WSDD_NS)) {
- return processWSDD(engine, root);
+ return processWSDD(msgContext, engine, root);
}
// Not WSDD, use old code.