You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/02/22 19:13:03 UTC
svn commit: r379831 - in /beehive/trunk/system-controls:
src/webservice/control/org/apache/beehive/controls/system/webservice/generator/
src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/
src/webservice/jaxrpc-clients/axis/org/a...
Author: cschoett
Date: Wed Feb 22 10:13:00 2006
New Revision: 379831
URL: http://svn.apache.org/viewcvs?rev=379831&view=rev
Log:
- Updated wsc generator to lowercase first letter of generated method names
- fixed array support for .net services
Modified:
beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java
beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java
beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java
beehive/trunk/system-controls/src/webservice/jaxrpc-clients/axis/org/apache/beehive/controls/system/jaxrpc/AxisTypeRegistrar.java
beehive/trunk/system-controls/test/webservice/junit/build.xml
Modified: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java?rev=379831&r1=379830&r2=379831&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java Wed Feb 22 10:13:00 2006
@@ -17,8 +17,8 @@
*/
package org.apache.beehive.controls.system.webservice.generator;
-import java.util.List;
import java.util.LinkedList;
+import java.util.List;
/**
* Method info for the Velocity engine.
@@ -38,21 +38,29 @@
}
/**
- *
* @param methodName
*/
void setMethodName(String methodName) {
+
+ // make sure the method name starts with a lowercase character
+ char[] m = methodName.toCharArray();
+ if (Character.isUpperCase(m[0])) {
+ m[0] = Character.toLowerCase(m[0]);
+ methodName = new String(m);
+ }
+
if (!GeneratorUtils.isValidJavaIdentifier(methodName)) {
_methodName = GeneratorUtils.transformInvalidJavaIdentifier(methodName);
System.out.println("Warning: method name " + methodName
+ " is not a valid Java method name, changing to: " + _methodName);
- } else {
+ }
+ else {
_methodName = methodName;
}
+
}
/**
- *
* @param operationName
*/
void setOperationName(String operationName) {
@@ -61,7 +69,8 @@
/**
* Add a parameter to the method's parameter list (parameter mode is IN).
- * @param name The parameter name.
+ *
+ * @param name The parameter name.
* @param typeName The parameter class.
*/
void addParameter(String name, String typeName) {
@@ -70,7 +79,8 @@
/**
* Add a parameter to the method's parameter list (parameter mode is OUT / INOUT).
- * @param name The parameter name.
+ *
+ * @param name The parameter name.
* @param typeName The parameter class.
*/
void addOutParameter(String name, String typeName) {
@@ -79,6 +89,7 @@
/**
* Get the name of this method.
+ *
* @return String
*/
public String getMethodName() {
@@ -88,12 +99,13 @@
void setReturnTypeName(String returnType) {
_returnTypeName = returnType;
if (_returnTypeName.startsWith("java.lang.")) {
- _returnTypeName = _returnTypeName.substring(_returnTypeName.lastIndexOf('.')+1);
+ _returnTypeName = _returnTypeName.substring(_returnTypeName.lastIndexOf('.') + 1);
}
}
/**
* Get the operation name this method corresponds to in the WSDL.
+ *
* @return String
*/
public String getOperationName() {
@@ -102,6 +114,7 @@
/**
* Get the return class name of this method.
+ *
* @return String
*/
public String getReturnTypeName() {
@@ -110,6 +123,7 @@
/**
* Get the parameter list for this method.
+ *
* @return A List of ParameterInfo, if method has no params returns empty list.
*/
public List<ParameterInfo> getParams() {
Modified: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java?rev=379831&r1=379830&r2=379831&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java Wed Feb 22 10:13:00 2006
@@ -81,13 +81,11 @@
}
}
+ // check to see if the xml type of this element is an array type
Element t = wsdlTypes.findSchemaType(_xmlType);
- if (t != null && "complexType".equals(t.getLocalName())) {
- QName aType = getArrayItemType(t, wsdlTypes);
- if (aType != null) {
- _isArray = true;
- _xmlType = aType;
- }
+ if (t != null && WsdlUtils.COMPLEX_TYPE_NAME.equals(t.getLocalName())) {
+ _itemXmlType = getArrayItemType(t, wsdlTypes);
+ _isArray = _itemXmlType != null;
}
}
Modified: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java?rev=379831&r1=379830&r2=379831&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java Wed Feb 22 10:13:00 2006
@@ -47,7 +47,7 @@
*
* @param op Operation this arg list is for.
* @param binding Binding for the operation.
- * @param wsdlTypes
+ * @param wsdlTypes Wsdl types.
*/
WsdlOpParameterList(Operation op, Binding binding, WsdlTypes wsdlTypes) {
@@ -119,10 +119,7 @@
if (WsdlUtils.isWrappedParameterStyle(_operation.getName(), !requesPart, part.getName())) {
_parameterStyle = WsdlOperation.SOAPParameterStyle.WRAPPED;
}
- WsdlOpParameter param = resolvePartElement(part);
- if (param != null) {
- params.add(param);
- }
+ params.addAll(resolvePartElement(part));
}
else {
params.add(new WsdlOpParameter(part.getName(), part.getTypeName(),
@@ -230,28 +227,31 @@
* value to a concrete XML type.
*
* @param p A message part.
- * @return The wsdl parameter, value may be null if no parameter defined for this part.
+ * @return A list of parameters resulting from the schema type -- typically the list will only
+ * contains a single parameter.
*/
- private WsdlOpParameter resolvePartElement(Part p) {
+ private List<WsdlOpParameter> resolvePartElement(Part p) {
+ ArrayList<WsdlOpParameter> resolvedParams = new ArrayList<WsdlOpParameter>();
Element schemaElement = _wsdlTypes.findSchemaElement(p.getElementName());
if (schemaElement.hasAttribute(WsdlUtils.ELEMENT_TYPE_ATTR)) {
// this is a simple type
- return new WsdlOpParameter(p.getName(), schemaElement, _wsdlTypes);
+ resolvedParams.add(new WsdlOpParameter(p.getName(), schemaElement, _wsdlTypes));
}
else {
// this is a complex type
Element complex = DomUtils.getChildElementByName(schemaElement, WsdlUtils.COMPLEX_TYPE_NAME);
Element sequence = DomUtils.getChildElementByName(complex, WsdlUtils.SEQUENCE_TAG_NAME);
- // may occaisionally find a <complex/> tag - map to empty
+ // may occaisionally find a <complex/> tag map to empty but this may be a bug in WSM
if (sequence == null) {
- return null;
+ return resolvedParams;
}
- Element e = DomUtils.getChildElementByName(sequence, WsdlUtils.ELEMENT_NAME);
- if (e != null) {
+ List<Element> seqElements = DomUtils.getChildElementsByName(sequence, WsdlUtils.ELEMENT_NAME);
+
+ for (Element e : seqElements) {
WsdlOpParameter op = new WsdlOpParameter(e, _wsdlTypes);
// special case for bare arrays, change the name of the param
@@ -259,9 +259,9 @@
if (op.isArray() && _parameterStyle == WsdlOperation.SOAPParameterStyle.BARE) {
op.setName(schemaElement.getAttribute(WsdlUtils.NAME_ATTR), _wsdlTypes);
}
- return op;
+ resolvedParams.add(op);
}
}
- return null;
+ return resolvedParams;
}
}
Modified: beehive/trunk/system-controls/src/webservice/jaxrpc-clients/axis/org/apache/beehive/controls/system/jaxrpc/AxisTypeRegistrar.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/jaxrpc-clients/axis/org/apache/beehive/controls/system/jaxrpc/AxisTypeRegistrar.java?rev=379831&r1=379830&r2=379831&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/jaxrpc-clients/axis/org/apache/beehive/controls/system/jaxrpc/AxisTypeRegistrar.java (original)
+++ beehive/trunk/system-controls/src/webservice/jaxrpc-clients/axis/org/apache/beehive/controls/system/jaxrpc/AxisTypeRegistrar.java Wed Feb 22 10:13:00 2006
@@ -149,9 +149,8 @@
}
ComplexType ct = _wsdlComplexTypes.getComplexType(xmlType.getLocalPart());
- if (ct != null) {
+ if (ct != null && ct.getElementNames().size() == 1) {
List<String> names = ct.getElementNames();
- assert names.size() == 1;
QName componentQName = ct.getElementType(names.get(0));
QName componentItemName;
if (WsdlOperation.SOAPBindingStyle.RPC == style) {
Modified: beehive/trunk/system-controls/test/webservice/junit/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/build.xml?rev=379831&r1=379830&r2=379831&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/build.xml (original)
+++ beehive/trunk/system-controls/test/webservice/junit/build.xml Wed Feb 22 10:13:00 2006
@@ -172,7 +172,6 @@
<batchtest filtertrace="off" todir="${log.dir}">
<fileset dir="${junit-source.dir}">
<include name="**/*Test.java"/>
- <exclude name="**/WscGenFromDocLitWrapWsdlTest.java"/>
</fileset>
</batchtest>
</junit>