You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2004/03/30 13:36:03 UTC
cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava Emitter.java JavaBeanWriter.java JavaBuildFileWriter.java JavaGeneratorFactory.java JavaServiceIfaceWriter.java JavaServiceImplWriter.java JavaServiceWriter.java JavaStubWriter.java JavaTestCaseWriter.java
dims 2004/03/30 03:36:03
Modified: java/src/org/apache/axis/wsdl Java2WSDL.java WSDL2Java.java
java/src/org/apache/axis/wsdl/fromJava Emitter.java
java/src/org/apache/axis/wsdl/gen Parser.java
java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
SymbolTable.java Utils.java
java/src/org/apache/axis/wsdl/toJava Emitter.java
JavaBeanWriter.java JavaBuildFileWriter.java
JavaGeneratorFactory.java
JavaServiceIfaceWriter.java
JavaServiceImplWriter.java JavaServiceWriter.java
JavaStubWriter.java JavaTestCaseWriter.java
Log:
Fix AXIS-1241 - duplicate code in EWS and AXIS
and cleanup of imports.
Revision Changes Path
1.43 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java
Index: Java2WSDL.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- Java2WSDL.java 25 Feb 2004 14:02:50 -0000 1.42
+++ Java2WSDL.java 30 Mar 2004 11:36:01 -0000 1.43
@@ -21,8 +21,8 @@
import org.apache.axis.utils.CLOption;
import org.apache.axis.utils.CLOptionDescriptor;
import org.apache.axis.utils.CLUtil;
-import org.apache.axis.utils.Messages;
import org.apache.axis.utils.ClassUtils;
+import org.apache.axis.utils.Messages;
import org.apache.axis.wsdl.fromJava.Emitter;
import java.util.HashMap;
1.47 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java
Index: WSDL2Java.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- WSDL2Java.java 25 Feb 2004 14:02:50 -0000 1.46
+++ WSDL2Java.java 30 Mar 2004 11:36:01 -0000 1.47
@@ -16,9 +16,9 @@
package org.apache.axis.wsdl;
import org.apache.axis.enum.Scope;
-import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.CLOption;
import org.apache.axis.utils.CLOptionDescriptor;
+import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.wsdl.gen.Parser;
1.115 +4 -5 ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- Emitter.java 27 Feb 2004 17:07:23 -0000 1.114
+++ Emitter.java 30 Mar 2004 11:36:02 -0000 1.115
@@ -19,17 +19,16 @@
import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
-import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
import com.ibm.wsdl.extensions.soap.SOAPHeaderImpl;
+import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.InternalException;
import org.apache.axis.Version;
-import org.apache.axis.wsdl.symbolTable.SymbolTable;
import org.apache.axis.description.FaultDesc;
+import org.apache.axis.description.JavaServiceDesc;
import org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ParameterDesc;
-import org.apache.axis.description.JavaServiceDesc;
import org.apache.axis.description.ServiceDesc;
import org.apache.axis.encoding.DefaultTypeMappingImpl;
import org.apache.axis.encoding.TypeMapping;
@@ -67,8 +66,8 @@
import javax.wsdl.extensions.soap.SOAPBinding;
import javax.wsdl.extensions.soap.SOAPBody;
import javax.wsdl.extensions.soap.SOAPFault;
-import javax.wsdl.extensions.soap.SOAPOperation;
import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
import javax.wsdl.factory.WSDLFactory;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
@@ -79,10 +78,10 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
-import java.util.List;
/**
* This class emits WSDL from Java classes. It is used by the ?WSDL
1.21 +10 -11 ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/gen/Parser.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Parser.java 25 Feb 2004 14:02:50 -0000 1.20
+++ Parser.java 30 Mar 2004 11:36:02 -0000 1.21
@@ -15,17 +15,6 @@
*/
package org.apache.axis.wsdl.gen;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
import org.apache.axis.utils.Messages;
import org.apache.axis.wsdl.symbolTable.BindingEntry;
import org.apache.axis.wsdl.symbolTable.CollectionElement;
@@ -38,6 +27,16 @@
import org.apache.axis.wsdl.symbolTable.TypeEntry;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
/**
* This is a class with no documentation.
1.40 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
Index: SchemaUtils.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- SchemaUtils.java 27 Mar 2004 11:47:55 -0000 1.39
+++ SchemaUtils.java 30 Mar 2004 11:36:02 -0000 1.40
@@ -18,9 +18,9 @@
import org.apache.axis.Constants;
import org.apache.axis.utils.JavaUtils;
import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
import javax.xml.namespace.QName;
import javax.xml.rpc.holders.BooleanHolder;
1.94 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- SymbolTable.java 23 Mar 2004 15:55:31 -0000 1.93
+++ SymbolTable.java 30 Mar 2004 11:36:02 -0000 1.94
@@ -73,8 +73,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Vector;
import java.util.Set;
+import java.util.Vector;
/**
* This class represents a table of all of the top-level symbols from a set of WSDL Definitions and
1.39 +7 -8 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- Utils.java 16 Mar 2004 15:14:29 -0000 1.38
+++ Utils.java 30 Mar 2004 11:36:02 -0000 1.39
@@ -15,20 +15,19 @@
*/
package org.apache.axis.wsdl.symbolTable;
+import org.apache.axis.Constants;
+import org.apache.axis.utils.XMLUtils;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.holders.BooleanHolder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.holders.BooleanHolder;
-
-import org.apache.axis.Constants;
-import org.apache.axis.utils.XMLUtils;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
/**
* This class contains static utility methods for the emitter.
1.66 +14 -15 ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- Emitter.java 25 Feb 2004 14:02:52 -0000 1.65
+++ Emitter.java 30 Mar 2004 11:36:02 -0000 1.66
@@ -15,21 +15,6 @@
*/
package org.apache.axis.wsdl.toJava;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.Vector;
-
-import javax.wsdl.WSDLException;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-
import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.enum.Scope;
@@ -43,6 +28,20 @@
import org.apache.axis.wsdl.symbolTable.SymbolTable;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
+
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Vector;
/**
* This class produces java files for stubs, skeletons, and types from a
1.61 +0 -1 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
Index: JavaBeanWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- JavaBeanWriter.java 27 Mar 2004 11:47:55 -0000 1.60
+++ JavaBeanWriter.java 30 Mar 2004 11:36:02 -0000 1.61
@@ -23,7 +23,6 @@
import org.apache.axis.wsdl.symbolTable.TypeEntry;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
-import org.w3c.dom.Element;
import javax.xml.namespace.QName;
import java.io.IOException;
1.5 +3 -4 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBuildFileWriter.java
Index: JavaBuildFileWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBuildFileWriter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JavaBuildFileWriter.java 27 Feb 2004 15:00:14 -0000 1.4
+++ JavaBuildFileWriter.java 30 Mar 2004 11:36:02 -0000 1.5
@@ -16,13 +16,12 @@
package org.apache.axis.wsdl.toJava;
+import org.apache.axis.wsdl.symbolTable.SymbolTable;
+
+import javax.wsdl.Definition;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;
-
-import javax.wsdl.Definition;
-
-import org.apache.axis.wsdl.symbolTable.SymbolTable;
/**
* <p>This is Wsdl2java's build file Writer. It writes the build.xml file.
1.48 +201 -115 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
Index: JavaGeneratorFactory.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- JavaGeneratorFactory.java 25 Feb 2004 14:02:52 -0000 1.47
+++ JavaGeneratorFactory.java 30 Mar 2004 11:36:02 -0000 1.48
@@ -1,12 +1,12 @@
/*
* Copyright 2001-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,6 +45,7 @@
import javax.wsdl.Message;
import javax.wsdl.Operation;
import javax.wsdl.OperationType;
+import javax.wsdl.Port;
import javax.wsdl.PortType;
import javax.wsdl.Service;
import javax.xml.namespace.QName;
@@ -55,6 +56,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import java.util.Vector;
/**
@@ -89,8 +91,8 @@
/**
* Constructor JavaGeneratorFactory
- *
- * @param emitter
+ *
+ * @param emitter
*/
public JavaGeneratorFactory(Emitter emitter) {
@@ -101,8 +103,8 @@
/**
* Method setEmitter
- *
- * @param emitter
+ *
+ * @param emitter
*/
public void setEmitter(Emitter emitter) {
this.emitter = emitter;
@@ -171,17 +173,17 @@
JavaUndeployWriter.class); // for undeploy.wsdd
addGenerator(Definition.class,
JavaBuildFileWriter.class); //add a build file writer
-
+
} // addDefinitionGenerators
-
+
/**
* Do the Wsdl2java generator pass:
* - resolve name clashes
* - construct signatures
- *
- * @param def
- * @param symbolTable
+ *
+ * @param def
+ * @param symbolTable
*/
public void generatorPass(Definition def, SymbolTable symbolTable) {
@@ -207,10 +209,10 @@
/**
* Method getGenerator
- *
- * @param message
- * @param symbolTable
- * @return
+ *
+ * @param message
+ * @param symbolTable
+ * @return
*/
public Generator getGenerator(Message message, SymbolTable symbolTable) {
if (include(message.getQName())) {
@@ -220,7 +222,7 @@
}
else {
return new NoopGenerator();
- }
+ }
} // getGenerator
/** Return Wsdl2java's JavaPortTypeWriter object. */
@@ -228,10 +230,10 @@
/**
* Method getGenerator
- *
- * @param portType
- * @param symbolTable
- * @return
+ *
+ * @param portType
+ * @param symbolTable
+ * @return
*/
public Generator getGenerator(PortType portType, SymbolTable symbolTable) {
if (include(portType.getQName())) {
@@ -250,10 +252,10 @@
/**
* Method getGenerator
- *
- * @param binding
- * @param symbolTable
- * @return
+ *
+ * @param binding
+ * @param symbolTable
+ * @return
*/
public Generator getGenerator(Binding binding, SymbolTable symbolTable) {
if (include(binding.getQName())) {
@@ -273,10 +275,10 @@
/**
* Method getGenerator
- *
- * @param service
- * @param symbolTable
- * @return
+ *
+ * @param service
+ * @param symbolTable
+ * @return
*/
public Generator getGenerator(Service service, SymbolTable symbolTable) {
if (include(service.getQName())) {
@@ -296,10 +298,10 @@
/**
* Method getGenerator
- *
- * @param type
- * @param symbolTable
- * @return
+ *
+ * @param type
+ * @param symbolTable
+ * @return
*/
public Generator getGenerator(TypeEntry type, SymbolTable symbolTable) {
if (include(type.getQName())) {
@@ -317,10 +319,10 @@
/**
* Method getGenerator
- *
- * @param definition
- * @param symbolTable
- * @return
+ *
+ * @param definition
+ * @param symbolTable
+ * @return
*/
public Generator getGenerator(Definition definition,
SymbolTable symbolTable) {
@@ -337,7 +339,7 @@
/**
* Class Writers
- *
+ *
* @version %I%, %G%
*/
protected class Writers implements Generator {
@@ -361,8 +363,8 @@
/**
* Method addGenerator
- *
- * @param writer
+ *
+ * @param writer
*/
public void addGenerator(Class writer) {
writers.add(writer);
@@ -370,10 +372,10 @@
/**
* Method addStuff
- *
- * @param baseWriter
- * @param entry
- * @param symbolTable
+ *
+ * @param baseWriter
+ * @param entry
+ * @param symbolTable
*/
public void addStuff(Generator baseWriter, SymTabEntry entry,
SymbolTable symbolTable) {
@@ -385,10 +387,10 @@
/**
* Method addStuff
- *
- * @param baseWriter
- * @param def
- * @param symbolTable
+ *
+ * @param baseWriter
+ * @param def
+ * @param symbolTable
*/
public void addStuff(Generator baseWriter, Definition def,
SymbolTable symbolTable) {
@@ -400,8 +402,8 @@
/**
* Method generate
- *
- * @throws IOException
+ *
+ * @throws IOException
*/
public void generate() throws IOException {
@@ -442,9 +444,9 @@
/**
* Method addGenerator
- *
- * @param wsdlClass
- * @param generator
+ *
+ * @param wsdlClass
+ * @param generator
*/
public void addGenerator(Class wsdlClass, Class generator) {
@@ -468,8 +470,8 @@
* Fill in the names of each SymTabEntry with the javaified name.
* Note: This method also ensures that anonymous types are
* given unique java type names.
- *
- * @param symbolTable
+ *
+ * @param symbolTable
*/
protected void javifyNames(SymbolTable symbolTable) {
@@ -489,7 +491,7 @@
// Use the type or the referenced type's QName to generate the java name.
if (entry instanceof TypeEntry) {
- uniqueNum = javifyTypeEntryName(symbolTable, (TypeEntry) entry, anonQNames, uniqueNum);
+ uniqueNum = javifyTypeEntryName(symbolTable, (TypeEntry) entry, anonQNames, uniqueNum);
}
// If it is not a type, then use this entry's QName to
@@ -502,27 +504,27 @@
} // javifyNames
/** Refactored to call recursively for JAX-RPC 1.1 spec 4.2.5. */
- protected int javifyTypeEntryName(SymbolTable symbolTable, TypeEntry entry, HashMap anonQNames, int uniqueNum) {
+ protected int javifyTypeEntryName(SymbolTable symbolTable, TypeEntry entry, HashMap anonQNames, int uniqueNum) {
TypeEntry tEntry = (TypeEntry) entry;
String dims = tEntry.getDimensions();
TypeEntry refType = tEntry.getRefType();
- while (refType != null) {
+ while (refType != null) {
tEntry = refType;
dims += tEntry.getDimensions();
refType = tEntry.getRefType();
}
-
- TypeEntry te = tEntry;
- while (te != null) {
+
+ TypeEntry te = tEntry;
+ while (te != null) {
TypeEntry base = SchemaUtils.getBaseType(te, symbolTable);
- if (base == null)
+ if (base == null)
break;
-
+
uniqueNum = javifyTypeEntryName(symbolTable, base, anonQNames, uniqueNum);
-
+
if (Utils.getEnumerationBaseAndValues(te.getNode(), symbolTable) == null
&&SchemaUtils.getContainedAttributeTypes(te.getNode(), symbolTable) == null) {
- if (base.isSimpleType()) {
+ if (base.isSimpleType()) {
// Case 1:
// <simpleType name="mySimpleStringType">
// <restriction base="xs:string">
@@ -532,7 +534,7 @@
te.setName(base.getName());
te.setRefType(base);
}
-
+
if (base.isBaseType()) {
// Case 2:
// <simpleType name="FooString">
@@ -544,11 +546,11 @@
te.setRefType(base);
}
}
-
- if (!te.isSimpleType())
+
+ if (!te.isSimpleType())
break;
- te = base;
+ te = base;
}
// Need to javify the ref'd TypeEntry if it was not
@@ -557,14 +559,14 @@
// Get the QName of the ref'd TypeEntry, which
// is will be used to javify the name
QName typeQName = tEntry.getQName();
-
- // In case of <xsd:list itemType="...">,
+
+ // In case of <xsd:list itemType="...">,
// set typeQName to the value of the itemType attribute.
QName itemType = SchemaUtils.getListItemType(tEntry.getNode());
if (itemType != null) {
typeQName = itemType;
}
-
+
if ((typeQName.getLocalPart().
indexOf(SymbolTable.ANON_TOKEN) < 0)) {
// Normal Case: The ref'd type is not anonymous
@@ -629,10 +631,10 @@
// Set the entry with the same name as the ref'd entry
// but add the appropriate amount of dimensions
entry.setName(tEntry.getName() + dims);
-
+
return uniqueNum;
}
-
+
/**
* setFaultContext:
* Processes the symbol table and sets the COMPLEX_TYPE_FAULT
@@ -643,7 +645,7 @@
* all MessageEntries for faults are tagged with the
* EXCEPTION_CLASS_NAME variable, which indicates the java exception
* class name.
- *
+ *
* @param symbolTable SymbolTable
*/
private void setFaultContext(SymbolTable symbolTable) {
@@ -682,7 +684,7 @@
* Helper routine for the setFaultContext method above.
* Examines the indicated fault and sets COMPLEX_TYPE_FAULT
* EXCEPTION_DATA_TYPE and EXCEPTION_CLASS_NAME as appropriate.
- *
+ *
* @param fault FaultInfo to analyze
* @param symbolTable SymbolTable
*/
@@ -779,6 +781,11 @@
}
}
+ String excName = getExceptionJavaNameHook(fault.getMessage().getQName()); // for derived class
+ if (excName != null) {
+ exceptionClassName = excName;
+ }
+
// Set the name of the exception and
// whether the exception is a complex type
MessageEntry me =
@@ -800,10 +807,14 @@
}
}
+ protected String getExceptionJavaNameHook(QName qname) {
+ return null;
+ }
+
/**
* Method determineInterfaceNames
- *
- * @param symbolTable
+ *
+ * @param symbolTable
*/
protected void determineInterfaceNames(SymbolTable symbolTable) {
@@ -824,20 +835,64 @@
PortTypeEntry ptEntry = symbolTable.getPortTypeEntry(
bEntry.getBinding().getPortType().getQName());
- seiName = ptEntry.getName();
+ seiName = getServiceEndpointInterfaceJavaNameHook(ptEntry, bEntry);
+ if (seiName == null) {
+ seiName = ptEntry.getName();
+ }
bEntry.setDynamicVar(JavaBindingWriter.INTERFACE_NAME,
seiName);
+ } else if (entry instanceof ServiceEntry) {
+ ServiceEntry sEntry = (ServiceEntry) entry;
+ String siName = getServiceInterfaceJavaNameHook(sEntry); // for derived class
+ if (siName != null) {
+ sEntry.setName(siName);
+ }
+
+ Service service = sEntry.getService();
+ Map portMap = service.getPorts();
+ Iterator portIterator = portMap.values().iterator();
+
+ while (portIterator.hasNext()) {
+ Port p = (Port) portIterator.next();
+
+ Binding binding = p.getBinding();
+ BindingEntry bEntry =
+ symbolTable.getBindingEntry(binding.getQName());
+
+ // If this isn't a SOAP binding, skip it
+ if (bEntry.getBindingType() != BindingEntry.TYPE_SOAP) {
+ continue;
+ }
+
+ String portName = getPortJavaNameHook(p.getName()); // for derived class
+ if (portName != null) {
+ bEntry.setDynamicVar(JavaServiceWriter.PORT_NAME + ":" + p.getName(),
+ portName);
+ }
+ }
}
}
}
} // determineInterfaceNames
+ protected String getServiceEndpointInterfaceJavaNameHook(PortTypeEntry ptEntry, BindingEntry bEntry) {
+ return null;
+ }
+
+ protected String getServiceInterfaceJavaNameHook(ServiceEntry sEntry) {
+ return null;
+ }
+
+ protected String getPortJavaNameHook(String portName) {
+ return null;
+ }
+
/**
* Messages, PortTypes, Bindings, and Services can share the same name. If they do in this
* Definition, force their names to be suffixed with _PortType and _Service, respectively.
- *
- * @param symbolTable
+ *
+ * @param symbolTable
*/
protected void resolveNameClashes(SymbolTable symbolTable) {
@@ -997,10 +1052,10 @@
/**
* Change the indicated type name into a mangled form using the mangle string.
- *
- * @param name
- * @param mangle
- * @return
+ *
+ * @param name
+ * @param mangle
+ * @return
*/
private String mangleName(String name, String mangle) {
@@ -1018,10 +1073,10 @@
/**
* Returns true if same java class, ignore []
- *
- * @param one
- * @param two
- * @return
+ *
+ * @param one
+ * @param two
+ * @return
*/
private boolean sameJavaClass(String one, String two) {
@@ -1068,8 +1123,8 @@
/**
* If a binding's type is not TYPE_SOAP, then we don't use that binding
* or that binding's portType.
- *
- * @param symbolTable
+ *
+ * @param symbolTable
*/
protected void ignoreNonSOAPBindings(SymbolTable symbolTable) {
@@ -1127,8 +1182,8 @@
/**
* Method constructSignatures
- *
- * @param symbolTable
+ *
+ * @param symbolTable
*/
protected void constructSignatures(SymbolTable symbolTable) {
@@ -1152,29 +1207,48 @@
while (operations.hasNext()) {
Operation operation =
(Operation) operations.next();
+ String wsdlOpName = operation.getName();
OperationType type = operation.getStyle();
- String name = operation.getName();
+
+ String javaOpName = getOperationJavaNameHook(bEntry, wsdlOpName); // for derived class
+ if (javaOpName == null) {
+ javaOpName = operation.getName();
+ }
+
Parameters parameters =
bEntry.getParameters(operation);
if (type == OperationType.SOLICIT_RESPONSE) {
parameters.signature =
" // "
- + Messages.getMessage("invalidSolResp00", name);
+ + Messages.getMessage("invalidSolResp00", javaOpName);
System.err.println(
- Messages.getMessage("invalidSolResp00", name));
+ Messages.getMessage("invalidSolResp00", javaOpName));
} else if (type == OperationType.NOTIFICATION) {
parameters.signature =
" // "
- + Messages.getMessage("invalidNotif00", name);
+ + Messages.getMessage("invalidNotif00", javaOpName);
System.err.println(
- Messages.getMessage("invalidNotif00", name));
+ Messages.getMessage("invalidNotif00", javaOpName));
} else { // ONE_WAY or REQUEST_RESPONSE
if (parameters != null) {
+ String returnType = getReturnTypeJavaNameHook(bEntry, wsdlOpName);
+ if (returnType != null) {
+ if (parameters.returnParam != null) { // 'void' return type???
+ parameters.returnParam.getType().setName(returnType);
+ }
+ }
+ for (int j = 0; j < parameters.list.size(); ++j) {
+ Parameter p = (Parameter) parameters.list.get(j);
+ String paramType = getParameterTypeJavaNameHook(bEntry, wsdlOpName, j);
+ if (paramType != null) {
+ p.getType().setName(paramType);
+ }
+ }
parameters.signature =
- constructSignature(parameters, name);
+ constructSignature(parameters, javaOpName);
}
}
}
@@ -1183,12 +1257,24 @@
}
} // constructSignatures
+ protected String getOperationJavaNameHook(BindingEntry bEntry, String wsdlOpName) {
+ return null;
+ }
+
+ protected String getReturnTypeJavaNameHook(BindingEntry bEntry, String wsdlOpName) {
+ return null;
+ }
+
+ protected String getParameterTypeJavaNameHook(BindingEntry bEntry, String wsdlOpName, int pos) {
+ return null;
+ }
+
/**
* Construct the signature, which is used by both the interface and the stub.
- *
- * @param parms
- * @param opName
- * @return
+ *
+ * @param parms
+ * @param opName
+ * @return
*/
private String constructSignature(Parameters parms, String opName) {
@@ -1248,8 +1334,8 @@
/**
* Find all inout/out parameters and add a flag to the Type of that parameter saying a holder
* is needed.
- *
- * @param symbolTable
+ *
+ * @param symbolTable
*/
protected void determineIfHoldersNeeded(SymbolTable symbolTable) {
@@ -1326,8 +1412,8 @@
/**
* Method setBaseTypeMapping
- *
- * @param btm
+ *
+ * @param btm
*/
public void setBaseTypeMapping(BaseTypeMapping btm) {
this.btm = btm;
@@ -1335,8 +1421,8 @@
/**
* Method getBaseTypeMapping
- *
- * @return
+ *
+ * @return
*/
public BaseTypeMapping getBaseTypeMapping() {
@@ -1364,21 +1450,21 @@
return btm;
}
-
+
/**
* Determines whether the QName supplied should be generated by comparing
* the namespace for the QName against the included and excluded names.
<p/>
<ul>
- <li>if both the includes and excludes are both empty,
+ <li>if both the includes and excludes are both empty,
the element is generated</li>
- <li>if the namespace is in the includes,
+ <li>if the namespace is in the includes,
the element is generated</li>
<li>if the namespace is not in the excludes and the includes are empty,
- the element will be generated.
- <li>if the namespace is only in the excludes,
+ the element will be generated.
+ <li>if the namespace is only in the excludes,
the element is not generated</li>
- <li>if the namespace is not in the includes and the includes are not
+ <li>if the namespace is not in the includes and the includes are not
empty, the element is not generated</li>
@param qName
@return
1.19 +6 -1 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceIfaceWriter.java
Index: JavaServiceIfaceWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceIfaceWriter.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- JavaServiceIfaceWriter.java 25 Feb 2004 14:02:52 -0000 1.18
+++ JavaServiceIfaceWriter.java 30 Mar 2004 11:36:02 -0000 1.19
@@ -134,7 +134,12 @@
// TCK depends on the case-sensitivity being preserved,
// and the interop tests have port names that are not
// valid java identifiers. Thus the following code.
- String portName = p.getName();
+
+ // java port <--> wsdl port mapping
+ String portName = (String) bEntry.getDynamicVar(JavaServiceWriter.PORT_NAME + ":" + p.getName());
+ if (portName == null) {
+ portName = p.getName();
+ }
if (!JavaUtils.isJavaId(portName)) {
portName = Utils.xmlNameToJavaClass(portName);
1.37 +6 -1 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java
Index: JavaServiceImplWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- JavaServiceImplWriter.java 25 Feb 2004 14:02:52 -0000 1.36
+++ JavaServiceImplWriter.java 30 Mar 2004 11:36:02 -0000 1.37
@@ -148,7 +148,12 @@
// TCK depends on the case-sensitivity being preserved,
// and the interop tests have port names that are not
// valid java identifiers. Thus the following code.
- String portName = p.getName();
+
+ // java port <--> wsdl port mapping
+ String portName = (String) bEntry.getDynamicVar(JavaServiceWriter.PORT_NAME + ":" + p.getName());
+ if (portName == null) {
+ portName = p.getName();
+ }
if (!JavaUtils.isJavaId(portName)) {
portName = Utils.xmlNameToJavaClass(portName);
1.10 +3 -0 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceWriter.java
Index: JavaServiceWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceWriter.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JavaServiceWriter.java 25 Feb 2004 14:02:52 -0000 1.9
+++ JavaServiceWriter.java 30 Mar 2004 11:36:02 -0000 1.10
@@ -37,6 +37,9 @@
/** Field testCaseWriter */
protected Generator testCaseWriter = null;
+ /** Field PORT_NAME */
+ public static final String PORT_NAME = "port name";
+
/**
* Constructor.
*
1.130 +1 -1 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
Index: JavaStubWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -r1.129 -r1.130
--- JavaStubWriter.java 25 Feb 2004 14:02:52 -0000 1.129
+++ JavaStubWriter.java 30 Mar 2004 11:36:02 -0000 1.130
@@ -23,6 +23,7 @@
import org.apache.axis.utils.Messages;
import org.apache.axis.wsdl.symbolTable.BindingEntry;
import org.apache.axis.wsdl.symbolTable.CollectionTE;
+import org.apache.axis.wsdl.symbolTable.DefinedType;
import org.apache.axis.wsdl.symbolTable.Element;
import org.apache.axis.wsdl.symbolTable.FaultInfo;
import org.apache.axis.wsdl.symbolTable.MimeInfo;
@@ -31,7 +32,6 @@
import org.apache.axis.wsdl.symbolTable.SchemaUtils;
import org.apache.axis.wsdl.symbolTable.SymbolTable;
import org.apache.axis.wsdl.symbolTable.TypeEntry;
-import org.apache.axis.wsdl.symbolTable.DefinedType;
import org.apache.commons.logging.Log;
import javax.wsdl.Binding;
1.59 +12 -13 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java
Index: JavaTestCaseWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- JavaTestCaseWriter.java 25 Feb 2004 14:02:52 -0000 1.58
+++ JavaTestCaseWriter.java 30 Mar 2004 11:36:02 -0000 1.59
@@ -15,19 +15,6 @@
*/
package org.apache.axis.wsdl.toJava;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Fault;
-import javax.wsdl.Operation;
-import javax.wsdl.OperationType;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.xml.rpc.holders.BooleanHolder;
-
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.wsdl.symbolTable.BindingEntry;
@@ -36,6 +23,18 @@
import org.apache.axis.wsdl.symbolTable.ServiceEntry;
import org.apache.axis.wsdl.symbolTable.SymbolTable;
import org.apache.axis.wsdl.symbolTable.TypeEntry;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Fault;
+import javax.wsdl.Operation;
+import javax.wsdl.OperationType;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.xml.rpc.holders.BooleanHolder;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Map;
/**
* This is Wsdl2java's TestCase writer. It writes the <serviceName>TestCase.java file.