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 sc...@apache.org on 2001/11/29 18:00:28 UTC
cvs commit: xml-axis/java/src/org/apache/axis/wsdlgen Emitter.java Types.java
scheu 01/11/29 09:00:28
Modified: java/src/org/apache/axis/wsdlgen Emitter.java Types.java
Log:
Fixed the 'hack' in insertTypesFragment to use Definition.setTypesElement
Corresponding changes to emitter functions to pass around Definition instead of Document.
I am going to make additional changes to the Emitter to support multipe WSDL docs.
Revision Changes Path
1.4 +12 -9 xml-axis/java/src/org/apache/axis/wsdlgen/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdlgen/Emitter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Emitter.java 2001/11/28 12:08:11 1.3
+++ Emitter.java 2001/11/29 17:00:28 1.4
@@ -157,7 +157,8 @@
serviceName = "";
emitter.setServiceName(serviceName);
emitter.setReg(msgContext.getTypeMappingRegistry());
- return emitter.emit();
+ Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(emitter.emit());
+ return doc;
}
/**
@@ -198,21 +199,23 @@
* @throws Exception
*/
public void emit(Class cls, String allowedMethods, String filename) throws Exception {
- Document doc = emit(cls, allowedMethods);
- types.insertTypesFragment(doc);
+ def = emit(cls, allowedMethods);
+ types.insertTypesFragment(def);
+ Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
+
XMLUtils.PrettyDocumentToStream(doc, new FileOutputStream(new File(filename)));
}
/**
- * Generates a WSDL <code>Document</code> for a given <code>Class</code> and
+ * Generates a WSDL <code>Definition</code> for a given <code>Class</code> and
* a space seperated list of methods at design time
*
* @param cls <code>Class</code> object
* @param allowedMethods space seperated methods
- * @return WSDL <code>Document</code>
+ * @return WSDL <code>Definition</code>
* @throws Exception
*/
- public Document emit(Class cls, String allowedMethods) throws Exception {
+ public Definition emit(Class cls, String allowedMethods) throws Exception {
this.cls = cls;
this.allowedMethods = allowedMethods;
@@ -224,13 +227,13 @@
}
/**
- * Generates a WSDL <code>Document</code> for the current configuration parameters
+ * Generates a WSDL <code>Definition</code> for the current configuration parameters
* set for this class instance
*
* @return WSDL <code>Document</code>
* @throws Exception
*/
- public Document emit() throws Exception {
+ public Definition emit() throws Exception {
clsName = cls.getName();
clsName = clsName.substring(clsName.lastIndexOf('.') + 1);
@@ -251,7 +254,7 @@
Binding binding = writeBinding();
writePortType(binding);
writeService(binding);
- return WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
+ return def;
}
private void writeDefinitions() throws Exception {
1.3 +8 -7 xml-axis/java/src/org/apache/axis/wsdlgen/Types.java
Index: Types.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdlgen/Types.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Types.java 2001/11/29 12:56:34 1.2
+++ Types.java 2001/11/29 17:00:28 1.3
@@ -469,12 +469,13 @@
docFragment = docHolder.createDocumentFragment();
}
/**
- * Inserts the type fragment into the given wsdl document
- * @param doc
+ * Inserts the type fragment into the given wsdl definition
+ * @param definition
*/
- public void insertTypesFragment(Document doc) {
- doc.getDocumentElement().insertBefore(
- doc.importNode(docFragment, true),
- doc.getDocumentElement().getFirstChild());
+ public void insertTypesFragment(Definition def) {
+ // doc.getDocumentElement().insertBefore(
+ // doc.importNode(docFragment, true),
+ // doc.getDocumentElement().getFirstChild());
+ def.setTypesElement((Element) docFragment.getFirstChild());
}
-}
\ No newline at end of file
+}