Tom, Thanks for the reply. I did see the static WSDL support. However, it looked like specifying static WSDL defeated any and all WSDL generation. There are certain aspects of the WSDL generation that I do not want to override. Specifically, the "/wsdl:definitions/wsdl:service/wsdl:port/wsdlsoap:address" element should always use the request URL as the basis for specifying the location attribute. If I specify a static WSDL, then this dynamic generation of the "wsdlsoap:address" element is defeated, which is a significant issue for me (I'm delivering pre-packaged web services, but don't control where they are deployed).
Perhaps another mechanism for acheiving my goal is to include some directive that indicates that the wsdlsoap:address element should always be dynamically generated, even if the element is present in statically defined WSDL. Is one approach better than the other? I would never describe myself as a WSDL expert, so I couldn't tell if one approach was signicantly more challenging/risky/useful than the other. I'm having trouble w/ Bugzilla at the moment, but attached please find the necessary diffs to include the functionality described in my original email. Please let me know if you'd like me to also post this to Bugzilla once I'm able... Please Note: The set of patches attached to this message also contains one other minor fix. Namely, when setting up the emitter w/in providers.java.JavaProvider (line ~450 of v1.89), the TypeMapping was always setup for Constants.URI_DEFAULT_SOAP_ENC. However, I think this is in error and that it should be setup for style.getEncoding() since the default encoding for doc/lit services is "". Thanks, --Doug -----Original Message----- From: Tom Jordahl [mailto:tomj@;macromedia.com] Sent: Tuesday, October 22, 2002 6:33 AM To: '[EMAIL PROTECTED]' Subject: RE: Loading external schemas into WSDL... Doug, We already provide a way for services to specify a static WSDL file in place of the generated version, which may meet the needs of people like yourself who would like to customize the WSDL in various ways. That being said, I don't have any real objection to giving users the ability to add include schemas in generated WSDL. Note that I recently added an --extraClasses switch and API to the WSDL generator to generate Schema for extra Java classes, but did NOT add this option to the service WSDD. Perhaps it needs to be added to the WSDD, and that would satisfy 90% of the cases. -- Tom Jordahl Macromedia Server Development -----Original Message----- From: Douglas Bitting [mailto:Douglas.Bitting@;agile.com] Sent: Saturday, October 19, 2002 12:22 PM To: [EMAIL PROTECTED] Subject: Loading external schemas into WSDL... Hi. I have a question about how to go about including externally-generated schemas into the Axis-generated WSDL. Basically, I've put together a thoroughly-documented (via annotations) schema, which I'd like to physically include in the WSDL Axis generates. However, I'm not exactly sure how best to go about this. I've put together some modifications that allow for the following WSDD construct: <service name="..." ...> <parameter name="wsdlInputSchema" value="<some-url-here>"/> ... This causes the referenced schema to be physically included into the generated WSDL. Is there already some support for this type of thing in Axis that I didn't see? Am I going about this in an odd fashion? Should I do it differently? If the above mechanism turns out to be a good way to handle this, I'll be happy to submit the modifications. What do you guys think about this? Cheers, --Doug Doug Bitting Agile Software 1 Almaden Blvd San Jose, CA 95113 (408) 999-7120
Index: wsdl/fromJava/Types.java =================================================================== RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v retrieving revision 1.64 diff -r1.64 Types.java 90a91,92 > import java.io.File; > import java.io.FileNotFoundException; 93a96,97 > import java.net.MalformedURLException; > import java.net.URL; 157a162,218 > > /** > * Loads the types from the input schema file. > * @param inputSchema file or URL > */ > public void loadInputSchema(String inputSchema) > throws IOException, WSDLException > { > // Read the input wsdl file into a Document > Document doc = XMLUtils.newDocument(inputSchema); > > // Ensure that the root element is xsd:schema > Element root = doc.getDocumentElement(); > if (root.getLocalName().equals("schema") && > Constants.isSchemaXSD(root.getNamespaceURI())) { > Node schema = docHolder.importNode(root, true); > if (null == wsdlTypesElem) { > writeWsdlTypesElement(); > } > wsdlTypesElem.appendChild(schema); > > // Create a symbol table and populate it with the input types > BaseTypeMapping btm = > new BaseTypeMapping() { > public String getBaseName(QName qNameIn) { > QName qName = new QName( > qNameIn.getNamespaceURI(), > > qNameIn.getLocalPart()); > Class cls = defaultTM.getClassForQName(qName); > if (cls == null) > return null; > else > return JavaUtils.getTextClassName(cls.getName()); > } > }; > SymbolTable symbolTable = new SymbolTable(btm, > true, false, false); > symbolTable.populateTypes(new URL(inputSchema), doc); > > // Walk the type/element entries in the symbol table and > // add each one to the list of processed types. This prevents > // the types from being duplicated. > Vector v = symbolTable.getTypes(); > for (int i=0; i < v.size(); i++) { > TypeEntry te = (TypeEntry) v.elementAt(i); > if (te instanceof org.apache.axis.wsdl.symbolTable.Element) { > addToElementsList(te.getQName()); > } else if (te instanceof Type) { > addToTypesList(te.getQName()); > } > } > } else { > // If not, we'll just bail out... perhaps we should log a warning > // or throw an exception? > ; > } > } 227,228d287 < < 230d288 < Index: wsdl/fromJava/Emitter.java =================================================================== RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v retrieving revision 1.74 diff -r1.74 Emitter.java 146a147 > private String inputSchema; 614a616,618 > if (inputSchema != null) { > types.loadInputSchema(inputSchema); > } 1065c1069 < --- > 1600a1605,1619 > } > > /** > * @return the name of the input schema, or null > */ > public String getInputSchema() { > return inputSchema; > } > > /** > * Set the name of the input schema > * @param inputSchema the name of the input schema > */ > public void setInputSchema(String inputSchema) { > this.inputSchema = inputSchema; Index: wsdl/symbolTable/SymbolTable.java =================================================================== RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v retrieving revision 1.49 diff -r1.49 SymbolTable.java 642c642 < private void populateTypes(URL context, Document doc) --- > public void populateTypes(URL context, Document doc) Index: providers/java/JavaProvider.java =================================================================== RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v retrieving revision 1.89 diff -r1.89 JavaProvider.java 117a118 > public static final String OPTION_WSDL_INPUTSCHEMA="wsdlInputSchema"; 450c451 < getTypeMapping(Constants.URI_DEFAULT_SOAP_ENC)); --- > getTypeMapping(style.getEncoding())); 465a467,472 > } > > String wsdlInputSchema = (String) > service.getOption(OPTION_WSDL_INPUTSCHEMA); > if (null != wsdlInputSchema && wsdlInputSchema.length() > 0) { > emitter.setInputSchema(wsdlInputSchema);