JBossWS SVN: r3478 - branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-06 09:53:56 -0400 (Wed, 06 Jun 2007)
New Revision: 3478
Added:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
Log:
Fix JBWS-1563
Added: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java 2007-06-06 13:53:56 UTC (rev 3478)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.wsdl;
+
+import com.ibm.wsdl.DefinitionImpl;
+import com.ibm.wsdl.extensions.PopulatedExtensionRegistry;
+import com.ibm.wsdl.xml.WSDLWriterImpl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+
+/**
+ * A fork of the original wsdl4j 1.6.2 package
+ * that delegates to the {@link JBossWSDLReaderImpl}.
+ * <p>
+ * Original author: Matthew J. Duftler (duftler(a)us.ibm.com)
+ *
+ * @version $Revision$
+ */
+public class JBossWSDLFactoryImpl extends WSDLFactory
+{
+ /**
+ * Create a new instance of a Definition, with an instance
+ * of a PopulatedExtensionRegistry as its ExtensionRegistry.
+ *
+ * @see com.ibm.wsdl.extensions.PopulatedExtensionRegistry
+ */
+ public Definition newDefinition()
+ {
+ Definition def = new DefinitionImpl();
+ ExtensionRegistry extReg = newPopulatedExtensionRegistry();
+
+ def.setExtensionRegistry(extReg);
+
+ return def;
+ }
+
+ /**
+ * Create a new instance of a WSDLReader.
+ */
+ public WSDLReader newWSDLReader()
+ {
+ return new JBossWSDLReaderImpl();
+ }
+
+ public WSDLWriter newWSDLWriter()
+ {
+ return new WSDLWriterImpl();
+ }
+
+ /**
+ * Create a new instance of an ExtensionRegistry with pre-registered
+ * serializers/deserializers for the SOAP, HTTP and MIME
+ * extensions. Java extensionTypes are also mapped for all
+ * the SOAP, HTTP and MIME extensions.
+ */
+ public ExtensionRegistry newPopulatedExtensionRegistry()
+ {
+ return new PopulatedExtensionRegistry();
+ }
+}
\ No newline at end of file
Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java 2007-06-06 13:53:56 UTC (rev 3478)
@@ -0,0 +1,2372 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.wsdl;
+
+import com.ibm.wsdl.Constants;
+import com.ibm.wsdl.extensions.schema.SchemaConstants;
+import com.ibm.wsdl.util.StringUtils;
+import com.ibm.wsdl.util.xml.DOMUtils;
+import com.ibm.wsdl.util.xml.QNameUtils;
+import com.ibm.wsdl.util.xml.XPathUtils;
+import org.jboss.ws.core.utils.JBossWSEntityResolver;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.xml.sax.InputSource;
+
+import javax.wsdl.*;
+import javax.wsdl.extensions.AttributeExtensible;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionDeserializer;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.schema.SchemaReference;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.*;
+
+
+/**
+ * A WSDLReader fork of the original wsdl4j 1.6.2 package
+ * that delegates to the JBossWSEntityResolver in
+ * <code>private static Document getDocument(InputSource inputSource,String desc)</code>
+ * <p>
+ * Original authors: Matthew J. Duftler,Nirmal Mukhi
+ *
+ * @version $Revision$
+ */
+public class JBossWSDLReaderImpl implements WSDLReader
+{
+ // Used for determining the style of operations.
+ private static final List STYLE_ONE_WAY =
+ Arrays.asList(new String[]{Constants.ELEM_INPUT});
+ private static final List STYLE_REQUEST_RESPONSE =
+ Arrays.asList(new String[]{Constants.ELEM_INPUT, Constants.ELEM_OUTPUT});
+ private static final List STYLE_SOLICIT_RESPONSE =
+ Arrays.asList(new String[]{Constants.ELEM_OUTPUT, Constants.ELEM_INPUT});
+ private static final List STYLE_NOTIFICATION =
+ Arrays.asList(new String[]{Constants.ELEM_OUTPUT});
+
+ protected boolean verbose = true;
+ protected boolean importDocuments = true;
+ protected ExtensionRegistry extReg = null;
+ protected String factoryImplName = null;
+ protected WSDLLocator loc = null;
+ protected WSDLFactory factory = null;
+
+ //Contains all schemas used by this wsdl, either in-line or nested
+ //via wsdl imports or schema imports, includes or redefines
+ protected Map allSchemas = new Hashtable();
+
+
+ /**
+ * Sets the specified feature to the specified value.
+ * <p>
+ * The supported features are:
+ * <p>
+ * <table border=1>
+ * <tr>
+ * <th>Name</th>
+ * <th>Description</th>
+ * <th>Default Value</th>
+ * </tr>
+ * <tr>
+ * <td><center>javax.wsdl.verbose</center></td>
+ * <td>If set to true, status messages will be displayed.</td>
+ * <td><center>true</center></td>
+ * </tr>
+ * <tr>
+ * <td><center>javax.wsdl.importDocuments</center></td>
+ * <td>If set to true, imported WSDL documents will be
+ * retrieved and processed.</td>
+ * <td><center>true</center></td>
+ * </tr>
+ * </table>
+ * <p>
+ * All feature names must be fully-qualified, Java package style. All
+ * names starting with javax.wsdl. are reserved for features defined
+ * by the JWSDL specification. It is recommended that implementation-
+ * specific features be fully-qualified to match the package name
+ * of that implementation. For example: com.abc.featureName
+ *
+ * @param name the name of the feature to be set.
+ * @param value the value to set the feature to.
+ * @throws IllegalArgumentException if the feature name is not recognized.
+ * @see #getFeature(String)
+ */
+ public void setFeature(String name, boolean value)
+ throws IllegalArgumentException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("Feature name must not be null.");
+ }
+
+ if (name.equals(Constants.FEATURE_VERBOSE))
+ {
+ verbose = value;
+ }
+ else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS))
+ {
+ importDocuments = value;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Feature name '" + name +
+ "' not recognized.");
+ }
+ }
+
+ /**
+ * Gets the value of the specified feature.
+ *
+ * @param name the name of the feature to get the value of.
+ * @return the value of the feature.
+ * @throws IllegalArgumentException if the feature name is not recognized.
+ * @see #setFeature(String, boolean)
+ */
+ public boolean getFeature(String name) throws IllegalArgumentException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("Feature name must not be null.");
+ }
+
+ if (name.equals(Constants.FEATURE_VERBOSE))
+ {
+ return verbose;
+ }
+ else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS))
+ {
+ return importDocuments;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Feature name '" + name +
+ "' not recognized.");
+ }
+ }
+
+ /**
+ * Set the extension registry to be used when reading
+ * WSDL documents into a WSDL definition. If an
+ * extension registry is set, that is the extension
+ * registry that will be set as the extensionRegistry
+ * property of the definitions resulting from invoking
+ * readWSDL(...). Default is null.
+ *
+ * @param extReg the extension registry to use for new
+ * definitions
+ */
+ public void setExtensionRegistry(ExtensionRegistry extReg)
+ {
+ this.extReg = extReg;
+ }
+
+ /**
+ * Get the extension registry, if one was set. Default is
+ * null.
+ */
+ public ExtensionRegistry getExtensionRegistry()
+ {
+ return extReg;
+ }
+
+ /**
+ * Get the WSDLFactory object cached in the reader, or use lazy
+ * instantiation if it is not cached yet.
+ */
+ protected WSDLFactory getWSDLFactory() throws WSDLException
+ {
+ if (factory == null)
+ {
+ factory = (factoryImplName != null)
+ ? WSDLFactory.newInstance(factoryImplName)
+ : WSDLFactory.newInstance();
+ }
+ return factory;
+ }
+
+ /**
+ * Set a different factory implementation to use for
+ * creating definitions when reading WSDL documents.
+ * As some WSDLReader implementations may only be
+ * capable of creating definitions using the same
+ * factory implementation from which the reader was
+ * obtained, this method is optional. Default is null.
+ *
+ * @param factoryImplName the fully-qualified class name of the
+ * class which provides a concrete implementation of the abstract
+ * class WSDLFactory.
+ * @throws UnsupportedOperationException if this method
+ * is invoked on an implementation which does not
+ * support it.
+ */
+ public void setFactoryImplName(String factoryImplName)
+ throws UnsupportedOperationException
+ {
+ //check to see if we really need to change the factory name and clear the cache
+ if((this.factoryImplName == null && factoryImplName != null) ||
+ (this.factoryImplName != null && !this.factoryImplName.equals(factoryImplName)))
+ {
+ //the factory object is cached in the reader so set it
+ //to null if the factory impl name is reset.
+ this.factory = null;
+
+ this.factoryImplName = factoryImplName;
+ //if(verbose) System.out.println("WSDLFactory Impl Name set to : "+factoryImplName);
+ }
+ }
+
+ /**
+ * Get the factoryImplName, if one was set. Default is null.
+ */
+ public String getFactoryImplName()
+ {
+ return factoryImplName;
+ }
+
+ protected Definition parseDefinitions(String documentBaseURI,
+ Element defEl,
+ Map importedDefs)
+ throws WSDLException
+ {
+ checkElementName(defEl, Constants.Q_ELEM_DEFINITIONS);
+
+ WSDLFactory factory = getWSDLFactory();
+ Definition def = factory.newDefinition();
+
+ if (extReg != null)
+ {
+ def.setExtensionRegistry(extReg);
+ }
+
+ String name = DOMUtils.getAttribute(defEl, Constants.ATTR_NAME);
+ String targetNamespace = DOMUtils.getAttribute(defEl,
+ Constants.ATTR_TARGET_NAMESPACE);
+ NamedNodeMap attrs = defEl.getAttributes();
+
+ if (importedDefs == null)
+ {
+ importedDefs = new Hashtable();
+ }
+
+ if (documentBaseURI != null)
+ {
+ def.setDocumentBaseURI(documentBaseURI);
+ importedDefs.put(documentBaseURI, def);
+ }
+
+ if (name != null)
+ {
+ def.setQName(new QName(targetNamespace, name));
+ }
+
+ if (targetNamespace != null)
+ {
+ def.setTargetNamespace(targetNamespace);
+ }
+
+ int size = attrs.getLength();
+
+ for (int i = 0; i < size; i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ String namespaceURI = attr.getNamespaceURI();
+ String localPart = attr.getLocalName();
+ String value = attr.getValue();
+
+ if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS))
+ {
+ if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS))
+ {
+ def.addNamespace(localPart, value);
+ }
+ else
+ {
+ def.addNamespace(null, value);
+ }
+ }
+ }
+
+ Element tempEl = DOMUtils.getFirstChildElement(defEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_IMPORT, tempEl))
+ {
+ def.addImport(parseImport(tempEl, def, importedDefs));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ def.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_TYPES, tempEl))
+ {
+ def.setTypes(parseTypes(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_MESSAGE, tempEl))
+ {
+ def.addMessage(parseMessage(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_PORT_TYPE, tempEl))
+ {
+ def.addPortType(parsePortType(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_BINDING, tempEl))
+ {
+ def.addBinding(parseBinding(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_SERVICE, tempEl))
+ {
+ def.addService(parseService(tempEl, def));
+ }
+ else
+ {
+ def.addExtensibilityElement(
+ parseExtensibilityElement(Definition.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(defEl, Definition.class, def, def);
+
+ return def;
+ }
+
+ protected Import parseImport(Element importEl,
+ Definition def,
+ Map importedDefs)
+ throws WSDLException
+ {
+ Import importDef = def.createImport();
+
+ try
+ {
+ String namespaceURI = DOMUtils.getAttribute(importEl,
+ Constants.ATTR_NAMESPACE);
+ String locationURI = DOMUtils.getAttribute(importEl,
+ Constants.ATTR_LOCATION);
+ String contextURI = null;
+
+ if (namespaceURI != null)
+ {
+ importDef.setNamespaceURI(namespaceURI);
+ }
+
+ if (locationURI != null)
+ {
+ importDef.setLocationURI(locationURI);
+
+ if (importDocuments)
+ {
+ try
+ {
+ contextURI = def.getDocumentBaseURI();
+ Definition importedDef = null;
+ InputStream inputStream = null;
+ InputSource inputSource = null;
+ URL url = null;
+
+ if (loc != null)
+ {
+ inputSource = loc.getImportInputSource(contextURI, locationURI);
+
+ /*
+ We now have available the latest import URI. This might
+ differ from the locationURI so check the importedDefs for it
+ since it is this that we pass as the documentBaseURI later.
+ */
+ String liu = loc.getLatestImportURI();
+
+ importedDef = (Definition)importedDefs.get(liu);
+
+ inputSource.setSystemId(liu);
+ }
+ else
+ {
+ URL contextURL = (contextURI != null)
+ ? StringUtils.getURL(null, contextURI)
+ : null;
+
+ url = StringUtils.getURL(contextURL, locationURI);
+ importedDef = (Definition)importedDefs.get(url.toString());
+
+ if (importedDef == null)
+ {
+ inputStream = StringUtils.getContentAsInputStream(url);
+
+ if (inputStream != null)
+ {
+ inputSource = new InputSource(inputStream);
+ inputSource.setSystemId(url.toString());
+ }
+ }
+ }
+
+ if (importedDef == null)
+ {
+ if (inputSource == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate imported document " +
+ "at '" + locationURI + "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI +
+ "'."));
+ }
+
+ Document doc = getDocument(inputSource, inputSource.getSystemId());
+
+ if (inputStream != null)
+ {
+ inputStream.close();
+ }
+
+ Element documentElement = doc.getDocumentElement();
+
+ /*
+ Check if it's a wsdl document.
+ If it's not, don't retrieve and process it.
+ This should later be extended to allow other types of
+ documents to be retrieved and processed, such as schema
+ documents (".xsd"), etc...
+ */
+ if (QNameUtils.matches(Constants.Q_ELEM_DEFINITIONS,
+ documentElement))
+ {
+ if (verbose)
+ {
+ System.out.println("Retrieving document at '" + locationURI +
+ "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI + "'."));
+ }
+
+ String urlString =
+ (loc != null)
+ ? loc.getLatestImportURI()
+ : (url != null)
+ ? url.toString()
+ : locationURI;
+
+ importedDef = readWSDL(urlString,
+ documentElement,
+ importedDefs);
+ }
+ else
+ {
+ QName docElementQName = QNameUtils.newQName(documentElement);
+
+ if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName))
+ {
+ if (verbose)
+ {
+ System.out.println("Retrieving schema wsdl:imported from '" + locationURI +
+ "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI + "'."));
+ }
+
+ WSDLFactory factory = getWSDLFactory();
+
+ importedDef = factory.newDefinition();
+
+ if (extReg != null)
+ {
+ importedDef.setExtensionRegistry(extReg);
+ }
+
+ String urlString =
+ (loc != null)
+ ? loc.getLatestImportURI()
+ : (url != null)
+ ? url.toString()
+ : locationURI;
+
+ importedDef.setDocumentBaseURI(urlString);
+
+ Types types = importedDef.createTypes();
+ types.addExtensibilityElement(
+ parseSchema(Types.class, documentElement, importedDef));
+ importedDef.setTypes(types);
+ }
+ }
+ }
+
+ if (importedDef != null)
+ {
+ importDef.setDefinition(importedDef);
+ }
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to resolve imported document at '" +
+ locationURI +
+ (contextURI == null
+ ? "'." : "', relative to '" + contextURI + "'")
+ , e);
+ }
+ } //end importDocs
+ } //end locationURI
+
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(importEl));
+ }
+ else
+ {
+ //If definitions are being parsed recursively for nested imports
+ //the exception location must be built up recursively too so
+ //prepend this element's xpath to exception location.
+ String loc = XPathUtils.getXPathExprFromNode(importEl) + e.getLocation();
+ e.setLocation(loc);
+ }
+
+ throw e;
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = importEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(importEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ importDef.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ importDef.addExtensibilityElement(
+ parseExtensibilityElement(Import.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(importEl, Import.class, importDef, def);
+
+ return importDef;
+
+ }
+
+ protected Types parseTypes(Element typesEl, Definition def)
+ throws WSDLException
+ {
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = typesEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Types types = def.createTypes();
+ Element tempEl = DOMUtils.getFirstChildElement(typesEl);
+ QName tempElType;
+
+ while (tempEl != null)
+ {
+ tempElType = QNameUtils.newQName(tempEl);
+
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ types.setDocumentationElement(tempEl);
+ }
+ else if ((SchemaConstants.XSD_QNAME_LIST).contains(tempElType))
+ {
+ //the element qname indicates it is a schema.
+ types.addExtensibilityElement(
+ parseSchema(Types.class, tempEl, def));
+ }
+ else
+ {
+ types.addExtensibilityElement(
+ parseExtensibilityElement(Types.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(typesEl, Types.class, types, def);
+
+ return types;
+ }
+
+ protected ExtensibilityElement parseSchema( Class parentType,
+ Element el,
+ Definition def)
+ throws WSDLException
+ {
+ QName elementType = null;
+ ExtensionRegistry extReg = null;
+
+ try
+ {
+ extReg = def.getExtensionRegistry();
+
+ if (extReg == null)
+ {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+ "No ExtensionRegistry set for this " +
+ "Definition, so unable to deserialize " +
+ "a '" + elementType + "' element in the " +
+ "context of a '" + parentType.getName() +
+ "'.");
+ }
+
+ return parseSchema(parentType, el, def, extReg);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(el));
+ }
+
+ throw e;
+ }
+ }
+
+
+ protected ExtensibilityElement parseSchema( Class parentType,
+ Element el,
+ Definition def,
+ ExtensionRegistry extReg)
+ throws WSDLException
+ {
+ /*
+ * This method returns ExtensibilityElement rather than Schema because we
+ * do not insist that a suitable XSD schema deserializer is registered.
+ * PopulatedExtensionRegistry registers SchemaDeserializer by default, but
+ * if the user chooses not to register a suitable deserializer then the
+ * UnknownDeserializer will be used, returning an UnknownExtensibilityElement.
+ */
+
+ Schema schema = null;
+ SchemaReference schemaRef = null;
+ try
+ {
+
+ QName elementType = QNameUtils.newQName(el);
+
+ ExtensionDeserializer exDS =
+ extReg.queryDeserializer(parentType, elementType);
+
+ //Now unmarshall the DOM element.
+ ExtensibilityElement ee =
+ exDS.unmarshall(parentType, elementType, el, def, extReg);
+
+ if (ee instanceof Schema)
+ {
+ schema = (Schema) ee;
+ }
+ else
+ {
+ //Unknown extensibility element, so don't do any more schema parsing on it.
+ return ee;
+ }
+
+
+ //Keep track of parsed schemas to avoid duplicating Schema objects
+ //through duplicate or circular references (eg: A imports B imports A).
+ if (schema.getDocumentBaseURI() != null)
+ {
+ this.allSchemas.put(schema.getDocumentBaseURI(), schema);
+ }
+
+ //At this point, any SchemaReference objects held by the schema will not
+ //yet point to their referenced schemas, so we must now retrieve these
+ //schemas and set the schema references.
+
+ //First, combine the schema references for imports, includes and redefines
+ //into a single list
+
+ ArrayList allSchemaRefs = new ArrayList();
+
+ Collection ic = schema.getImports().values();
+ Iterator importsIterator = ic.iterator();
+ while(importsIterator.hasNext())
+ {
+ allSchemaRefs.addAll( (Collection) importsIterator.next() );
+ }
+
+ allSchemaRefs.addAll(schema.getIncludes());
+ allSchemaRefs.addAll(schema.getRedefines());
+
+ //Then, retrieve the schema referred to by each schema reference. If the
+ //schema has been read in previously, use the existing schema object.
+ //Otherwise unmarshall the DOM element into a new schema object.
+
+ ListIterator schemaRefIterator = allSchemaRefs.listIterator();
+
+ while(schemaRefIterator.hasNext())
+ {
+ try
+ {
+ schemaRef = (SchemaReference) schemaRefIterator.next();
+
+ if (schemaRef.getSchemaLocationURI() == null)
+ {
+ //cannot get the referenced schema, so ignore this schema reference
+ continue;
+ }
+
+ if (verbose)
+ {
+ System.out.println("Retrieving schema at '" +
+ schemaRef.getSchemaLocationURI() +
+ (schema.getDocumentBaseURI() == null
+ ? "'."
+ : "', relative to '" +
+ schema.getDocumentBaseURI() + "'."));
+ }
+
+
+ InputStream inputStream = null;
+ InputSource inputSource = null;
+
+ //This is the child schema referred to by the schemaReference
+ Schema referencedSchema = null;
+
+ //This is the child schema's location obtained from the WSDLLocator or the URL
+ String location = null;
+
+ if (loc != null)
+ {
+ //Try to get the referenced schema using the wsdl locator
+ inputSource = loc.getImportInputSource(
+ schema.getDocumentBaseURI(), schemaRef.getSchemaLocationURI());
+
+ if (inputSource == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate with a locator "
+ + "the schema referenced at '"
+ + schemaRef.getSchemaLocationURI()
+ + "' relative to document base '"
+ + schema.getDocumentBaseURI() + "'");
+ }
+ location = loc.getLatestImportURI();
+
+ //if a schema from this location has been read previously, use it.
+ referencedSchema = (Schema) this.allSchemas.get(location);
+ }
+ else
+ {
+ // We don't have a wsdl locator, so try to retrieve the schema by its URL
+ String contextURI = schema.getDocumentBaseURI();
+ URL contextURL = (contextURI != null) ? StringUtils.getURL(null, contextURI) : null;
+ URL url = StringUtils.getURL(contextURL, schemaRef.getSchemaLocationURI());
+ location = url.toExternalForm();
+
+ //if a schema from this location has been retrieved previously, use it.
+ referencedSchema = (Schema) this.allSchemas.get(location);
+
+ if (referencedSchema == null)
+ {
+ // We haven't read this schema in before so do it now
+ inputStream = StringUtils.getContentAsInputStream(url);
+
+ if (inputStream != null)
+ {
+ inputSource = new InputSource(inputStream);
+ }
+
+ if (inputSource == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate with a url "
+ + "the document referenced at '"
+ + schemaRef.getSchemaLocationURI()
+ + "'"
+ + (contextURI == null ? "." : ", relative to '"
+ + contextURI + "'."));
+ }
+ }
+
+ } //end if loc
+
+ // If we have not previously read the schema, get its DOM element now.
+ if (referencedSchema == null)
+ {
+ inputSource.setSystemId(location);
+ Document doc = getDocument(inputSource, location);
+
+ if (inputStream != null)
+ {
+ inputStream.close();
+ }
+
+ Element documentElement = doc.getDocumentElement();
+
+ // If it's a schema doc process it, otherwise the schema reference remains null
+
+ QName docElementQName = QNameUtils.newQName(documentElement);
+
+ if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName))
+ {
+ //We now need to call parseSchema recursively to parse the referenced
+ //schema. The document base URI of the referenced schema will be set to
+ //the document base URI of the current schema plus the schemaLocation in
+ //the schemaRef. We cannot explicitly pass in a new document base URI
+ //to the schema deserializer, so instead we will create a dummy
+ //Definition and set its documentBaseURI to the new document base URI.
+ //We can leave the other definition fields empty because we know
+ //that the SchemaDeserializer.unmarshall method uses the definition
+ //parameter only to get its documentBaseURI. If the unmarshall method
+ //implementation changes (ie: its use of definition changes) we may need
+ //to rethink this approach.
+
+ WSDLFactory factory = getWSDLFactory();
+ Definition dummyDef = factory.newDefinition();
+
+ dummyDef.setDocumentBaseURI(location);
+
+ //By this point, we know we have a SchemaDeserializer registered
+ //so we can safely cast the ExtensibilityElement to a Schema.
+ referencedSchema = (Schema) parseSchema( parentType,
+ documentElement,
+ dummyDef,
+ extReg);
+ }
+
+ } //end if referencedSchema
+
+ schemaRef.setReferencedSchema(referencedSchema);
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "An error occurred trying to resolve schema referenced at '"
+ + schemaRef.getSchemaLocationURI()
+ + "'"
+ + (schema.getDocumentBaseURI() == null ? "." : ", relative to '"
+ + schema.getDocumentBaseURI() + "'."),
+ e);
+ }
+
+ } //end while loop
+
+ return schema;
+
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(el));
+ }
+ else
+ {
+ //If this method has been called recursively for nested schemas
+ //the exception location must be built up recursively too so
+ //prepend this element's xpath to exception location.
+ String loc = XPathUtils.getXPathExprFromNode(el) + e.getLocation();
+ e.setLocation(loc);
+ }
+
+ throw e;
+ }
+
+ }
+
+
+ protected Binding parseBinding(Element bindingEl, Definition def)
+ throws WSDLException
+ {
+ Binding binding = null;
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingEl);
+ String name = DOMUtils.getAttribute(bindingEl, Constants.ATTR_NAME, remainingAttrs);
+ QName portTypeName = getQualifiedAttributeValue(bindingEl,
+ Constants.ATTR_TYPE,
+ Constants.ELEM_BINDING,
+ def,
+ remainingAttrs);
+
+ PortType portType = null;
+
+ if (name != null)
+ {
+ QName bindingName = new QName(def.getTargetNamespace(), name);
+
+ binding = def.getBinding(bindingName);
+
+ if (binding == null)
+ {
+ binding = def.createBinding();
+ binding.setQName(bindingName);
+ }
+ }
+ else
+ {
+ binding = def.createBinding();
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ binding.setUndefined(false);
+
+ if (portTypeName != null)
+ {
+ portType = def.getPortType(portTypeName);
+
+ if (portType == null)
+ {
+ portType = def.createPortType();
+ portType.setQName(portTypeName);
+ def.addPortType(portType);
+ }
+
+ binding.setPortType(portType);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ binding.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl))
+ {
+ binding.addBindingOperation(parseBindingOperation(tempEl,
+ portType,
+ def));
+ }
+ else
+ {
+ binding.addExtensibilityElement(parseExtensibilityElement(
+ Binding.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ return binding;
+ }
+
+ protected BindingOperation parseBindingOperation(
+ Element bindingOperationEl,
+ PortType portType,
+ Definition def)
+ throws WSDLException
+ {
+ BindingOperation bindingOperation = def.createBindingOperation();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingOperationEl);
+ String name = DOMUtils.getAttribute(bindingOperationEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingOperation.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingOperationEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingOperationEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingOperation.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl))
+ {
+ bindingOperation.setBindingInput(parseBindingInput(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl))
+ {
+ bindingOperation.setBindingOutput(parseBindingOutput(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl))
+ {
+ bindingOperation.addBindingFault(parseBindingFault(tempEl, def));
+ }
+ else
+ {
+ bindingOperation.addExtensibilityElement(
+ parseExtensibilityElement(BindingOperation.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ if (portType != null)
+ {
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+ String inputName = (bindingInput != null
+ ? (bindingInput.getName() != null ? bindingInput.getName() : Constants.NONE)
+ : null);
+ String outputName = (bindingOutput != null
+ ? (bindingOutput.getName() != null ? bindingOutput.getName() : Constants.NONE)
+ : null);
+ Operation op = portType.getOperation(name, inputName, outputName);
+
+ /*
+ * If the bindingOp input or output message names are null we will search first
+ * for a porttypeOp with corresponding unnamed input or output messages (using
+ * Constants.NONE for inputName or outputName, as above).
+ * However, input and output message names need not be used at all if operation
+ * overloading is not used, so if no match was found we will try again ignoring
+ * these unnamed messages from the search criteria (i.e. using null instead of
+ * Constants.NONE for inputName or outputName).
+ */
+
+ if(op == null)
+ {
+ if(Constants.NONE.equals(inputName) && Constants.NONE.equals(outputName))
+ {
+ //There was no porttype op with unnamed input and output messages,
+ //so ignore input and output name and search on the op name only.
+ op = portType.getOperation(name, null, null);
+ }
+ else if(Constants.NONE.equals(inputName))
+ {
+ //There was no porttype op with an unnamed input message,
+ //so ignore input name and search on the op name and output name only.
+ op = portType.getOperation(name, null, outputName);
+ }
+ else if(Constants.NONE.equals(outputName))
+ {
+ //There was no porttype op with an unnamed output message,
+ //so ignore output name and search on the op name and input name only.
+ op = portType.getOperation(name, inputName, null);
+ }
+ }
+
+ if (op == null)
+ {
+ Input input = def.createInput();
+ Output output = def.createOutput();
+
+ op = def.createOperation();
+ op.setName(name);
+ input.setName(inputName);
+ output.setName(outputName);
+ op.setInput(input);
+ op.setOutput(output);
+ portType.addOperation(op);
+ }
+
+ bindingOperation.setOperation(op);
+ }
+
+ parseExtensibilityAttributes(bindingOperationEl, BindingOperation.class, bindingOperation, def);
+
+ return bindingOperation;
+ }
+
+ protected BindingInput parseBindingInput(Element bindingInputEl,
+ Definition def)
+ throws WSDLException
+ {
+ BindingInput bindingInput = def.createBindingInput();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingInputEl);
+ String name = DOMUtils.getAttribute(bindingInputEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingInput.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingInputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingInputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingInput.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ bindingInput.addExtensibilityElement(
+ parseExtensibilityElement(BindingInput.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ return bindingInput;
+ }
+
+ protected BindingOutput parseBindingOutput(Element bindingOutputEl,
+ Definition def)
+ throws WSDLException
+ {
+ BindingOutput bindingOutput = def.createBindingOutput();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingOutputEl);
+ String name = DOMUtils.getAttribute(bindingOutputEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingOutput.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingOutputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingOutputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingOutput.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ bindingOutput.addExtensibilityElement(
+ parseExtensibilityElement(BindingOutput.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ return bindingOutput;
+ }
+
+ protected BindingFault parseBindingFault(Element bindingFaultEl,
+ Definition def)
+ throws WSDLException
+ {
+ BindingFault bindingFault = def.createBindingFault();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingFaultEl);
+ String name = DOMUtils.getAttribute(bindingFaultEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingFault.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingFaultEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingFaultEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingFault.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ bindingFault.addExtensibilityElement(
+ parseExtensibilityElement(BindingFault.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(bindingFaultEl, BindingFault.class, bindingFault, def);
+
+ return bindingFault;
+ }
+
+ protected Message parseMessage(Element msgEl, Definition def)
+ throws WSDLException
+ {
+ Message msg = null;
+
+ List remainingAttrs = DOMUtils.getAttributes(msgEl);
+ String name = DOMUtils.getAttribute(msgEl, Constants.ATTR_NAME, remainingAttrs);
+
+ if (name != null)
+ {
+ QName messageName = new QName(def.getTargetNamespace(), name);
+
+ msg = def.getMessage(messageName);
+
+ if (msg == null)
+ {
+ msg = def.createMessage();
+ msg.setQName(messageName);
+ }
+ }
+ else
+ {
+ msg = def.createMessage();
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ msg.setUndefined(false);
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = msgEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(msgEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ msg.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_PART, tempEl))
+ {
+ msg.addPart(parsePart(tempEl, def));
+ }
+ else
+ {
+ msg.addExtensibilityElement(
+ parseExtensibilityElement(Message.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(msgEl, Message.class, msg, def);
+
+ return msg;
+ }
+
+ protected Part parsePart(Element partEl, Definition def)
+ throws WSDLException
+ {
+ Part part = def.createPart();
+ String name = DOMUtils.getAttribute(partEl, Constants.ATTR_NAME);
+ QName elementName = getQualifiedAttributeValue(partEl,
+ Constants.ATTR_ELEMENT,
+ Constants.ELEM_MESSAGE,
+ def);
+ QName typeName = getQualifiedAttributeValue(partEl,
+ Constants.ATTR_TYPE,
+ Constants.ELEM_MESSAGE,
+ def);
+
+ if (name != null)
+ {
+ part.setName(name);
+ }
+
+ if (elementName != null)
+ {
+ part.setElementName(elementName);
+ }
+
+ if (typeName != null)
+ {
+ part.setTypeName(typeName);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = partEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(partEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ part.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ part.addExtensibilityElement(
+ parseExtensibilityElement(Part.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(partEl, Part.class, part, def);
+
+ return part;
+ }
+
+ protected void parseExtensibilityAttributes(Element el,
+ Class parentType,
+ AttributeExtensible attrExt,
+ Definition def)
+ throws WSDLException
+ {
+ List nativeAttributeNames = attrExt.getNativeAttributeNames();
+ NamedNodeMap nodeMap = el.getAttributes();
+ int length = nodeMap.getLength();
+
+ for (int i = 0; i < length; i++)
+ {
+ Attr attribute = (Attr)nodeMap.item(i);
+ String localName = attribute.getLocalName();
+ String namespaceURI = attribute.getNamespaceURI();
+ String prefix = attribute.getPrefix();
+ QName qname = new QName(namespaceURI, localName);
+
+ if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL))
+ {
+ if (!namespaceURI.equals(Constants.NS_URI_XMLNS))
+ {
+ DOMUtils.registerUniquePrefix(prefix, namespaceURI, def);
+
+ String strValue = attribute.getValue();
+ int attrType = AttributeExtensible.NO_DECLARED_TYPE;
+ ExtensionRegistry extReg = def.getExtensionRegistry();
+
+ if (extReg != null)
+ {
+ attrType = extReg.queryExtensionAttributeType(parentType, qname);
+ }
+
+ Object val = parseExtensibilityAttribute(el, attrType, strValue, def);
+
+ attrExt.setExtensionAttribute(qname, val);
+ }
+ }
+ else if (!nativeAttributeNames.contains(localName))
+ {
+ WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
+ "Encountered illegal " +
+ "extension attribute '" +
+ qname + "'. Extension " +
+ "attributes must be in " +
+ "a namespace other than " +
+ "WSDL's.");
+
+ wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
+
+ throw wsdlExc;
+ }
+ }
+ }
+
+ protected Object parseExtensibilityAttribute(Element el,
+ int attrType,
+ String attrValue,
+ Definition def)
+ throws WSDLException
+ {
+ if (attrType == AttributeExtensible.QNAME_TYPE)
+ {
+ return DOMUtils.getQName(attrValue, el, def);
+ }
+ else if (attrType == AttributeExtensible.LIST_OF_STRINGS_TYPE)
+ {
+ return StringUtils.parseNMTokens(attrValue);
+ }
+ else if (attrType == AttributeExtensible.LIST_OF_QNAMES_TYPE)
+ {
+ List oldList = StringUtils.parseNMTokens(attrValue);
+ int size = oldList.size();
+ List newList = new Vector(size);
+
+ for (int i = 0; i < size; i++)
+ {
+ String str = (String)oldList.get(i);
+ QName qValue = DOMUtils.getQName(str, el, def);
+
+ newList.add(qValue);
+ }
+
+ return newList;
+ }
+ else if (attrType == AttributeExtensible.STRING_TYPE)
+ {
+ return attrValue;
+ }
+ else
+ {
+ QName qValue = null;
+
+ try
+ {
+ qValue = DOMUtils.getQName(attrValue, el, def);
+ }
+ catch (WSDLException e)
+ {
+ qValue = new QName(attrValue);
+ }
+
+ return qValue;
+ }
+ }
+
+ protected PortType parsePortType(Element portTypeEl, Definition def)
+ throws WSDLException
+ {
+ PortType portType = null;
+ String name = DOMUtils.getAttribute(portTypeEl, Constants.ATTR_NAME);
+
+ if (name != null)
+ {
+ QName portTypeName = new QName(def.getTargetNamespace(), name);
+
+ portType = def.getPortType(portTypeName);
+
+ if (portType == null)
+ {
+ portType = def.createPortType();
+ portType.setQName(portTypeName);
+ }
+ }
+ else
+ {
+ portType = def.createPortType();
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ portType.setUndefined(false);
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = portTypeEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(portTypeEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ portType.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl))
+ {
+ Operation op = parseOperation(tempEl, portType, def);
+
+ if (op != null)
+ {
+ portType.addOperation(op);
+ }
+ }
+ else
+ {
+ portType.addExtensibilityElement(
+ parseExtensibilityElement(PortType.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(portTypeEl, PortType.class, portType, def);
+
+ return portType;
+ }
+
+ protected Operation parseOperation(Element opEl,
+ PortType portType,
+ Definition def)
+ throws WSDLException
+ {
+ Operation op = null;
+
+ List remainingAttrs = DOMUtils.getAttributes(opEl);
+ String name = DOMUtils.getAttribute(opEl, Constants.ATTR_NAME, remainingAttrs);
+ String parameterOrderStr = DOMUtils.getAttribute(opEl,
+ Constants.ATTR_PARAMETER_ORDER,
+ remainingAttrs);
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = opEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(opEl);
+ List messageOrder = new Vector();
+ Element docEl = null;
+ Input input = null;
+ Output output = null;
+ List faults = new Vector();
+ List extElements = new Vector();
+ boolean retrieved = true;
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ docEl = tempEl;
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl))
+ {
+ input = parseInput(tempEl, def);
+ messageOrder.add(Constants.ELEM_INPUT);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl))
+ {
+ output = parseOutput(tempEl, def);
+ messageOrder.add(Constants.ELEM_OUTPUT);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl))
+ {
+ faults.add(parseFault(tempEl, def));
+ }
+ else
+ {
+ extElements.add(
+ parseExtensibilityElement(Operation.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ if (name != null)
+ {
+ String inputName = (input != null
+ ? (input.getName() != null ? input.getName() : Constants.NONE)
+ : null);
+ String outputName = (output != null
+ ? (output.getName() != null ? output.getName() : Constants.NONE)
+ : null);
+
+ op = portType.getOperation(name, inputName, outputName);
+
+ if (op != null && !op.isUndefined())
+ {
+ op = null;
+ }
+
+ if (op != null)
+ {
+ if (inputName == null)
+ {
+ Input tempIn = op.getInput();
+
+ if (tempIn != null)
+ {
+ if (tempIn.getName() != null)
+ {
+ op = null;
+ }
+ }
+ }
+ }
+
+ if (op != null)
+ {
+ if (outputName == null)
+ {
+ Output tempOut = op.getOutput();
+
+ if (tempOut != null)
+ {
+ if (tempOut.getName() != null)
+ {
+ op = null;
+ }
+ }
+ }
+ }
+
+ if (op == null)
+ {
+ op = def.createOperation();
+ op.setName(name);
+ retrieved = false;
+ }
+ }
+ else
+ {
+ op = def.createOperation();
+ retrieved = false;
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ op.setUndefined(false);
+
+ if (parameterOrderStr != null)
+ {
+ op.setParameterOrdering(StringUtils.parseNMTokens(parameterOrderStr));
+ }
+
+ if (docEl != null)
+ {
+ op.setDocumentationElement(docEl);
+ }
+
+ if (input != null)
+ {
+ op.setInput(input);
+ }
+
+ if (output != null)
+ {
+ op.setOutput(output);
+ }
+
+ if (faults.size() > 0)
+ {
+ Iterator faultIterator = faults.iterator();
+
+ while (faultIterator.hasNext())
+ {
+ op.addFault((Fault)faultIterator.next());
+ }
+ }
+
+ if (extElements.size() > 0)
+ {
+ Iterator eeIterator = extElements.iterator();
+
+ while (eeIterator.hasNext())
+ {
+ op.addExtensibilityElement(
+ (ExtensibilityElement) eeIterator.next() );
+ }
+ }
+
+ OperationType style = null;
+
+ if (messageOrder.equals(STYLE_ONE_WAY))
+ {
+ style = OperationType.ONE_WAY;
+ }
+ else if (messageOrder.equals(STYLE_REQUEST_RESPONSE))
+ {
+ style = OperationType.REQUEST_RESPONSE;
+ }
+ else if (messageOrder.equals(STYLE_SOLICIT_RESPONSE))
+ {
+ style = OperationType.SOLICIT_RESPONSE;
+ }
+ else if (messageOrder.equals(STYLE_NOTIFICATION))
+ {
+ style = OperationType.NOTIFICATION;
+ }
+
+ if (style != null)
+ {
+ op.setStyle(style);
+ }
+
+ if (retrieved)
+ {
+ op = null;
+ }
+
+ parseExtensibilityAttributes(opEl, Operation.class, op, def);
+
+ return op;
+ }
+
+ protected Service parseService(Element serviceEl, Definition def)
+ throws WSDLException
+ {
+ Service service = def.createService();
+
+ List remainingAttrs = DOMUtils.getAttributes(serviceEl);
+ String name = DOMUtils.getAttribute(serviceEl, Constants.ATTR_NAME, remainingAttrs);
+
+ if (name != null)
+ {
+ service.setQName(new QName(def.getTargetNamespace(), name));
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = serviceEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(serviceEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ service.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_PORT, tempEl))
+ {
+ service.addPort(parsePort(tempEl, def));
+ }
+ else
+ {
+ service.addExtensibilityElement(
+ parseExtensibilityElement(Service.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(serviceEl, Service.class, service, def);
+
+ return service;
+ }
+
+ protected Port parsePort(Element portEl, Definition def)
+ throws WSDLException
+ {
+ Port port = def.createPort();
+
+ List remainingAttrs = DOMUtils.getAttributes(portEl);
+ String name = DOMUtils.getAttribute(portEl, Constants.ATTR_NAME, remainingAttrs);
+ QName bindingStr = getQualifiedAttributeValue(portEl,
+ Constants.ATTR_BINDING,
+ Constants.ELEM_PORT,
+ def,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ port.setName(name);
+ }
+
+ if (bindingStr != null)
+ {
+ Binding binding = def.getBinding(bindingStr);
+
+ if (binding == null)
+ {
+ binding = def.createBinding();
+ binding.setQName(bindingStr);
+ def.addBinding(binding);
+ }
+
+ port.setBinding(binding);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = portEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(portEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ port.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ port.addExtensibilityElement(parseExtensibilityElement(Port.class,
+ tempEl,
+ def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(portEl, Port.class, port, def);
+
+ return port;
+ }
+
+ protected ExtensibilityElement parseExtensibilityElement(
+ Class parentType,
+ Element el,
+ Definition def)
+ throws WSDLException
+ {
+ QName elementType = QNameUtils.newQName(el);
+
+ String namespaceURI = el.getNamespaceURI();
+
+ try
+ {
+ if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_WSDL))
+ {
+ throw new WSDLException(WSDLException.INVALID_WSDL,
+ "Encountered illegal extension element '" +
+ elementType +
+ "' in the context of a '" +
+ parentType.getName() +
+ "'. Extension elements must be in " +
+ "a namespace other than WSDL's.");
+ }
+
+ ExtensionRegistry extReg = def.getExtensionRegistry();
+
+ if (extReg == null)
+ {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+ "No ExtensionRegistry set for this " +
+ "Definition, so unable to deserialize " +
+ "a '" + elementType + "' element in the " +
+ "context of a '" + parentType.getName() +
+ "'.");
+ }
+
+ ExtensionDeserializer extDS = extReg.queryDeserializer(parentType,
+ elementType);
+
+ return extDS.unmarshall(parentType, elementType, el, def, extReg);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(el));
+ }
+
+ throw e;
+ }
+ }
+
+ protected Input parseInput(Element inputEl, Definition def)
+ throws WSDLException
+ {
+ Input input = def.createInput();
+ String name = DOMUtils.getAttribute(inputEl, Constants.ATTR_NAME);
+ QName messageName = getQualifiedAttributeValue(inputEl,
+ Constants.ATTR_MESSAGE,
+ Constants.ELEM_INPUT,
+ def);
+
+ if (name != null)
+ {
+ input.setName(name);
+ }
+
+ if (messageName != null)
+ {
+ Message message = def.getMessage(messageName);
+
+ if (message == null)
+ {
+ message = def.createMessage();
+ message.setQName(messageName);
+ def.addMessage(message);
+ }
+
+ input.setMessage(message);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = inputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(inputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ input.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ input.addExtensibilityElement(
+ parseExtensibilityElement(Input.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(inputEl, Input.class, input, def);
+
+ return input;
+ }
+
+ protected Output parseOutput(Element outputEl, Definition def)
+ throws WSDLException
+ {
+ Output output = def.createOutput();
+ String name = DOMUtils.getAttribute(outputEl, Constants.ATTR_NAME);
+ QName messageName = getQualifiedAttributeValue(outputEl,
+ Constants.ATTR_MESSAGE,
+ Constants.ELEM_OUTPUT,
+ def);
+
+ if (name != null)
+ {
+ output.setName(name);
+ }
+
+ if (messageName != null)
+ {
+ Message message = def.getMessage(messageName);
+
+ if (message == null)
+ {
+ message = def.createMessage();
+ message.setQName(messageName);
+ def.addMessage(message);
+ }
+
+ output.setMessage(message);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = outputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(outputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ output.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ output.addExtensibilityElement(
+ parseExtensibilityElement(Output.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(outputEl, Output.class, output, def);
+
+ return output;
+ }
+
+ protected Fault parseFault(Element faultEl, Definition def)
+ throws WSDLException
+ {
+ Fault fault = def.createFault();
+ String name = DOMUtils.getAttribute(faultEl, Constants.ATTR_NAME);
+ QName messageName = getQualifiedAttributeValue(faultEl,
+ Constants.ATTR_MESSAGE,
+ Constants.ELEM_FAULT,
+ def);
+
+ if (name != null)
+ {
+ fault.setName(name);
+ }
+
+ if (messageName != null)
+ {
+ Message message = def.getMessage(messageName);
+
+ if (message == null)
+ {
+ message = def.createMessage();
+ message.setQName(messageName);
+ def.addMessage(message);
+ }
+
+ fault.setMessage(message);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = faultEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(faultEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ fault.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ fault.addExtensibilityElement(
+ parseExtensibilityElement(Fault.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(faultEl, Fault.class, fault, def);
+
+ return fault;
+ }
+
+ /**
+ * This method should be used for elements that support extension
+ * attributes because it does not track unexpected remaining attributes.
+ */
+ private static QName getQualifiedAttributeValue(Element el,
+ String attrName,
+ String elDesc,
+ Definition def)
+ throws WSDLException
+ {
+ try
+ {
+ return DOMUtils.getQualifiedAttributeValue(el,
+ attrName,
+ elDesc,
+ false,
+ def);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED))
+ {
+ String attrValue = DOMUtils.getAttribute(el, attrName);
+
+ return new QName(attrValue);
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * This method should be used for elements that do not support extension
+ * attributes because it tracks unexpected remaining attributes.
+ */
+ private static QName getQualifiedAttributeValue(Element el,
+ String attrName,
+ String elDesc,
+ Definition def,
+ List remainingAttrs)
+ throws WSDLException
+ {
+ try
+ {
+ return DOMUtils.getQualifiedAttributeValue(el,
+ attrName,
+ elDesc,
+ false,
+ def,
+ remainingAttrs);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED))
+ {
+ String attrValue = DOMUtils.getAttribute(el, attrName, remainingAttrs);
+
+ return new QName(attrValue);
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ private static void checkElementName(Element el, QName qname)
+ throws WSDLException
+ {
+ if (!QNameUtils.matches(qname, el))
+ {
+ WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
+ "Expected element '" +
+ qname + "'.");
+
+ wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
+
+ throw wsdlExc;
+ }
+ }
+
+ private static Document getDocument(InputSource inputSource,
+ String desc) throws WSDLException
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+
+ try
+ {
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setEntityResolver( new JBossWSEntityResolver() );
+ Document doc = builder.parse(inputSource);
+
+ return doc;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.PARSER_ERROR,
+ "Problem parsing '" + desc + "'.",
+ e);
+ }
+ }
+
+ private static void registerNSDeclarations(NamedNodeMap attrs, Definition def)
+ {
+ int size = attrs.getLength();
+
+ for (int i = 0; i < size; i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ String namespaceURI = attr.getNamespaceURI();
+ String localPart = attr.getLocalName();
+ String value = attr.getValue();
+
+ if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS))
+ {
+ if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS))
+ {
+ DOMUtils.registerUniquePrefix(localPart, value, def);
+ }
+ else
+ {
+ DOMUtils.registerUniquePrefix(null, value, def);
+ }
+ }
+ }
+ }
+
+ /**
+ * Read the WSDL document accessible via the specified
+ * URI into a WSDL definition.
+ *
+ * @param wsdlURI a URI (can be a filename or URL) pointing to a
+ * WSDL XML definition.
+ * @return the definition.
+ */
+ public Definition readWSDL(String wsdlURI) throws WSDLException
+ {
+ return readWSDL(null, wsdlURI);
+ }
+
+ /**
+ * Read the WSDL document accessible via the specified
+ * URI into a WSDL definition.
+ *
+ * @param contextURI the context in which to resolve the
+ * wsdlURI, if the wsdlURI is relative. Can be null, in which
+ * case it will be ignored.
+ * @param wsdlURI a URI (can be a filename or URL) pointing to a
+ * WSDL XML definition.
+ * @return the definition.
+ */
+ public Definition readWSDL(String contextURI, String wsdlURI)
+ throws WSDLException
+ {
+ try
+ {
+ if (verbose)
+ {
+ System.out.println("Retrieving document at '" + wsdlURI + "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI + "'."));
+ }
+
+ URL contextURL = (contextURI != null)
+ ? StringUtils.getURL(null, contextURI)
+ : null;
+ URL url = StringUtils.getURL(contextURL, wsdlURI);
+ InputStream inputStream = StringUtils.getContentAsInputStream(url);
+ InputSource inputSource = new InputSource(inputStream);
+ inputSource.setSystemId(url.toString());
+ Document doc = getDocument(inputSource, url.toString());
+
+ inputStream.close();
+
+ Definition def = readWSDL(url.toString(), doc);
+
+ return def;
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to resolve imported document at '" +
+ wsdlURI +
+ (contextURI == null
+ ? "'."
+ : "', relative to '" + contextURI + "'.")
+ , e);
+ }
+ }
+
+ /**
+ * Read the specified <wsdl:definitions> element into a WSDL
+ * definition.
+ *
+ * @param documentBaseURI the document base URI of the WSDL definition
+ * described by the element. Will be set as the documentBaseURI
+ * of the returned Definition. Can be null, in which case it
+ * will be ignored.
+ * @param definitionsElement the <wsdl:definitions> element
+ * @return the definition described by the element.
+ */
+ public Definition readWSDL(String documentBaseURI,
+ Element definitionsElement)
+ throws WSDLException
+ {
+ return readWSDL(documentBaseURI, definitionsElement, null);
+ }
+
+ /**
+ * Read the specified <wsdl:definitions> element into a WSDL
+ * definition. The WSDLLocator is used to provide the document
+ * base URIs. The InputSource of the WSDLLocator is ignored, instead
+ * the WSDL is parsed from the given Element.
+ *
+ * @param locator A WSDLLocator object used to provide
+ * the document base URI of the WSDL definition described by the
+ * element.
+ * @param definitionsElement the <wsdl:definitions> element
+ * @return the definition described by the element.
+ */
+ public Definition readWSDL(WSDLLocator locator,
+ Element definitionsElement)
+ throws WSDLException
+ {
+ try
+ {
+ this.loc = locator;
+ return readWSDL(locator.getBaseURI(), definitionsElement, null);
+ }
+ finally
+ {
+ locator.close();
+ this.loc = null;
+ }
+ }
+
+ protected Definition readWSDL(String documentBaseURI,
+ Element definitionsElement,
+ Map importedDefs)
+ throws WSDLException
+ {
+ return parseDefinitions(documentBaseURI, definitionsElement, importedDefs);
+ }
+
+ /**
+ * Read the specified WSDL document into a WSDL definition.
+ *
+ * @param documentBaseURI the document base URI of the WSDL definition
+ * described by the document. Will be set as the documentBaseURI
+ * of the returned Definition. Can be null, in which case it
+ * will be ignored.
+ * @param wsdlDocument the WSDL document, an XML
+ * document obeying the WSDL schema.
+ * @return the definition described in the document.
+ */
+ public Definition readWSDL(String documentBaseURI, Document wsdlDocument)
+ throws WSDLException
+ {
+ return readWSDL(documentBaseURI, wsdlDocument.getDocumentElement());
+ }
+
+ /**
+ * Read a WSDL document into a WSDL definition.
+ *
+ * @param documentBaseURI the document base URI of the WSDL definition
+ * described by the document. Will be set as the documentBaseURI
+ * of the returned Definition. Can be null, in which case it
+ * will be ignored.
+ * @param inputSource an InputSource pointing to the
+ * WSDL document, an XML document obeying the WSDL schema.
+ * @return the definition described in the document pointed to
+ * by the InputSource.
+ */
+ public Definition readWSDL(String documentBaseURI, InputSource inputSource)
+ throws WSDLException
+ {
+ String location = (inputSource.getSystemId() != null ?
+ inputSource.getSystemId() : "- WSDL Document -");
+
+ return readWSDL(documentBaseURI,
+ getDocument(inputSource, location));
+ }
+
+ /**
+ * Read a WSDL document into a WSDL definition.
+ *
+ * @param locator A WSDLLocator object used to provide InputSources
+ * pointing to the wsdl file.
+ * @return the definition described in the document
+ */
+ public Definition readWSDL(WSDLLocator locator) throws WSDLException
+ {
+ InputSource is = locator.getBaseInputSource();
+ String base = locator.getBaseURI();
+
+ if (is == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate document at '" + base + "'.");
+ }
+ is.setSystemId(base);
+
+ this.loc = locator;
+
+ if (verbose)
+ {
+ System.out.println("Retrieving document at '" + base + "'.");
+ }
+
+ try
+ {
+ return readWSDL(base, is);
+ }
+ finally
+ {
+ this.loc.close();
+ this.loc = null;
+ }
+ }
+}
+
Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2007-06-06 13:53:23 UTC (rev 3477)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2007-06-06 13:53:56 UTC (rev 3478)
@@ -23,19 +23,6 @@
// $Id$
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.ConnectException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.parsers.DocumentBuilder;
-
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.utils.JBossWSEntityResolver;
@@ -47,6 +34,18 @@
import org.w3c.dom.Element;
import org.xml.sax.EntityResolver;
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.parsers.DocumentBuilder;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.ConnectException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* A factory that creates a <code>WSDLDefinitions</code> object from an URL.
*
@@ -109,12 +108,13 @@
String defaultNamespace = getDefaultNamespace(wsdlDoc);
if (Constants.NS_WSDL11.equals(defaultNamespace))
{
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance(JBossWSDLFactoryImpl.class.getName());
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
// Setup reader features
Iterator it = features.entrySet().iterator();
+
while (it.hasNext())
{
Map.Entry entry = (Map.Entry)it.next();
@@ -122,17 +122,15 @@
Boolean flag = (Boolean)entry.getValue();
wsdlReader.setFeature(key, flag.booleanValue());
}
-
- // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
- // [TODO] show the usecase that needs this
- //((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
-
+
Definition definition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation));
wsdlDefinitions = new WSDL11Reader().processDefinition(definition, wsdlLocation);
wsdlDefinitions.setWsdlDocument(wsdlDoc);
}
else
+ {
throw new WSDLException("Invalid default namespace: " + defaultNamespace);
+ }
if (log.isTraceEnabled())
{
18 years, 10 months
JBossWS SVN: r3477 - branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-06 09:53:23 -0400 (Wed, 06 Jun 2007)
New Revision: 3477
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java
Log:
Remove dependency upon EJB3
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java 2007-06-06 13:52:49 UTC (rev 3476)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java 2007-06-06 13:53:23 UTC (rev 3477)
@@ -21,18 +21,15 @@
*/
package org.jboss.ws.tools.jaxws.impl;
-import org.jboss.ws.WSException;
-import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
-import org.jboss.wsf.spi.deployment.BasicDeployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import static org.jboss.wsf.spi.deployment.Deployment.DeploymentType.JAXWS_EJB3;
-import static org.jboss.wsf.spi.deployment.Deployment.DeploymentType.JAXWS_JSE;
+import org.jboss.ws.WSException;
import org.jboss.ws.integration.ResourceLoaderAdapter;
-import org.jboss.wsf.spi.tools.WSContractProvider;
import org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.wsf.spi.deployment.BasicDeployment;
+import static org.jboss.wsf.spi.deployment.Deployment.DeploymentType.JAXWS_JSE;
+import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
+import org.jboss.wsf.spi.tools.WSContractProvider;
-import javax.ejb.Stateless;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
@@ -71,8 +68,8 @@
private UnifiedDeploymentInfo createUDI(Class<?> endpointClass, ClassLoader loader)
{
- DeploymentType type = (endpointClass.isAnnotationPresent(Stateless.class)) ? JAXWS_EJB3 : JAXWS_JSE;
- UnifiedDeploymentInfo udi = new UnifiedDeploymentInfo(type)
+ //DeploymentType type = (endpointClass.isAnnotationPresent(Stateless.class)) ? JAXWS_EJB3 : JAXWS_JSE;
+ UnifiedDeploymentInfo udi = new UnifiedDeploymentInfo(JAXWS_JSE)
{
@Override
public URL getMetaDataFileURL(String resourcePath) throws IOException
18 years, 10 months
JBossWS SVN: r3476 - branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-06 09:52:49 -0400 (Wed, 06 Jun 2007)
New Revision: 3476
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java
Log:
Rely on local entity resolver
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java 2007-06-06 13:52:27 UTC (rev 3475)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java 2007-06-06 13:52:49 UTC (rev 3476)
@@ -73,7 +73,8 @@
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
{
DocumentBuilder builder = delegate.newDocumentBuilder();
- return builder;
+ builder.setEntityResolver( new JBossWSEntityResolver() );
+ return builder;
}
public void setAttribute(String name, Object value) throws IllegalArgumentException
18 years, 10 months
JBossWS SVN: r3475 - branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-06 09:52:27 -0400 (Wed, 06 Jun 2007)
New Revision: 3475
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
Log:
Additional javadoc
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2007-06-06 13:48:22 UTC (rev 3474)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2007-06-06 13:52:27 UTC (rev 3475)
@@ -481,7 +481,9 @@
/**
* Identify MTOM and SWA:Ref parameter as these require special treatment.
- * This only affects JAX-WS endpoints
+ * This only affects JAX-WS endpoints.
+ *
+ * Note: For SEI parameter annotations this happens within the metadata builder.
* @param epType
*/
private void initializeAttachmentParameter(Type epType)
18 years, 10 months
JBossWS SVN: r3473 - in trunk/jbossws-core/src: test/java/org/jboss/test/ws/tools and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-06-06 09:47:50 -0400 (Wed, 06 Jun 2007)
New Revision: 3473
Added:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/
trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml
Removed:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml
trunk/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml
trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
Log:
JBWS-1698 - WSDL To Java - If fault name contains 'Fault' the generated Exception does not match the throws clause on the SEI.
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-06-06 13:43:55 UTC (rev 3472)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -327,7 +327,7 @@
if (cl == null)
{
String faultTypeName = (!xt.getAnonymous()) ? faultXMLType.getLocalPart() : faultXMLName.getLocalPart();
- buf.append(seiPkgName + "." + cleanUpFaultName(faultTypeName));
+ buf.append(seiPkgName + "." + JavaUtils.capitalize(faultTypeName));
}
else buf.append(cl.getName());
buf.append(",");
@@ -441,10 +441,10 @@
XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(), elementName.getNamespaceURI());
XSTypeDefinition xt = xe.getTypeDefinition();
QName xmlType = new QName(xt.getNamespace(), xt.getName());
-
+
// Replace the xt with the real type from the schema.
xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
-
+
if (buf.length() > 0)
{
buf.append(", ");
@@ -754,33 +754,6 @@
return cls.getName() + arraySuffix;
}
- /**
- * WSDL may have appended the Faults with 'Fault' or 'Error'
- * @param faultname
- * @return
- */
- private String cleanUpFaultName(String faultname)
- {
- //Clean up the faultname from Error and Fault
- boolean endsfault = faultname.endsWith("Fault");
-
- if (endsfault)
- {
- int index = faultname.lastIndexOf("Fault");
- faultname = faultname.substring(0, index);
- }
- else
- {
- boolean endsError = faultname.endsWith("Error");
- if (endsError)
- {
- int index = faultname.lastIndexOf("Error");
- faultname = faultname.substring(0, index);
- }
- }
- return JavaUtils.capitalize(faultname);
- }
-
private void checkTypeMapping()
{
if (typeMapping == null)
Copied: trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698 (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698)
Deleted: trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.tools.jbws1698;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
-import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
-import org.jboss.ws.tools.WSTools;
-
-/**
- * Test case for http://jira.jboss.com/jira/browse/JBWS-1698
- *
- * WSDL To Java does not use the correct name in the throws
- * clause for faults that end in 'Fault'
- *
- * @author darran.lofthouse(a)jboss.com
- * @since Jun 6, 2007
- */
-public class JBWS1698TestCase extends WSToolsTest
-{
-
- /**
- * Test WSDL to Java with a fault called PhoneBookFault
- */
- public void testGenerateFault() throws Exception
- {
- generateScenario("fault");
- }
-
- /**
- * Test WSDL to Java with a fault called PhoneBookError
- */
- public void testGenerateError() throws Exception
- {
- generateScenario("error");
- }
-
- protected void generateScenario(final String scenario) throws Exception
- {
- String resourceDir = "resources/tools/jbws1698/" + scenario;
- String toolsDir = "tools/jbws1698/" + scenario;
- String[] args = new String[] { "-dest", toolsDir, "-config", resourceDir + "/wstools-config.xml" };
- new WSTools().generate(args);
- File resourceDirFile = new File(resourceDir);
- String[] expectedFiles = resourceDirFile.list(new FilenameFilter() {
- public boolean accept(File dir, String name)
- {
- return name.endsWith(".java");
- }
- });
-
- for (int i = 0; i < expectedFiles.length; i++)
- {
- String currentFile = expectedFiles[i];
-
- try
- {
- compareSource(resourceDir + "/" + currentFile, toolsDir + "/org/jboss/test/ws/jbws1698/" + currentFile);
- }
- catch (Exception e)
- {
- throw new Exception("Validation of '" + currentFile + "' failed.", e);
- }
- }
-
- File packageDir = new File(toolsDir + "/org/jboss/test/ws/jbws1698");
- String[] generatedFiles = packageDir.list();
- for (int i = 0; i < generatedFiles.length; i++)
- {
- String currentFile = generatedFiles[i];
-
- boolean matched = "PhoneBookService.java".equals(currentFile);
-
- for (int j = 0; j < expectedFiles.length && (matched == false); j++)
- matched = currentFile.equals(expectedFiles[j]);
-
- assertTrue("File '" + currentFile + "' was not expected to be generated", matched);
- }
-
- JaxrpcMappingValidator mappingValidator = new JaxrpcMappingValidator();
- mappingValidator.validate(resourceDir + "/jaxrpc-mapping.xml", toolsDir + "/jaxrpc-mapping.xml");
- }
-
- private static void compareSource(final String expectedName, final String generatedName) throws Exception
- {
- File expected = new File(expectedName);
- File generated = new File(generatedName);
-
- JBossSourceComparator sc = new JBossSourceComparator(expected, generated);
- sc.validate();
- sc.validateImports();
- }
-
-}
Copied: trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java)
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java (rev 0)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.tools.jbws1698;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
+import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
+import org.jboss.ws.tools.WSTools;
+
+/**
+ * Test case for http://jira.jboss.com/jira/browse/JBWS-1698
+ *
+ * WSDL To Java does not use the correct name in the throws
+ * clause for faults that end in 'Fault'
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since Jun 6, 2007
+ */
+public class JBWS1698TestCase extends WSToolsTest
+{
+
+ /**
+ * Test WSDL to Java with a fault called PhoneBookFault
+ */
+ public void testGenerateFault() throws Exception
+ {
+ generateScenario("fault");
+ }
+
+ /**
+ * Test WSDL to Java with a fault called PhoneBookError
+ */
+ public void testGenerateError() throws Exception
+ {
+ generateScenario("error");
+ }
+
+ protected void generateScenario(final String scenario) throws Exception
+ {
+ String resourceDir = "resources/tools/jbws1698/" + scenario;
+ String toolsDir = "tools/jbws1698/" + scenario;
+ String[] args = new String[] { "-dest", toolsDir, "-config", resourceDir + "/wstools-config.xml" };
+ new WSTools().generate(args);
+ File resourceDirFile = new File(resourceDir);
+ String[] expectedFiles = resourceDirFile.list(new FilenameFilter() {
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".java");
+ }
+ });
+
+ for (int i = 0; i < expectedFiles.length; i++)
+ {
+ String currentFile = expectedFiles[i];
+
+ try
+ {
+ compareSource(resourceDir + "/" + currentFile, toolsDir + "/org/jboss/test/ws/jbws1698/" + currentFile);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Validation of '" + currentFile + "' failed.", e);
+ }
+ }
+
+ File packageDir = new File(toolsDir + "/org/jboss/test/ws/jbws1698");
+ String[] generatedFiles = packageDir.list();
+ for (int i = 0; i < generatedFiles.length; i++)
+ {
+ String currentFile = generatedFiles[i];
+
+ boolean matched = "PhoneBookService.java".equals(currentFile);
+
+ for (int j = 0; j < expectedFiles.length && (matched == false); j++)
+ matched = currentFile.equals(expectedFiles[j]);
+
+ assertTrue("File '" + currentFile + "' was not expected to be generated", matched);
+ }
+
+ JaxrpcMappingValidator mappingValidator = new JaxrpcMappingValidator();
+ mappingValidator.validate(resourceDir + "/jaxrpc-mapping.xml", toolsDir + "/jaxrpc-mapping.xml");
+ }
+
+ private static void compareSource(final String expectedName, final String generatedName) throws Exception
+ {
+ File expected = new File(expectedName);
+ File generated = new File(generatedName);
+
+ JBossSourceComparator sc = new JBossSourceComparator(expected, generated);
+ sc.validate();
+ sc.validateImports();
+ }
+
+}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698 (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698)
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error)
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,34 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-
-package org.jboss.test.ws.jbws1698;
-
-
-public class Person
-{
-
-protected java.lang.String firstName;
-
-protected java.lang.String surname;
-public Person(){}
-
-public Person(java.lang.String firstName, java.lang.String surname){
-this.firstName=firstName;
-this.surname=surname;
-}
-public java.lang.String getFirstName() { return firstName ;}
-
-public void setFirstName(java.lang.String firstName){ this.firstName=firstName; }
-
-public java.lang.String getSurname() { return surname ;}
-
-public void setSurname(java.lang.String surname){ this.surname=surname; }
-
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class Person
+{
+
+protected java.lang.String firstName;
+
+protected java.lang.String surname;
+public Person(){}
+
+public Person(java.lang.String firstName, java.lang.String surname){
+this.firstName=firstName;
+this.surname=surname;
+}
+public java.lang.String getFirstName() { return firstName ;}
+
+public void setFirstName(java.lang.String firstName){ this.firstName=firstName; }
+
+public java.lang.String getSurname() { return surname ;}
+
+public void setSurname(java.lang.String surname){ this.surname=surname; }
+
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions name='PhoneBook'
- targetNamespace='http://test.jboss.org/ws/jbws1698'
- xmlns='http://schemas.xmlsoap.org/wsdl/'
- xmlns:ns1='http://test.jboss.org/ws/jbws1698/types'
- xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
- xmlns:tns='http://test.jboss.org/ws/jbws1698'
- xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
- <types>
- <schema targetNamespace='http://test.jboss.org/ws/jbws1698/types'
- xmlns='http://www.w3.org/2001/XMLSchema'
- xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
- xmlns:tns='http://test.jboss.org/ws/jbws1698/types'
- xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
- <complexType name='Person'>
- <sequence>
- <element name='firstName' nillable='true' type='string'/>
- <element name='surname' nillable='true' type='string'/>
- </sequence>
- </complexType>
- <complexType name='PhoneBookError'>
- <sequence/>
- </complexType>
- <complexType name='TelephoneNumber'>
- <sequence>
- <element name='areaCode' nillable='true' type='string'/>
- <element name='number' nillable='true' type='string'/>
- </sequence>
- </complexType>
- <element name='lookup' type='tns:Person'/>
- <element name='lookupResponse' type='tns:TelephoneNumber'/>
- <element name='PhoneBookError' type='tns:PhoneBookError'/>
- </schema>
- </types>
-
- <message name='PhoneBook_lookup' xmlns='http://schemas.xmlsoap.org/wsdl/'>
- <part element='ns1:lookup' name='lookup'/>
- </message>
- <message name='PhoneBook_lookupResponse'>
- <part element='ns1:lookupResponse' name='lookupResponse'/>
- </message>
- <message name='PhoneBookError'>
- <part element='ns1:PhoneBookError' name='PhoneBookError'/>
- </message>
-
- <portType name='PhoneBook'>
- <operation name='lookup' parameterOrder='lookup'>
- <input message='tns:PhoneBook_lookup'/>
- <output message='tns:PhoneBook_lookupResponse'/>
- <fault message='tns:PhoneBookError' name='PhoneBookError'/>
- </operation>
- </portType>
- <binding name='PhoneBookBinding' type='tns:PhoneBook'>
- <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
- <operation name='lookup'>
- <soap:operation soapAction=''/>
- <input>
- <soap:body use='literal'/>
- </input>
- <output>
- <soap:body use='literal'/>
- </output>
- <fault name='PhoneBookError'>
- <soap:fault name='PhoneBookError' use='literal'/>
- </fault>
- </operation>
- </binding>
- <service name='PhoneBook'>
- <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
- <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
- </port>
- </service>
-</definitions>
\ No newline at end of file
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook'
+ targetNamespace='http://test.jboss.org/ws/jbws1698'
+ xmlns='http://schemas.xmlsoap.org/wsdl/'
+ xmlns:ns1='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698'
+ xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema targetNamespace='http://test.jboss.org/ws/jbws1698/types'
+ xmlns='http://www.w3.org/2001/XMLSchema'
+ xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <complexType name='Person'>
+ <sequence>
+ <element name='firstName' nillable='true' type='string'/>
+ <element name='surname' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <complexType name='PhoneBookError'>
+ <sequence/>
+ </complexType>
+ <complexType name='TelephoneNumber'>
+ <sequence>
+ <element name='areaCode' nillable='true' type='string'/>
+ <element name='number' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <element name='lookup' type='tns:Person'/>
+ <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ <element name='PhoneBookError' type='tns:PhoneBookError'/>
+ </schema>
+ </types>
+
+ <message name='PhoneBook_lookup' xmlns='http://schemas.xmlsoap.org/wsdl/'>
+ <part element='ns1:lookup' name='lookup'/>
+ </message>
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookupResponse' name='lookupResponse'/>
+ </message>
+ <message name='PhoneBookError'>
+ <part element='ns1:PhoneBookError' name='PhoneBookError'/>
+ </message>
+
+ <portType name='PhoneBook'>
+ <operation name='lookup' parameterOrder='lookup'>
+ <input message='tns:PhoneBook_lookup'/>
+ <output message='tns:PhoneBook_lookupResponse'/>
+ <fault message='tns:PhoneBookError' name='PhoneBookError'/>
+ </operation>
+ </portType>
+ <binding name='PhoneBookBinding' type='tns:PhoneBook'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='lookup'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ <fault name='PhoneBookError'>
+ <soap:fault name='PhoneBookError' use='literal'/>
+ </fault>
+ </operation>
+ </binding>
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,18 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-
-package org.jboss.test.ws.jbws1698;
-
-
-public class PhoneBookError
- extends Exception{
-public PhoneBookError(){
-}
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,18 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class PhoneBookError
+ extends Exception{
+public PhoneBookError(){
+}
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,15 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-package org.jboss.test.ws.jbws1698;
-public interface PhoneBook_PortType extends java.rmi.Remote
-{
-
- public org.jboss.test.ws.jbws1698.TelephoneNumber lookup(org.jboss.test.ws.jbws1698.Person lookup) throws org.jboss.test.ws.jbws1698.PhoneBookError, java.rmi.RemoteException;
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,15 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+package org.jboss.test.ws.jbws1698;
+public interface PhoneBook_PortType extends java.rmi.Remote
+{
+
+ public org.jboss.test.ws.jbws1698.TelephoneNumber lookup(org.jboss.test.ws.jbws1698.Person lookup) throws org.jboss.test.ws.jbws1698.PhoneBookError, java.rmi.RemoteException;
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,34 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-
-package org.jboss.test.ws.jbws1698;
-
-
-public class TelephoneNumber
-{
-
-protected java.lang.String areaCode;
-
-protected java.lang.String number;
-public TelephoneNumber(){}
-
-public TelephoneNumber(java.lang.String areaCode, java.lang.String number){
-this.areaCode=areaCode;
-this.number=number;
-}
-public java.lang.String getAreaCode() { return areaCode ;}
-
-public void setAreaCode(java.lang.String areaCode){ this.areaCode=areaCode; }
-
-public java.lang.String getNumber() { return number ;}
-
-public void setNumber(java.lang.String number){ this.number=number; }
-
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class TelephoneNumber
+{
+
+protected java.lang.String areaCode;
+
+protected java.lang.String number;
+public TelephoneNumber(){}
+
+public TelephoneNumber(java.lang.String areaCode, java.lang.String number){
+this.areaCode=areaCode;
+this.number=number;
+}
+public java.lang.String getAreaCode() { return areaCode ;}
+
+public void setAreaCode(java.lang.String areaCode){ this.areaCode=areaCode; }
+
+public java.lang.String getNumber() { return number ;}
+
+public void setNumber(java.lang.String number){ this.number=number; }
+
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,76 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
- <package-mapping>
- <package-type>org.jboss.test.ws.jbws1698</package-type>
- <namespaceURI>http://test.jboss.org/ws/jbws1698/types</namespaceURI>
- </package-mapping>
- <package-mapping>
- <package-type>org.jboss.test.ws.jbws1698</package-type>
- <namespaceURI>http://test.jboss.org/ws/jbws1698</namespaceURI>
- </package-mapping>
- <java-xml-type-mapping>
- <java-type>org.jboss.test.ws.jbws1698.Person</java-type>
- <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:Person</root-type-qname>
- <qname-scope>complexType</qname-scope>
- <variable-mapping>
- <java-variable-name>firstName</java-variable-name>
- <xml-element-name>firstName</xml-element-name>
- </variable-mapping>
- <variable-mapping>
- <java-variable-name>surname</java-variable-name>
- <xml-element-name>surname</xml-element-name>
- </variable-mapping>
- </java-xml-type-mapping>
- <java-xml-type-mapping>
- <java-type>org.jboss.test.ws.jbws1698.TelephoneNumber</java-type>
- <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:TelephoneNumber</root-type-qname>
- <qname-scope>complexType</qname-scope>
- <variable-mapping>
- <java-variable-name>areaCode</java-variable-name>
- <xml-element-name>areaCode</xml-element-name>
- </variable-mapping>
- <variable-mapping>
- <java-variable-name>number</java-variable-name>
- <xml-element-name>number</xml-element-name>
- </variable-mapping>
- </java-xml-type-mapping>
- <java-xml-type-mapping>
- <java-type>org.jboss.test.ws.jbws1698.PhoneBookError</java-type>
- <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:PhoneBookError</root-type-qname>
- <qname-scope>complexType</qname-scope>
- </java-xml-type-mapping>
- <exception-mapping>
- <exception-type>org.jboss.test.ws.jbws1698.PhoneBookError</exception-type>
- <wsdl-message xmlns:exMsgNS='http://test.jboss.org/ws/jbws1698'>exMsgNS:PhoneBookError</wsdl-message>
- </exception-mapping>
- <service-interface-mapping>
- <service-interface>org.jboss.test.ws.jbws1698.PhoneBook_Service</service-interface>
- <wsdl-service-name xmlns:serviceNS='http://test.jboss.org/ws/jbws1698'>serviceNS:PhoneBook</wsdl-service-name>
- <port-mapping>
- <port-name>PhoneBookPort</port-name>
- <java-port-name>PhoneBookPort</java-port-name>
- </port-mapping>
- </service-interface-mapping>
- <service-endpoint-interface-mapping>
- <service-endpoint-interface>org.jboss.test.ws.jbws1698.PhoneBook_PortType</service-endpoint-interface>
- <wsdl-port-type xmlns:portTypeNS='http://test.jboss.org/ws/jbws1698'>portTypeNS:PhoneBook</wsdl-port-type>
- <wsdl-binding xmlns:bindingNS='http://test.jboss.org/ws/jbws1698'>bindingNS:PhoneBookBinding</wsdl-binding>
- <service-endpoint-method-mapping>
- <java-method-name>lookup</java-method-name>
- <wsdl-operation>lookup</wsdl-operation>
- <method-param-parts-mapping>
- <param-position>0</param-position>
- <param-type>org.jboss.test.ws.jbws1698.Person</param-type>
- <wsdl-message-mapping>
- <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookup</wsdl-message>
- <wsdl-message-part-name>lookup</wsdl-message-part-name>
- <parameter-mode>IN</parameter-mode>
- </wsdl-message-mapping>
- </method-param-parts-mapping>
- <wsdl-return-value-mapping>
- <method-return-value>org.jboss.test.ws.jbws1698.TelephoneNumber</method-return-value>
- <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookupResponse</wsdl-message>
- <wsdl-message-part-name>lookupResponse</wsdl-message-part-name>
- </wsdl-return-value-mapping>
- </service-endpoint-method-mapping>
- </service-endpoint-interface-mapping>
-</java-wsdl-mapping>
\ No newline at end of file
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,76 @@
+<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698/types</namespaceURI>
+ </package-mapping>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698</namespaceURI>
+ </package-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.Person</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:Person</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>firstName</java-variable-name>
+ <xml-element-name>firstName</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>surname</java-variable-name>
+ <xml-element-name>surname</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.TelephoneNumber</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:TelephoneNumber</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>areaCode</java-variable-name>
+ <xml-element-name>areaCode</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>number</java-variable-name>
+ <xml-element-name>number</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.PhoneBookError</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:PhoneBookError</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ </java-xml-type-mapping>
+ <exception-mapping>
+ <exception-type>org.jboss.test.ws.jbws1698.PhoneBookError</exception-type>
+ <wsdl-message xmlns:exMsgNS='http://test.jboss.org/ws/jbws1698'>exMsgNS:PhoneBookError</wsdl-message>
+ </exception-mapping>
+ <service-interface-mapping>
+ <service-interface>org.jboss.test.ws.jbws1698.PhoneBook_Service</service-interface>
+ <wsdl-service-name xmlns:serviceNS='http://test.jboss.org/ws/jbws1698'>serviceNS:PhoneBook</wsdl-service-name>
+ <port-mapping>
+ <port-name>PhoneBookPort</port-name>
+ <java-port-name>PhoneBookPort</java-port-name>
+ </port-mapping>
+ </service-interface-mapping>
+ <service-endpoint-interface-mapping>
+ <service-endpoint-interface>org.jboss.test.ws.jbws1698.PhoneBook_PortType</service-endpoint-interface>
+ <wsdl-port-type xmlns:portTypeNS='http://test.jboss.org/ws/jbws1698'>portTypeNS:PhoneBook</wsdl-port-type>
+ <wsdl-binding xmlns:bindingNS='http://test.jboss.org/ws/jbws1698'>bindingNS:PhoneBookBinding</wsdl-binding>
+ <service-endpoint-method-mapping>
+ <java-method-name>lookup</java-method-name>
+ <wsdl-operation>lookup</wsdl-operation>
+ <method-param-parts-mapping>
+ <param-position>0</param-position>
+ <param-type>org.jboss.test.ws.jbws1698.Person</param-type>
+ <wsdl-message-mapping>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookup</wsdl-message>
+ <wsdl-message-part-name>lookup</wsdl-message-part-name>
+ <parameter-mode>IN</parameter-mode>
+ </wsdl-message-mapping>
+ </method-param-parts-mapping>
+ <wsdl-return-value-mapping>
+ <method-return-value>org.jboss.test.ws.jbws1698.TelephoneNumber</method-return-value>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookupResponse</wsdl-message>
+ <wsdl-message-part-name>lookupResponse</wsdl-message-part-name>
+ </wsdl-return-value-mapping>
+ </service-endpoint-method-mapping>
+ </service-endpoint-interface-mapping>
+</java-wsdl-mapping>
\ No newline at end of file
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,5 +0,0 @@
-<configuration>
- <wsdl-java location="resources/tools/jbws1698/error/PhoneBook.wsdl" parameter-style="bare">
- <mapping file="jaxrpc-mapping.xml"/>
- </wsdl-java>
-</configuration>
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,5 @@
+<configuration>
+ <wsdl-java location="resources/tools/jbws1698/error/PhoneBook.wsdl" parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault)
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,34 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-
-package org.jboss.test.ws.jbws1698;
-
-
-public class Person
-{
-
-protected java.lang.String firstName;
-
-protected java.lang.String surname;
-public Person(){}
-
-public Person(java.lang.String firstName, java.lang.String surname){
-this.firstName=firstName;
-this.surname=surname;
-}
-public java.lang.String getFirstName() { return firstName ;}
-
-public void setFirstName(java.lang.String firstName){ this.firstName=firstName; }
-
-public java.lang.String getSurname() { return surname ;}
-
-public void setSurname(java.lang.String surname){ this.surname=surname; }
-
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class Person
+{
+
+protected java.lang.String firstName;
+
+protected java.lang.String surname;
+public Person(){}
+
+public Person(java.lang.String firstName, java.lang.String surname){
+this.firstName=firstName;
+this.surname=surname;
+}
+public java.lang.String getFirstName() { return firstName ;}
+
+public void setFirstName(java.lang.String firstName){ this.firstName=firstName; }
+
+public java.lang.String getSurname() { return surname ;}
+
+public void setSurname(java.lang.String surname){ this.surname=surname; }
+
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions name='PhoneBook'
- targetNamespace='http://test.jboss.org/ws/jbws1698'
- xmlns='http://schemas.xmlsoap.org/wsdl/'
- xmlns:ns1='http://test.jboss.org/ws/jbws1698/types'
- xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
- xmlns:tns='http://test.jboss.org/ws/jbws1698'
- xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
- <types>
- <schema targetNamespace='http://test.jboss.org/ws/jbws1698/types'
- xmlns='http://www.w3.org/2001/XMLSchema'
- xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
- xmlns:tns='http://test.jboss.org/ws/jbws1698/types'
- xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
- <complexType name='Person'>
- <sequence>
- <element name='firstName' nillable='true' type='string'/>
- <element name='surname' nillable='true' type='string'/>
- </sequence>
- </complexType>
- <complexType name='PhoneBookFault'>
- <sequence/>
- </complexType>
- <complexType name='TelephoneNumber'>
- <sequence>
- <element name='areaCode' nillable='true' type='string'/>
- <element name='number' nillable='true' type='string'/>
- </sequence>
- </complexType>
- <element name='lookup' type='tns:Person'/>
- <element name='lookupResponse' type='tns:TelephoneNumber'/>
- <element name='PhoneBookFault' type='tns:PhoneBookFault'/>
- </schema>
- </types>
-
- <message name='PhoneBook_lookup' xmlns='http://schemas.xmlsoap.org/wsdl/'>
- <part element='ns1:lookup' name='lookup'/>
- </message>
- <message name='PhoneBook_lookupResponse'>
- <part element='ns1:lookupResponse' name='lookupResponse'/>
- </message>
- <message name='PhoneBookFault'>
- <part element='ns1:PhoneBookFault' name='PhoneBookFault'/>
- </message>
-
- <portType name='PhoneBook'>
- <operation name='lookup' parameterOrder='lookup'>
- <input message='tns:PhoneBook_lookup'/>
- <output message='tns:PhoneBook_lookupResponse'/>
- <fault message='tns:PhoneBookFault' name='PhoneBookFault'/>
- </operation>
- </portType>
- <binding name='PhoneBookBinding' type='tns:PhoneBook'>
- <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
- <operation name='lookup'>
- <soap:operation soapAction=''/>
- <input>
- <soap:body use='literal'/>
- </input>
- <output>
- <soap:body use='literal'/>
- </output>
- <fault name='PhoneBookFault'>
- <soap:fault name='PhoneBookFault' use='literal'/>
- </fault>
- </operation>
- </binding>
- <service name='PhoneBook'>
- <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
- <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
- </port>
- </service>
-</definitions>
\ No newline at end of file
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook'
+ targetNamespace='http://test.jboss.org/ws/jbws1698'
+ xmlns='http://schemas.xmlsoap.org/wsdl/'
+ xmlns:ns1='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698'
+ xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema targetNamespace='http://test.jboss.org/ws/jbws1698/types'
+ xmlns='http://www.w3.org/2001/XMLSchema'
+ xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <complexType name='Person'>
+ <sequence>
+ <element name='firstName' nillable='true' type='string'/>
+ <element name='surname' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <complexType name='PhoneBookFault'>
+ <sequence/>
+ </complexType>
+ <complexType name='TelephoneNumber'>
+ <sequence>
+ <element name='areaCode' nillable='true' type='string'/>
+ <element name='number' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <element name='lookup' type='tns:Person'/>
+ <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ <element name='PhoneBookFault' type='tns:PhoneBookFault'/>
+ </schema>
+ </types>
+
+ <message name='PhoneBook_lookup' xmlns='http://schemas.xmlsoap.org/wsdl/'>
+ <part element='ns1:lookup' name='lookup'/>
+ </message>
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookupResponse' name='lookupResponse'/>
+ </message>
+ <message name='PhoneBookFault'>
+ <part element='ns1:PhoneBookFault' name='PhoneBookFault'/>
+ </message>
+
+ <portType name='PhoneBook'>
+ <operation name='lookup' parameterOrder='lookup'>
+ <input message='tns:PhoneBook_lookup'/>
+ <output message='tns:PhoneBook_lookupResponse'/>
+ <fault message='tns:PhoneBookFault' name='PhoneBookFault'/>
+ </operation>
+ </portType>
+ <binding name='PhoneBookBinding' type='tns:PhoneBook'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='lookup'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ <fault name='PhoneBookFault'>
+ <soap:fault name='PhoneBookFault' use='literal'/>
+ </fault>
+ </operation>
+ </binding>
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,18 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-
-package org.jboss.test.ws.jbws1698;
-
-
-public class PhoneBookFault
- extends Exception{
-public PhoneBookFault(){
-}
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,18 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class PhoneBookFault
+ extends Exception{
+public PhoneBookFault(){
+}
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,15 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-package org.jboss.test.ws.jbws1698;
-public interface PhoneBook_PortType extends java.rmi.Remote
-{
-
- public org.jboss.test.ws.jbws1698.TelephoneNumber lookup(org.jboss.test.ws.jbws1698.Person lookup) throws org.jboss.test.ws.jbws1698.PhoneBookFault, java.rmi.RemoteException;
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,15 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+package org.jboss.test.ws.jbws1698;
+public interface PhoneBook_PortType extends java.rmi.Remote
+{
+
+ public org.jboss.test.ws.jbws1698.TelephoneNumber lookup(org.jboss.test.ws.jbws1698.Person lookup) throws org.jboss.test.ws.jbws1698.PhoneBookFault, java.rmi.RemoteException;
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,34 +0,0 @@
-/*
- * JBossWS WS-Tools Generated Source
- *
- * Generation Date: Wed Jun 06 14:58:58 CEST 2007
- *
- * This generated source code represents a derivative work of the input to
- * the generator that produced it. Consult the input for the copyright and
- * terms of use that apply to this source code.
- */
-
-package org.jboss.test.ws.jbws1698;
-
-
-public class TelephoneNumber
-{
-
-protected java.lang.String areaCode;
-
-protected java.lang.String number;
-public TelephoneNumber(){}
-
-public TelephoneNumber(java.lang.String areaCode, java.lang.String number){
-this.areaCode=areaCode;
-this.number=number;
-}
-public java.lang.String getAreaCode() { return areaCode ;}
-
-public void setAreaCode(java.lang.String areaCode){ this.areaCode=areaCode; }
-
-public java.lang.String getNumber() { return number ;}
-
-public void setNumber(java.lang.String number){ this.number=number; }
-
-}
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class TelephoneNumber
+{
+
+protected java.lang.String areaCode;
+
+protected java.lang.String number;
+public TelephoneNumber(){}
+
+public TelephoneNumber(java.lang.String areaCode, java.lang.String number){
+this.areaCode=areaCode;
+this.number=number;
+}
+public java.lang.String getAreaCode() { return areaCode ;}
+
+public void setAreaCode(java.lang.String areaCode){ this.areaCode=areaCode; }
+
+public java.lang.String getNumber() { return number ;}
+
+public void setNumber(java.lang.String number){ this.number=number; }
+
+}
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,76 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
- <package-mapping>
- <package-type>org.jboss.test.ws.jbws1698</package-type>
- <namespaceURI>http://test.jboss.org/ws/jbws1698/types</namespaceURI>
- </package-mapping>
- <package-mapping>
- <package-type>org.jboss.test.ws.jbws1698</package-type>
- <namespaceURI>http://test.jboss.org/ws/jbws1698</namespaceURI>
- </package-mapping>
- <java-xml-type-mapping>
- <java-type>org.jboss.test.ws.jbws1698.Person</java-type>
- <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:Person</root-type-qname>
- <qname-scope>complexType</qname-scope>
- <variable-mapping>
- <java-variable-name>firstName</java-variable-name>
- <xml-element-name>firstName</xml-element-name>
- </variable-mapping>
- <variable-mapping>
- <java-variable-name>surname</java-variable-name>
- <xml-element-name>surname</xml-element-name>
- </variable-mapping>
- </java-xml-type-mapping>
- <java-xml-type-mapping>
- <java-type>org.jboss.test.ws.jbws1698.TelephoneNumber</java-type>
- <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:TelephoneNumber</root-type-qname>
- <qname-scope>complexType</qname-scope>
- <variable-mapping>
- <java-variable-name>areaCode</java-variable-name>
- <xml-element-name>areaCode</xml-element-name>
- </variable-mapping>
- <variable-mapping>
- <java-variable-name>number</java-variable-name>
- <xml-element-name>number</xml-element-name>
- </variable-mapping>
- </java-xml-type-mapping>
- <java-xml-type-mapping>
- <java-type>org.jboss.test.ws.jbws1698.PhoneBookFault</java-type>
- <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:PhoneBookFault</root-type-qname>
- <qname-scope>complexType</qname-scope>
- </java-xml-type-mapping>
- <exception-mapping>
- <exception-type>org.jboss.test.ws.jbws1698.PhoneBookFault</exception-type>
- <wsdl-message xmlns:exMsgNS='http://test.jboss.org/ws/jbws1698'>exMsgNS:PhoneBookFault</wsdl-message>
- </exception-mapping>
- <service-interface-mapping>
- <service-interface>org.jboss.test.ws.jbws1698.PhoneBook_Service</service-interface>
- <wsdl-service-name xmlns:serviceNS='http://test.jboss.org/ws/jbws1698'>serviceNS:PhoneBook</wsdl-service-name>
- <port-mapping>
- <port-name>PhoneBookPort</port-name>
- <java-port-name>PhoneBookPort</java-port-name>
- </port-mapping>
- </service-interface-mapping>
- <service-endpoint-interface-mapping>
- <service-endpoint-interface>org.jboss.test.ws.jbws1698.PhoneBook_PortType</service-endpoint-interface>
- <wsdl-port-type xmlns:portTypeNS='http://test.jboss.org/ws/jbws1698'>portTypeNS:PhoneBook</wsdl-port-type>
- <wsdl-binding xmlns:bindingNS='http://test.jboss.org/ws/jbws1698'>bindingNS:PhoneBookBinding</wsdl-binding>
- <service-endpoint-method-mapping>
- <java-method-name>lookup</java-method-name>
- <wsdl-operation>lookup</wsdl-operation>
- <method-param-parts-mapping>
- <param-position>0</param-position>
- <param-type>org.jboss.test.ws.jbws1698.Person</param-type>
- <wsdl-message-mapping>
- <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookup</wsdl-message>
- <wsdl-message-part-name>lookup</wsdl-message-part-name>
- <parameter-mode>IN</parameter-mode>
- </wsdl-message-mapping>
- </method-param-parts-mapping>
- <wsdl-return-value-mapping>
- <method-return-value>org.jboss.test.ws.jbws1698.TelephoneNumber</method-return-value>
- <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookupResponse</wsdl-message>
- <wsdl-message-part-name>lookupResponse</wsdl-message-part-name>
- </wsdl-return-value-mapping>
- </service-endpoint-method-mapping>
- </service-endpoint-interface-mapping>
-</java-wsdl-mapping>
\ No newline at end of file
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,76 @@
+<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698/types</namespaceURI>
+ </package-mapping>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698</namespaceURI>
+ </package-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.Person</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:Person</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>firstName</java-variable-name>
+ <xml-element-name>firstName</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>surname</java-variable-name>
+ <xml-element-name>surname</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.TelephoneNumber</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:TelephoneNumber</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>areaCode</java-variable-name>
+ <xml-element-name>areaCode</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>number</java-variable-name>
+ <xml-element-name>number</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.PhoneBookFault</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:PhoneBookFault</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ </java-xml-type-mapping>
+ <exception-mapping>
+ <exception-type>org.jboss.test.ws.jbws1698.PhoneBookFault</exception-type>
+ <wsdl-message xmlns:exMsgNS='http://test.jboss.org/ws/jbws1698'>exMsgNS:PhoneBookFault</wsdl-message>
+ </exception-mapping>
+ <service-interface-mapping>
+ <service-interface>org.jboss.test.ws.jbws1698.PhoneBook_Service</service-interface>
+ <wsdl-service-name xmlns:serviceNS='http://test.jboss.org/ws/jbws1698'>serviceNS:PhoneBook</wsdl-service-name>
+ <port-mapping>
+ <port-name>PhoneBookPort</port-name>
+ <java-port-name>PhoneBookPort</java-port-name>
+ </port-mapping>
+ </service-interface-mapping>
+ <service-endpoint-interface-mapping>
+ <service-endpoint-interface>org.jboss.test.ws.jbws1698.PhoneBook_PortType</service-endpoint-interface>
+ <wsdl-port-type xmlns:portTypeNS='http://test.jboss.org/ws/jbws1698'>portTypeNS:PhoneBook</wsdl-port-type>
+ <wsdl-binding xmlns:bindingNS='http://test.jboss.org/ws/jbws1698'>bindingNS:PhoneBookBinding</wsdl-binding>
+ <service-endpoint-method-mapping>
+ <java-method-name>lookup</java-method-name>
+ <wsdl-operation>lookup</wsdl-operation>
+ <method-param-parts-mapping>
+ <param-position>0</param-position>
+ <param-type>org.jboss.test.ws.jbws1698.Person</param-type>
+ <wsdl-message-mapping>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookup</wsdl-message>
+ <wsdl-message-part-name>lookup</wsdl-message-part-name>
+ <parameter-mode>IN</parameter-mode>
+ </wsdl-message-mapping>
+ </method-param-parts-mapping>
+ <wsdl-return-value-mapping>
+ <method-return-value>org.jboss.test.ws.jbws1698.TelephoneNumber</method-return-value>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookupResponse</wsdl-message>
+ <wsdl-message-part-name>lookupResponse</wsdl-message-part-name>
+ </wsdl-return-value-mapping>
+ </service-endpoint-method-mapping>
+ </service-endpoint-interface-mapping>
+</java-wsdl-mapping>
\ No newline at end of file
Deleted: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -1,5 +0,0 @@
-<configuration>
- <wsdl-java location="resources/tools/jbws1698/fault/PhoneBook.wsdl" parameter-style="bare">
- <mapping file="jaxrpc-mapping.xml"/>
- </wsdl-java>
-</configuration>
Copied: trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml (from rev 3470, branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml)
===================================================================
--- trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml (rev 0)
+++ trunk/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml 2007-06-06 13:47:50 UTC (rev 3473)
@@ -0,0 +1,5 @@
+<configuration>
+ <wsdl-java location="resources/tools/jbws1698/fault/PhoneBook.wsdl" parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>
18 years, 10 months
JBossWS SVN: r3472 - trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-06 09:43:55 -0400 (Wed, 06 Jun 2007)
New Revision: 3472
Added:
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
Log:
Fix JBWS-1563
Added: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java (rev 0)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java 2007-06-06 13:43:55 UTC (rev 3472)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.wsdl;
+
+import com.ibm.wsdl.DefinitionImpl;
+import com.ibm.wsdl.extensions.PopulatedExtensionRegistry;
+import com.ibm.wsdl.xml.WSDLWriterImpl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+
+/**
+ * A fork of the original wsdl4j 1.6.2 package
+ * that delegates to the {@link JBossWSDLReaderImpl}.
+ * <p>
+ * Original author: Matthew J. Duftler (duftler(a)us.ibm.com)
+ *
+ * @version $Revision$
+ */
+public class JBossWSDLFactoryImpl extends WSDLFactory
+{
+ /**
+ * Create a new instance of a Definition, with an instance
+ * of a PopulatedExtensionRegistry as its ExtensionRegistry.
+ *
+ * @see com.ibm.wsdl.extensions.PopulatedExtensionRegistry
+ */
+ public Definition newDefinition()
+ {
+ Definition def = new DefinitionImpl();
+ ExtensionRegistry extReg = newPopulatedExtensionRegistry();
+
+ def.setExtensionRegistry(extReg);
+
+ return def;
+ }
+
+ /**
+ * Create a new instance of a WSDLReader.
+ */
+ public WSDLReader newWSDLReader()
+ {
+ return new JBossWSDLReaderImpl();
+ }
+
+ public WSDLWriter newWSDLWriter()
+ {
+ return new WSDLWriterImpl();
+ }
+
+ /**
+ * Create a new instance of an ExtensionRegistry with pre-registered
+ * serializers/deserializers for the SOAP, HTTP and MIME
+ * extensions. Java extensionTypes are also mapped for all
+ * the SOAP, HTTP and MIME extensions.
+ */
+ public ExtensionRegistry newPopulatedExtensionRegistry()
+ {
+ return new PopulatedExtensionRegistry();
+ }
+}
\ No newline at end of file
Property changes on: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java (rev 0)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java 2007-06-06 13:43:55 UTC (rev 3472)
@@ -0,0 +1,2372 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.wsdl;
+
+import com.ibm.wsdl.Constants;
+import com.ibm.wsdl.extensions.schema.SchemaConstants;
+import com.ibm.wsdl.util.StringUtils;
+import com.ibm.wsdl.util.xml.DOMUtils;
+import com.ibm.wsdl.util.xml.QNameUtils;
+import com.ibm.wsdl.util.xml.XPathUtils;
+import org.jboss.ws.core.utils.JBossWSEntityResolver;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.xml.sax.InputSource;
+
+import javax.wsdl.*;
+import javax.wsdl.extensions.AttributeExtensible;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionDeserializer;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.schema.SchemaReference;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.*;
+
+
+/**
+ * A WSDLReader fork of the original wsdl4j 1.6.2 package
+ * that delegates to the JBossWSEntityResolver in
+ * <code>private static Document getDocument(InputSource inputSource,String desc)</code>
+ * <p>
+ * Original authors: Matthew J. Duftler,Nirmal Mukhi
+ *
+ * @version $Revision$
+ */
+public class JBossWSDLReaderImpl implements WSDLReader
+{
+ // Used for determining the style of operations.
+ private static final List STYLE_ONE_WAY =
+ Arrays.asList(new String[]{Constants.ELEM_INPUT});
+ private static final List STYLE_REQUEST_RESPONSE =
+ Arrays.asList(new String[]{Constants.ELEM_INPUT, Constants.ELEM_OUTPUT});
+ private static final List STYLE_SOLICIT_RESPONSE =
+ Arrays.asList(new String[]{Constants.ELEM_OUTPUT, Constants.ELEM_INPUT});
+ private static final List STYLE_NOTIFICATION =
+ Arrays.asList(new String[]{Constants.ELEM_OUTPUT});
+
+ protected boolean verbose = true;
+ protected boolean importDocuments = true;
+ protected ExtensionRegistry extReg = null;
+ protected String factoryImplName = null;
+ protected WSDLLocator loc = null;
+ protected WSDLFactory factory = null;
+
+ //Contains all schemas used by this wsdl, either in-line or nested
+ //via wsdl imports or schema imports, includes or redefines
+ protected Map allSchemas = new Hashtable();
+
+
+ /**
+ * Sets the specified feature to the specified value.
+ * <p>
+ * The supported features are:
+ * <p>
+ * <table border=1>
+ * <tr>
+ * <th>Name</th>
+ * <th>Description</th>
+ * <th>Default Value</th>
+ * </tr>
+ * <tr>
+ * <td><center>javax.wsdl.verbose</center></td>
+ * <td>If set to true, status messages will be displayed.</td>
+ * <td><center>true</center></td>
+ * </tr>
+ * <tr>
+ * <td><center>javax.wsdl.importDocuments</center></td>
+ * <td>If set to true, imported WSDL documents will be
+ * retrieved and processed.</td>
+ * <td><center>true</center></td>
+ * </tr>
+ * </table>
+ * <p>
+ * All feature names must be fully-qualified, Java package style. All
+ * names starting with javax.wsdl. are reserved for features defined
+ * by the JWSDL specification. It is recommended that implementation-
+ * specific features be fully-qualified to match the package name
+ * of that implementation. For example: com.abc.featureName
+ *
+ * @param name the name of the feature to be set.
+ * @param value the value to set the feature to.
+ * @throws IllegalArgumentException if the feature name is not recognized.
+ * @see #getFeature(String)
+ */
+ public void setFeature(String name, boolean value)
+ throws IllegalArgumentException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("Feature name must not be null.");
+ }
+
+ if (name.equals(Constants.FEATURE_VERBOSE))
+ {
+ verbose = value;
+ }
+ else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS))
+ {
+ importDocuments = value;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Feature name '" + name +
+ "' not recognized.");
+ }
+ }
+
+ /**
+ * Gets the value of the specified feature.
+ *
+ * @param name the name of the feature to get the value of.
+ * @return the value of the feature.
+ * @throws IllegalArgumentException if the feature name is not recognized.
+ * @see #setFeature(String, boolean)
+ */
+ public boolean getFeature(String name) throws IllegalArgumentException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("Feature name must not be null.");
+ }
+
+ if (name.equals(Constants.FEATURE_VERBOSE))
+ {
+ return verbose;
+ }
+ else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS))
+ {
+ return importDocuments;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Feature name '" + name +
+ "' not recognized.");
+ }
+ }
+
+ /**
+ * Set the extension registry to be used when reading
+ * WSDL documents into a WSDL definition. If an
+ * extension registry is set, that is the extension
+ * registry that will be set as the extensionRegistry
+ * property of the definitions resulting from invoking
+ * readWSDL(...). Default is null.
+ *
+ * @param extReg the extension registry to use for new
+ * definitions
+ */
+ public void setExtensionRegistry(ExtensionRegistry extReg)
+ {
+ this.extReg = extReg;
+ }
+
+ /**
+ * Get the extension registry, if one was set. Default is
+ * null.
+ */
+ public ExtensionRegistry getExtensionRegistry()
+ {
+ return extReg;
+ }
+
+ /**
+ * Get the WSDLFactory object cached in the reader, or use lazy
+ * instantiation if it is not cached yet.
+ */
+ protected WSDLFactory getWSDLFactory() throws WSDLException
+ {
+ if (factory == null)
+ {
+ factory = (factoryImplName != null)
+ ? WSDLFactory.newInstance(factoryImplName)
+ : WSDLFactory.newInstance();
+ }
+ return factory;
+ }
+
+ /**
+ * Set a different factory implementation to use for
+ * creating definitions when reading WSDL documents.
+ * As some WSDLReader implementations may only be
+ * capable of creating definitions using the same
+ * factory implementation from which the reader was
+ * obtained, this method is optional. Default is null.
+ *
+ * @param factoryImplName the fully-qualified class name of the
+ * class which provides a concrete implementation of the abstract
+ * class WSDLFactory.
+ * @throws UnsupportedOperationException if this method
+ * is invoked on an implementation which does not
+ * support it.
+ */
+ public void setFactoryImplName(String factoryImplName)
+ throws UnsupportedOperationException
+ {
+ //check to see if we really need to change the factory name and clear the cache
+ if((this.factoryImplName == null && factoryImplName != null) ||
+ (this.factoryImplName != null && !this.factoryImplName.equals(factoryImplName)))
+ {
+ //the factory object is cached in the reader so set it
+ //to null if the factory impl name is reset.
+ this.factory = null;
+
+ this.factoryImplName = factoryImplName;
+ //if(verbose) System.out.println("WSDLFactory Impl Name set to : "+factoryImplName);
+ }
+ }
+
+ /**
+ * Get the factoryImplName, if one was set. Default is null.
+ */
+ public String getFactoryImplName()
+ {
+ return factoryImplName;
+ }
+
+ protected Definition parseDefinitions(String documentBaseURI,
+ Element defEl,
+ Map importedDefs)
+ throws WSDLException
+ {
+ checkElementName(defEl, Constants.Q_ELEM_DEFINITIONS);
+
+ WSDLFactory factory = getWSDLFactory();
+ Definition def = factory.newDefinition();
+
+ if (extReg != null)
+ {
+ def.setExtensionRegistry(extReg);
+ }
+
+ String name = DOMUtils.getAttribute(defEl, Constants.ATTR_NAME);
+ String targetNamespace = DOMUtils.getAttribute(defEl,
+ Constants.ATTR_TARGET_NAMESPACE);
+ NamedNodeMap attrs = defEl.getAttributes();
+
+ if (importedDefs == null)
+ {
+ importedDefs = new Hashtable();
+ }
+
+ if (documentBaseURI != null)
+ {
+ def.setDocumentBaseURI(documentBaseURI);
+ importedDefs.put(documentBaseURI, def);
+ }
+
+ if (name != null)
+ {
+ def.setQName(new QName(targetNamespace, name));
+ }
+
+ if (targetNamespace != null)
+ {
+ def.setTargetNamespace(targetNamespace);
+ }
+
+ int size = attrs.getLength();
+
+ for (int i = 0; i < size; i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ String namespaceURI = attr.getNamespaceURI();
+ String localPart = attr.getLocalName();
+ String value = attr.getValue();
+
+ if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS))
+ {
+ if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS))
+ {
+ def.addNamespace(localPart, value);
+ }
+ else
+ {
+ def.addNamespace(null, value);
+ }
+ }
+ }
+
+ Element tempEl = DOMUtils.getFirstChildElement(defEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_IMPORT, tempEl))
+ {
+ def.addImport(parseImport(tempEl, def, importedDefs));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ def.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_TYPES, tempEl))
+ {
+ def.setTypes(parseTypes(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_MESSAGE, tempEl))
+ {
+ def.addMessage(parseMessage(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_PORT_TYPE, tempEl))
+ {
+ def.addPortType(parsePortType(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_BINDING, tempEl))
+ {
+ def.addBinding(parseBinding(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_SERVICE, tempEl))
+ {
+ def.addService(parseService(tempEl, def));
+ }
+ else
+ {
+ def.addExtensibilityElement(
+ parseExtensibilityElement(Definition.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(defEl, Definition.class, def, def);
+
+ return def;
+ }
+
+ protected Import parseImport(Element importEl,
+ Definition def,
+ Map importedDefs)
+ throws WSDLException
+ {
+ Import importDef = def.createImport();
+
+ try
+ {
+ String namespaceURI = DOMUtils.getAttribute(importEl,
+ Constants.ATTR_NAMESPACE);
+ String locationURI = DOMUtils.getAttribute(importEl,
+ Constants.ATTR_LOCATION);
+ String contextURI = null;
+
+ if (namespaceURI != null)
+ {
+ importDef.setNamespaceURI(namespaceURI);
+ }
+
+ if (locationURI != null)
+ {
+ importDef.setLocationURI(locationURI);
+
+ if (importDocuments)
+ {
+ try
+ {
+ contextURI = def.getDocumentBaseURI();
+ Definition importedDef = null;
+ InputStream inputStream = null;
+ InputSource inputSource = null;
+ URL url = null;
+
+ if (loc != null)
+ {
+ inputSource = loc.getImportInputSource(contextURI, locationURI);
+
+ /*
+ We now have available the latest import URI. This might
+ differ from the locationURI so check the importedDefs for it
+ since it is this that we pass as the documentBaseURI later.
+ */
+ String liu = loc.getLatestImportURI();
+
+ importedDef = (Definition)importedDefs.get(liu);
+
+ inputSource.setSystemId(liu);
+ }
+ else
+ {
+ URL contextURL = (contextURI != null)
+ ? StringUtils.getURL(null, contextURI)
+ : null;
+
+ url = StringUtils.getURL(contextURL, locationURI);
+ importedDef = (Definition)importedDefs.get(url.toString());
+
+ if (importedDef == null)
+ {
+ inputStream = StringUtils.getContentAsInputStream(url);
+
+ if (inputStream != null)
+ {
+ inputSource = new InputSource(inputStream);
+ inputSource.setSystemId(url.toString());
+ }
+ }
+ }
+
+ if (importedDef == null)
+ {
+ if (inputSource == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate imported document " +
+ "at '" + locationURI + "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI +
+ "'."));
+ }
+
+ Document doc = getDocument(inputSource, inputSource.getSystemId());
+
+ if (inputStream != null)
+ {
+ inputStream.close();
+ }
+
+ Element documentElement = doc.getDocumentElement();
+
+ /*
+ Check if it's a wsdl document.
+ If it's not, don't retrieve and process it.
+ This should later be extended to allow other types of
+ documents to be retrieved and processed, such as schema
+ documents (".xsd"), etc...
+ */
+ if (QNameUtils.matches(Constants.Q_ELEM_DEFINITIONS,
+ documentElement))
+ {
+ if (verbose)
+ {
+ System.out.println("Retrieving document at '" + locationURI +
+ "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI + "'."));
+ }
+
+ String urlString =
+ (loc != null)
+ ? loc.getLatestImportURI()
+ : (url != null)
+ ? url.toString()
+ : locationURI;
+
+ importedDef = readWSDL(urlString,
+ documentElement,
+ importedDefs);
+ }
+ else
+ {
+ QName docElementQName = QNameUtils.newQName(documentElement);
+
+ if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName))
+ {
+ if (verbose)
+ {
+ System.out.println("Retrieving schema wsdl:imported from '" + locationURI +
+ "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI + "'."));
+ }
+
+ WSDLFactory factory = getWSDLFactory();
+
+ importedDef = factory.newDefinition();
+
+ if (extReg != null)
+ {
+ importedDef.setExtensionRegistry(extReg);
+ }
+
+ String urlString =
+ (loc != null)
+ ? loc.getLatestImportURI()
+ : (url != null)
+ ? url.toString()
+ : locationURI;
+
+ importedDef.setDocumentBaseURI(urlString);
+
+ Types types = importedDef.createTypes();
+ types.addExtensibilityElement(
+ parseSchema(Types.class, documentElement, importedDef));
+ importedDef.setTypes(types);
+ }
+ }
+ }
+
+ if (importedDef != null)
+ {
+ importDef.setDefinition(importedDef);
+ }
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to resolve imported document at '" +
+ locationURI +
+ (contextURI == null
+ ? "'." : "', relative to '" + contextURI + "'")
+ , e);
+ }
+ } //end importDocs
+ } //end locationURI
+
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(importEl));
+ }
+ else
+ {
+ //If definitions are being parsed recursively for nested imports
+ //the exception location must be built up recursively too so
+ //prepend this element's xpath to exception location.
+ String loc = XPathUtils.getXPathExprFromNode(importEl) + e.getLocation();
+ e.setLocation(loc);
+ }
+
+ throw e;
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = importEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(importEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ importDef.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ importDef.addExtensibilityElement(
+ parseExtensibilityElement(Import.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(importEl, Import.class, importDef, def);
+
+ return importDef;
+
+ }
+
+ protected Types parseTypes(Element typesEl, Definition def)
+ throws WSDLException
+ {
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = typesEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Types types = def.createTypes();
+ Element tempEl = DOMUtils.getFirstChildElement(typesEl);
+ QName tempElType;
+
+ while (tempEl != null)
+ {
+ tempElType = QNameUtils.newQName(tempEl);
+
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ types.setDocumentationElement(tempEl);
+ }
+ else if ((SchemaConstants.XSD_QNAME_LIST).contains(tempElType))
+ {
+ //the element qname indicates it is a schema.
+ types.addExtensibilityElement(
+ parseSchema(Types.class, tempEl, def));
+ }
+ else
+ {
+ types.addExtensibilityElement(
+ parseExtensibilityElement(Types.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(typesEl, Types.class, types, def);
+
+ return types;
+ }
+
+ protected ExtensibilityElement parseSchema( Class parentType,
+ Element el,
+ Definition def)
+ throws WSDLException
+ {
+ QName elementType = null;
+ ExtensionRegistry extReg = null;
+
+ try
+ {
+ extReg = def.getExtensionRegistry();
+
+ if (extReg == null)
+ {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+ "No ExtensionRegistry set for this " +
+ "Definition, so unable to deserialize " +
+ "a '" + elementType + "' element in the " +
+ "context of a '" + parentType.getName() +
+ "'.");
+ }
+
+ return parseSchema(parentType, el, def, extReg);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(el));
+ }
+
+ throw e;
+ }
+ }
+
+
+ protected ExtensibilityElement parseSchema( Class parentType,
+ Element el,
+ Definition def,
+ ExtensionRegistry extReg)
+ throws WSDLException
+ {
+ /*
+ * This method returns ExtensibilityElement rather than Schema because we
+ * do not insist that a suitable XSD schema deserializer is registered.
+ * PopulatedExtensionRegistry registers SchemaDeserializer by default, but
+ * if the user chooses not to register a suitable deserializer then the
+ * UnknownDeserializer will be used, returning an UnknownExtensibilityElement.
+ */
+
+ Schema schema = null;
+ SchemaReference schemaRef = null;
+ try
+ {
+
+ QName elementType = QNameUtils.newQName(el);
+
+ ExtensionDeserializer exDS =
+ extReg.queryDeserializer(parentType, elementType);
+
+ //Now unmarshall the DOM element.
+ ExtensibilityElement ee =
+ exDS.unmarshall(parentType, elementType, el, def, extReg);
+
+ if (ee instanceof Schema)
+ {
+ schema = (Schema) ee;
+ }
+ else
+ {
+ //Unknown extensibility element, so don't do any more schema parsing on it.
+ return ee;
+ }
+
+
+ //Keep track of parsed schemas to avoid duplicating Schema objects
+ //through duplicate or circular references (eg: A imports B imports A).
+ if (schema.getDocumentBaseURI() != null)
+ {
+ this.allSchemas.put(schema.getDocumentBaseURI(), schema);
+ }
+
+ //At this point, any SchemaReference objects held by the schema will not
+ //yet point to their referenced schemas, so we must now retrieve these
+ //schemas and set the schema references.
+
+ //First, combine the schema references for imports, includes and redefines
+ //into a single list
+
+ ArrayList allSchemaRefs = new ArrayList();
+
+ Collection ic = schema.getImports().values();
+ Iterator importsIterator = ic.iterator();
+ while(importsIterator.hasNext())
+ {
+ allSchemaRefs.addAll( (Collection) importsIterator.next() );
+ }
+
+ allSchemaRefs.addAll(schema.getIncludes());
+ allSchemaRefs.addAll(schema.getRedefines());
+
+ //Then, retrieve the schema referred to by each schema reference. If the
+ //schema has been read in previously, use the existing schema object.
+ //Otherwise unmarshall the DOM element into a new schema object.
+
+ ListIterator schemaRefIterator = allSchemaRefs.listIterator();
+
+ while(schemaRefIterator.hasNext())
+ {
+ try
+ {
+ schemaRef = (SchemaReference) schemaRefIterator.next();
+
+ if (schemaRef.getSchemaLocationURI() == null)
+ {
+ //cannot get the referenced schema, so ignore this schema reference
+ continue;
+ }
+
+ if (verbose)
+ {
+ System.out.println("Retrieving schema at '" +
+ schemaRef.getSchemaLocationURI() +
+ (schema.getDocumentBaseURI() == null
+ ? "'."
+ : "', relative to '" +
+ schema.getDocumentBaseURI() + "'."));
+ }
+
+
+ InputStream inputStream = null;
+ InputSource inputSource = null;
+
+ //This is the child schema referred to by the schemaReference
+ Schema referencedSchema = null;
+
+ //This is the child schema's location obtained from the WSDLLocator or the URL
+ String location = null;
+
+ if (loc != null)
+ {
+ //Try to get the referenced schema using the wsdl locator
+ inputSource = loc.getImportInputSource(
+ schema.getDocumentBaseURI(), schemaRef.getSchemaLocationURI());
+
+ if (inputSource == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate with a locator "
+ + "the schema referenced at '"
+ + schemaRef.getSchemaLocationURI()
+ + "' relative to document base '"
+ + schema.getDocumentBaseURI() + "'");
+ }
+ location = loc.getLatestImportURI();
+
+ //if a schema from this location has been read previously, use it.
+ referencedSchema = (Schema) this.allSchemas.get(location);
+ }
+ else
+ {
+ // We don't have a wsdl locator, so try to retrieve the schema by its URL
+ String contextURI = schema.getDocumentBaseURI();
+ URL contextURL = (contextURI != null) ? StringUtils.getURL(null, contextURI) : null;
+ URL url = StringUtils.getURL(contextURL, schemaRef.getSchemaLocationURI());
+ location = url.toExternalForm();
+
+ //if a schema from this location has been retrieved previously, use it.
+ referencedSchema = (Schema) this.allSchemas.get(location);
+
+ if (referencedSchema == null)
+ {
+ // We haven't read this schema in before so do it now
+ inputStream = StringUtils.getContentAsInputStream(url);
+
+ if (inputStream != null)
+ {
+ inputSource = new InputSource(inputStream);
+ }
+
+ if (inputSource == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate with a url "
+ + "the document referenced at '"
+ + schemaRef.getSchemaLocationURI()
+ + "'"
+ + (contextURI == null ? "." : ", relative to '"
+ + contextURI + "'."));
+ }
+ }
+
+ } //end if loc
+
+ // If we have not previously read the schema, get its DOM element now.
+ if (referencedSchema == null)
+ {
+ inputSource.setSystemId(location);
+ Document doc = getDocument(inputSource, location);
+
+ if (inputStream != null)
+ {
+ inputStream.close();
+ }
+
+ Element documentElement = doc.getDocumentElement();
+
+ // If it's a schema doc process it, otherwise the schema reference remains null
+
+ QName docElementQName = QNameUtils.newQName(documentElement);
+
+ if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName))
+ {
+ //We now need to call parseSchema recursively to parse the referenced
+ //schema. The document base URI of the referenced schema will be set to
+ //the document base URI of the current schema plus the schemaLocation in
+ //the schemaRef. We cannot explicitly pass in a new document base URI
+ //to the schema deserializer, so instead we will create a dummy
+ //Definition and set its documentBaseURI to the new document base URI.
+ //We can leave the other definition fields empty because we know
+ //that the SchemaDeserializer.unmarshall method uses the definition
+ //parameter only to get its documentBaseURI. If the unmarshall method
+ //implementation changes (ie: its use of definition changes) we may need
+ //to rethink this approach.
+
+ WSDLFactory factory = getWSDLFactory();
+ Definition dummyDef = factory.newDefinition();
+
+ dummyDef.setDocumentBaseURI(location);
+
+ //By this point, we know we have a SchemaDeserializer registered
+ //so we can safely cast the ExtensibilityElement to a Schema.
+ referencedSchema = (Schema) parseSchema( parentType,
+ documentElement,
+ dummyDef,
+ extReg);
+ }
+
+ } //end if referencedSchema
+
+ schemaRef.setReferencedSchema(referencedSchema);
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "An error occurred trying to resolve schema referenced at '"
+ + schemaRef.getSchemaLocationURI()
+ + "'"
+ + (schema.getDocumentBaseURI() == null ? "." : ", relative to '"
+ + schema.getDocumentBaseURI() + "'."),
+ e);
+ }
+
+ } //end while loop
+
+ return schema;
+
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(el));
+ }
+ else
+ {
+ //If this method has been called recursively for nested schemas
+ //the exception location must be built up recursively too so
+ //prepend this element's xpath to exception location.
+ String loc = XPathUtils.getXPathExprFromNode(el) + e.getLocation();
+ e.setLocation(loc);
+ }
+
+ throw e;
+ }
+
+ }
+
+
+ protected Binding parseBinding(Element bindingEl, Definition def)
+ throws WSDLException
+ {
+ Binding binding = null;
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingEl);
+ String name = DOMUtils.getAttribute(bindingEl, Constants.ATTR_NAME, remainingAttrs);
+ QName portTypeName = getQualifiedAttributeValue(bindingEl,
+ Constants.ATTR_TYPE,
+ Constants.ELEM_BINDING,
+ def,
+ remainingAttrs);
+
+ PortType portType = null;
+
+ if (name != null)
+ {
+ QName bindingName = new QName(def.getTargetNamespace(), name);
+
+ binding = def.getBinding(bindingName);
+
+ if (binding == null)
+ {
+ binding = def.createBinding();
+ binding.setQName(bindingName);
+ }
+ }
+ else
+ {
+ binding = def.createBinding();
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ binding.setUndefined(false);
+
+ if (portTypeName != null)
+ {
+ portType = def.getPortType(portTypeName);
+
+ if (portType == null)
+ {
+ portType = def.createPortType();
+ portType.setQName(portTypeName);
+ def.addPortType(portType);
+ }
+
+ binding.setPortType(portType);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ binding.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl))
+ {
+ binding.addBindingOperation(parseBindingOperation(tempEl,
+ portType,
+ def));
+ }
+ else
+ {
+ binding.addExtensibilityElement(parseExtensibilityElement(
+ Binding.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ return binding;
+ }
+
+ protected BindingOperation parseBindingOperation(
+ Element bindingOperationEl,
+ PortType portType,
+ Definition def)
+ throws WSDLException
+ {
+ BindingOperation bindingOperation = def.createBindingOperation();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingOperationEl);
+ String name = DOMUtils.getAttribute(bindingOperationEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingOperation.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingOperationEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingOperationEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingOperation.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl))
+ {
+ bindingOperation.setBindingInput(parseBindingInput(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl))
+ {
+ bindingOperation.setBindingOutput(parseBindingOutput(tempEl, def));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl))
+ {
+ bindingOperation.addBindingFault(parseBindingFault(tempEl, def));
+ }
+ else
+ {
+ bindingOperation.addExtensibilityElement(
+ parseExtensibilityElement(BindingOperation.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ if (portType != null)
+ {
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+ String inputName = (bindingInput != null
+ ? (bindingInput.getName() != null ? bindingInput.getName() : Constants.NONE)
+ : null);
+ String outputName = (bindingOutput != null
+ ? (bindingOutput.getName() != null ? bindingOutput.getName() : Constants.NONE)
+ : null);
+ Operation op = portType.getOperation(name, inputName, outputName);
+
+ /*
+ * If the bindingOp input or output message names are null we will search first
+ * for a porttypeOp with corresponding unnamed input or output messages (using
+ * Constants.NONE for inputName or outputName, as above).
+ * However, input and output message names need not be used at all if operation
+ * overloading is not used, so if no match was found we will try again ignoring
+ * these unnamed messages from the search criteria (i.e. using null instead of
+ * Constants.NONE for inputName or outputName).
+ */
+
+ if(op == null)
+ {
+ if(Constants.NONE.equals(inputName) && Constants.NONE.equals(outputName))
+ {
+ //There was no porttype op with unnamed input and output messages,
+ //so ignore input and output name and search on the op name only.
+ op = portType.getOperation(name, null, null);
+ }
+ else if(Constants.NONE.equals(inputName))
+ {
+ //There was no porttype op with an unnamed input message,
+ //so ignore input name and search on the op name and output name only.
+ op = portType.getOperation(name, null, outputName);
+ }
+ else if(Constants.NONE.equals(outputName))
+ {
+ //There was no porttype op with an unnamed output message,
+ //so ignore output name and search on the op name and input name only.
+ op = portType.getOperation(name, inputName, null);
+ }
+ }
+
+ if (op == null)
+ {
+ Input input = def.createInput();
+ Output output = def.createOutput();
+
+ op = def.createOperation();
+ op.setName(name);
+ input.setName(inputName);
+ output.setName(outputName);
+ op.setInput(input);
+ op.setOutput(output);
+ portType.addOperation(op);
+ }
+
+ bindingOperation.setOperation(op);
+ }
+
+ parseExtensibilityAttributes(bindingOperationEl, BindingOperation.class, bindingOperation, def);
+
+ return bindingOperation;
+ }
+
+ protected BindingInput parseBindingInput(Element bindingInputEl,
+ Definition def)
+ throws WSDLException
+ {
+ BindingInput bindingInput = def.createBindingInput();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingInputEl);
+ String name = DOMUtils.getAttribute(bindingInputEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingInput.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingInputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingInputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingInput.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ bindingInput.addExtensibilityElement(
+ parseExtensibilityElement(BindingInput.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ return bindingInput;
+ }
+
+ protected BindingOutput parseBindingOutput(Element bindingOutputEl,
+ Definition def)
+ throws WSDLException
+ {
+ BindingOutput bindingOutput = def.createBindingOutput();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingOutputEl);
+ String name = DOMUtils.getAttribute(bindingOutputEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingOutput.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingOutputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingOutputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingOutput.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ bindingOutput.addExtensibilityElement(
+ parseExtensibilityElement(BindingOutput.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ return bindingOutput;
+ }
+
+ protected BindingFault parseBindingFault(Element bindingFaultEl,
+ Definition def)
+ throws WSDLException
+ {
+ BindingFault bindingFault = def.createBindingFault();
+
+ List remainingAttrs = DOMUtils.getAttributes(bindingFaultEl);
+ String name = DOMUtils.getAttribute(bindingFaultEl,
+ Constants.ATTR_NAME,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ bindingFault.setName(name);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = bindingFaultEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(bindingFaultEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ bindingFault.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ bindingFault.addExtensibilityElement(
+ parseExtensibilityElement(BindingFault.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(bindingFaultEl, BindingFault.class, bindingFault, def);
+
+ return bindingFault;
+ }
+
+ protected Message parseMessage(Element msgEl, Definition def)
+ throws WSDLException
+ {
+ Message msg = null;
+
+ List remainingAttrs = DOMUtils.getAttributes(msgEl);
+ String name = DOMUtils.getAttribute(msgEl, Constants.ATTR_NAME, remainingAttrs);
+
+ if (name != null)
+ {
+ QName messageName = new QName(def.getTargetNamespace(), name);
+
+ msg = def.getMessage(messageName);
+
+ if (msg == null)
+ {
+ msg = def.createMessage();
+ msg.setQName(messageName);
+ }
+ }
+ else
+ {
+ msg = def.createMessage();
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ msg.setUndefined(false);
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = msgEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(msgEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ msg.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_PART, tempEl))
+ {
+ msg.addPart(parsePart(tempEl, def));
+ }
+ else
+ {
+ msg.addExtensibilityElement(
+ parseExtensibilityElement(Message.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(msgEl, Message.class, msg, def);
+
+ return msg;
+ }
+
+ protected Part parsePart(Element partEl, Definition def)
+ throws WSDLException
+ {
+ Part part = def.createPart();
+ String name = DOMUtils.getAttribute(partEl, Constants.ATTR_NAME);
+ QName elementName = getQualifiedAttributeValue(partEl,
+ Constants.ATTR_ELEMENT,
+ Constants.ELEM_MESSAGE,
+ def);
+ QName typeName = getQualifiedAttributeValue(partEl,
+ Constants.ATTR_TYPE,
+ Constants.ELEM_MESSAGE,
+ def);
+
+ if (name != null)
+ {
+ part.setName(name);
+ }
+
+ if (elementName != null)
+ {
+ part.setElementName(elementName);
+ }
+
+ if (typeName != null)
+ {
+ part.setTypeName(typeName);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = partEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(partEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ part.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ part.addExtensibilityElement(
+ parseExtensibilityElement(Part.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(partEl, Part.class, part, def);
+
+ return part;
+ }
+
+ protected void parseExtensibilityAttributes(Element el,
+ Class parentType,
+ AttributeExtensible attrExt,
+ Definition def)
+ throws WSDLException
+ {
+ List nativeAttributeNames = attrExt.getNativeAttributeNames();
+ NamedNodeMap nodeMap = el.getAttributes();
+ int length = nodeMap.getLength();
+
+ for (int i = 0; i < length; i++)
+ {
+ Attr attribute = (Attr)nodeMap.item(i);
+ String localName = attribute.getLocalName();
+ String namespaceURI = attribute.getNamespaceURI();
+ String prefix = attribute.getPrefix();
+ QName qname = new QName(namespaceURI, localName);
+
+ if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL))
+ {
+ if (!namespaceURI.equals(Constants.NS_URI_XMLNS))
+ {
+ DOMUtils.registerUniquePrefix(prefix, namespaceURI, def);
+
+ String strValue = attribute.getValue();
+ int attrType = AttributeExtensible.NO_DECLARED_TYPE;
+ ExtensionRegistry extReg = def.getExtensionRegistry();
+
+ if (extReg != null)
+ {
+ attrType = extReg.queryExtensionAttributeType(parentType, qname);
+ }
+
+ Object val = parseExtensibilityAttribute(el, attrType, strValue, def);
+
+ attrExt.setExtensionAttribute(qname, val);
+ }
+ }
+ else if (!nativeAttributeNames.contains(localName))
+ {
+ WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
+ "Encountered illegal " +
+ "extension attribute '" +
+ qname + "'. Extension " +
+ "attributes must be in " +
+ "a namespace other than " +
+ "WSDL's.");
+
+ wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
+
+ throw wsdlExc;
+ }
+ }
+ }
+
+ protected Object parseExtensibilityAttribute(Element el,
+ int attrType,
+ String attrValue,
+ Definition def)
+ throws WSDLException
+ {
+ if (attrType == AttributeExtensible.QNAME_TYPE)
+ {
+ return DOMUtils.getQName(attrValue, el, def);
+ }
+ else if (attrType == AttributeExtensible.LIST_OF_STRINGS_TYPE)
+ {
+ return StringUtils.parseNMTokens(attrValue);
+ }
+ else if (attrType == AttributeExtensible.LIST_OF_QNAMES_TYPE)
+ {
+ List oldList = StringUtils.parseNMTokens(attrValue);
+ int size = oldList.size();
+ List newList = new Vector(size);
+
+ for (int i = 0; i < size; i++)
+ {
+ String str = (String)oldList.get(i);
+ QName qValue = DOMUtils.getQName(str, el, def);
+
+ newList.add(qValue);
+ }
+
+ return newList;
+ }
+ else if (attrType == AttributeExtensible.STRING_TYPE)
+ {
+ return attrValue;
+ }
+ else
+ {
+ QName qValue = null;
+
+ try
+ {
+ qValue = DOMUtils.getQName(attrValue, el, def);
+ }
+ catch (WSDLException e)
+ {
+ qValue = new QName(attrValue);
+ }
+
+ return qValue;
+ }
+ }
+
+ protected PortType parsePortType(Element portTypeEl, Definition def)
+ throws WSDLException
+ {
+ PortType portType = null;
+ String name = DOMUtils.getAttribute(portTypeEl, Constants.ATTR_NAME);
+
+ if (name != null)
+ {
+ QName portTypeName = new QName(def.getTargetNamespace(), name);
+
+ portType = def.getPortType(portTypeName);
+
+ if (portType == null)
+ {
+ portType = def.createPortType();
+ portType.setQName(portTypeName);
+ }
+ }
+ else
+ {
+ portType = def.createPortType();
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ portType.setUndefined(false);
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = portTypeEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(portTypeEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ portType.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl))
+ {
+ Operation op = parseOperation(tempEl, portType, def);
+
+ if (op != null)
+ {
+ portType.addOperation(op);
+ }
+ }
+ else
+ {
+ portType.addExtensibilityElement(
+ parseExtensibilityElement(PortType.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(portTypeEl, PortType.class, portType, def);
+
+ return portType;
+ }
+
+ protected Operation parseOperation(Element opEl,
+ PortType portType,
+ Definition def)
+ throws WSDLException
+ {
+ Operation op = null;
+
+ List remainingAttrs = DOMUtils.getAttributes(opEl);
+ String name = DOMUtils.getAttribute(opEl, Constants.ATTR_NAME, remainingAttrs);
+ String parameterOrderStr = DOMUtils.getAttribute(opEl,
+ Constants.ATTR_PARAMETER_ORDER,
+ remainingAttrs);
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = opEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(opEl);
+ List messageOrder = new Vector();
+ Element docEl = null;
+ Input input = null;
+ Output output = null;
+ List faults = new Vector();
+ List extElements = new Vector();
+ boolean retrieved = true;
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ docEl = tempEl;
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl))
+ {
+ input = parseInput(tempEl, def);
+ messageOrder.add(Constants.ELEM_INPUT);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl))
+ {
+ output = parseOutput(tempEl, def);
+ messageOrder.add(Constants.ELEM_OUTPUT);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl))
+ {
+ faults.add(parseFault(tempEl, def));
+ }
+ else
+ {
+ extElements.add(
+ parseExtensibilityElement(Operation.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ if (name != null)
+ {
+ String inputName = (input != null
+ ? (input.getName() != null ? input.getName() : Constants.NONE)
+ : null);
+ String outputName = (output != null
+ ? (output.getName() != null ? output.getName() : Constants.NONE)
+ : null);
+
+ op = portType.getOperation(name, inputName, outputName);
+
+ if (op != null && !op.isUndefined())
+ {
+ op = null;
+ }
+
+ if (op != null)
+ {
+ if (inputName == null)
+ {
+ Input tempIn = op.getInput();
+
+ if (tempIn != null)
+ {
+ if (tempIn.getName() != null)
+ {
+ op = null;
+ }
+ }
+ }
+ }
+
+ if (op != null)
+ {
+ if (outputName == null)
+ {
+ Output tempOut = op.getOutput();
+
+ if (tempOut != null)
+ {
+ if (tempOut.getName() != null)
+ {
+ op = null;
+ }
+ }
+ }
+ }
+
+ if (op == null)
+ {
+ op = def.createOperation();
+ op.setName(name);
+ retrieved = false;
+ }
+ }
+ else
+ {
+ op = def.createOperation();
+ retrieved = false;
+ }
+
+ // Whether it was retrieved or created, the definition has been found.
+ op.setUndefined(false);
+
+ if (parameterOrderStr != null)
+ {
+ op.setParameterOrdering(StringUtils.parseNMTokens(parameterOrderStr));
+ }
+
+ if (docEl != null)
+ {
+ op.setDocumentationElement(docEl);
+ }
+
+ if (input != null)
+ {
+ op.setInput(input);
+ }
+
+ if (output != null)
+ {
+ op.setOutput(output);
+ }
+
+ if (faults.size() > 0)
+ {
+ Iterator faultIterator = faults.iterator();
+
+ while (faultIterator.hasNext())
+ {
+ op.addFault((Fault)faultIterator.next());
+ }
+ }
+
+ if (extElements.size() > 0)
+ {
+ Iterator eeIterator = extElements.iterator();
+
+ while (eeIterator.hasNext())
+ {
+ op.addExtensibilityElement(
+ (ExtensibilityElement) eeIterator.next() );
+ }
+ }
+
+ OperationType style = null;
+
+ if (messageOrder.equals(STYLE_ONE_WAY))
+ {
+ style = OperationType.ONE_WAY;
+ }
+ else if (messageOrder.equals(STYLE_REQUEST_RESPONSE))
+ {
+ style = OperationType.REQUEST_RESPONSE;
+ }
+ else if (messageOrder.equals(STYLE_SOLICIT_RESPONSE))
+ {
+ style = OperationType.SOLICIT_RESPONSE;
+ }
+ else if (messageOrder.equals(STYLE_NOTIFICATION))
+ {
+ style = OperationType.NOTIFICATION;
+ }
+
+ if (style != null)
+ {
+ op.setStyle(style);
+ }
+
+ if (retrieved)
+ {
+ op = null;
+ }
+
+ parseExtensibilityAttributes(opEl, Operation.class, op, def);
+
+ return op;
+ }
+
+ protected Service parseService(Element serviceEl, Definition def)
+ throws WSDLException
+ {
+ Service service = def.createService();
+
+ List remainingAttrs = DOMUtils.getAttributes(serviceEl);
+ String name = DOMUtils.getAttribute(serviceEl, Constants.ATTR_NAME, remainingAttrs);
+
+ if (name != null)
+ {
+ service.setQName(new QName(def.getTargetNamespace(), name));
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = serviceEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(serviceEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ service.setDocumentationElement(tempEl);
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_PORT, tempEl))
+ {
+ service.addPort(parsePort(tempEl, def));
+ }
+ else
+ {
+ service.addExtensibilityElement(
+ parseExtensibilityElement(Service.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(serviceEl, Service.class, service, def);
+
+ return service;
+ }
+
+ protected Port parsePort(Element portEl, Definition def)
+ throws WSDLException
+ {
+ Port port = def.createPort();
+
+ List remainingAttrs = DOMUtils.getAttributes(portEl);
+ String name = DOMUtils.getAttribute(portEl, Constants.ATTR_NAME, remainingAttrs);
+ QName bindingStr = getQualifiedAttributeValue(portEl,
+ Constants.ATTR_BINDING,
+ Constants.ELEM_PORT,
+ def,
+ remainingAttrs);
+
+ if (name != null)
+ {
+ port.setName(name);
+ }
+
+ if (bindingStr != null)
+ {
+ Binding binding = def.getBinding(bindingStr);
+
+ if (binding == null)
+ {
+ binding = def.createBinding();
+ binding.setQName(bindingStr);
+ def.addBinding(binding);
+ }
+
+ port.setBinding(binding);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = portEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(portEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ port.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ port.addExtensibilityElement(parseExtensibilityElement(Port.class,
+ tempEl,
+ def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(portEl, Port.class, port, def);
+
+ return port;
+ }
+
+ protected ExtensibilityElement parseExtensibilityElement(
+ Class parentType,
+ Element el,
+ Definition def)
+ throws WSDLException
+ {
+ QName elementType = QNameUtils.newQName(el);
+
+ String namespaceURI = el.getNamespaceURI();
+
+ try
+ {
+ if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_WSDL))
+ {
+ throw new WSDLException(WSDLException.INVALID_WSDL,
+ "Encountered illegal extension element '" +
+ elementType +
+ "' in the context of a '" +
+ parentType.getName() +
+ "'. Extension elements must be in " +
+ "a namespace other than WSDL's.");
+ }
+
+ ExtensionRegistry extReg = def.getExtensionRegistry();
+
+ if (extReg == null)
+ {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+ "No ExtensionRegistry set for this " +
+ "Definition, so unable to deserialize " +
+ "a '" + elementType + "' element in the " +
+ "context of a '" + parentType.getName() +
+ "'.");
+ }
+
+ ExtensionDeserializer extDS = extReg.queryDeserializer(parentType,
+ elementType);
+
+ return extDS.unmarshall(parentType, elementType, el, def, extReg);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getLocation() == null)
+ {
+ e.setLocation(XPathUtils.getXPathExprFromNode(el));
+ }
+
+ throw e;
+ }
+ }
+
+ protected Input parseInput(Element inputEl, Definition def)
+ throws WSDLException
+ {
+ Input input = def.createInput();
+ String name = DOMUtils.getAttribute(inputEl, Constants.ATTR_NAME);
+ QName messageName = getQualifiedAttributeValue(inputEl,
+ Constants.ATTR_MESSAGE,
+ Constants.ELEM_INPUT,
+ def);
+
+ if (name != null)
+ {
+ input.setName(name);
+ }
+
+ if (messageName != null)
+ {
+ Message message = def.getMessage(messageName);
+
+ if (message == null)
+ {
+ message = def.createMessage();
+ message.setQName(messageName);
+ def.addMessage(message);
+ }
+
+ input.setMessage(message);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = inputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(inputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ input.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ input.addExtensibilityElement(
+ parseExtensibilityElement(Input.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(inputEl, Input.class, input, def);
+
+ return input;
+ }
+
+ protected Output parseOutput(Element outputEl, Definition def)
+ throws WSDLException
+ {
+ Output output = def.createOutput();
+ String name = DOMUtils.getAttribute(outputEl, Constants.ATTR_NAME);
+ QName messageName = getQualifiedAttributeValue(outputEl,
+ Constants.ATTR_MESSAGE,
+ Constants.ELEM_OUTPUT,
+ def);
+
+ if (name != null)
+ {
+ output.setName(name);
+ }
+
+ if (messageName != null)
+ {
+ Message message = def.getMessage(messageName);
+
+ if (message == null)
+ {
+ message = def.createMessage();
+ message.setQName(messageName);
+ def.addMessage(message);
+ }
+
+ output.setMessage(message);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = outputEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(outputEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ output.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ output.addExtensibilityElement(
+ parseExtensibilityElement(Output.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(outputEl, Output.class, output, def);
+
+ return output;
+ }
+
+ protected Fault parseFault(Element faultEl, Definition def)
+ throws WSDLException
+ {
+ Fault fault = def.createFault();
+ String name = DOMUtils.getAttribute(faultEl, Constants.ATTR_NAME);
+ QName messageName = getQualifiedAttributeValue(faultEl,
+ Constants.ATTR_MESSAGE,
+ Constants.ELEM_FAULT,
+ def);
+
+ if (name != null)
+ {
+ fault.setName(name);
+ }
+
+ if (messageName != null)
+ {
+ Message message = def.getMessage(messageName);
+
+ if (message == null)
+ {
+ message = def.createMessage();
+ message.setQName(messageName);
+ def.addMessage(message);
+ }
+
+ fault.setMessage(message);
+ }
+
+ //register any NS decls with the Definition
+ NamedNodeMap attrs = faultEl.getAttributes();
+ registerNSDeclarations(attrs, def);
+
+ Element tempEl = DOMUtils.getFirstChildElement(faultEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ fault.setDocumentationElement(tempEl);
+ }
+ else
+ {
+ fault.addExtensibilityElement(
+ parseExtensibilityElement(Fault.class, tempEl, def));
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
+
+ parseExtensibilityAttributes(faultEl, Fault.class, fault, def);
+
+ return fault;
+ }
+
+ /**
+ * This method should be used for elements that support extension
+ * attributes because it does not track unexpected remaining attributes.
+ */
+ private static QName getQualifiedAttributeValue(Element el,
+ String attrName,
+ String elDesc,
+ Definition def)
+ throws WSDLException
+ {
+ try
+ {
+ return DOMUtils.getQualifiedAttributeValue(el,
+ attrName,
+ elDesc,
+ false,
+ def);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED))
+ {
+ String attrValue = DOMUtils.getAttribute(el, attrName);
+
+ return new QName(attrValue);
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * This method should be used for elements that do not support extension
+ * attributes because it tracks unexpected remaining attributes.
+ */
+ private static QName getQualifiedAttributeValue(Element el,
+ String attrName,
+ String elDesc,
+ Definition def,
+ List remainingAttrs)
+ throws WSDLException
+ {
+ try
+ {
+ return DOMUtils.getQualifiedAttributeValue(el,
+ attrName,
+ elDesc,
+ false,
+ def,
+ remainingAttrs);
+ }
+ catch (WSDLException e)
+ {
+ if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED))
+ {
+ String attrValue = DOMUtils.getAttribute(el, attrName, remainingAttrs);
+
+ return new QName(attrValue);
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ private static void checkElementName(Element el, QName qname)
+ throws WSDLException
+ {
+ if (!QNameUtils.matches(qname, el))
+ {
+ WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
+ "Expected element '" +
+ qname + "'.");
+
+ wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
+
+ throw wsdlExc;
+ }
+ }
+
+ private static Document getDocument(InputSource inputSource,
+ String desc) throws WSDLException
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+
+ try
+ {
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setEntityResolver( new JBossWSEntityResolver() );
+ Document doc = builder.parse(inputSource);
+
+ return doc;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.PARSER_ERROR,
+ "Problem parsing '" + desc + "'.",
+ e);
+ }
+ }
+
+ private static void registerNSDeclarations(NamedNodeMap attrs, Definition def)
+ {
+ int size = attrs.getLength();
+
+ for (int i = 0; i < size; i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ String namespaceURI = attr.getNamespaceURI();
+ String localPart = attr.getLocalName();
+ String value = attr.getValue();
+
+ if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS))
+ {
+ if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS))
+ {
+ DOMUtils.registerUniquePrefix(localPart, value, def);
+ }
+ else
+ {
+ DOMUtils.registerUniquePrefix(null, value, def);
+ }
+ }
+ }
+ }
+
+ /**
+ * Read the WSDL document accessible via the specified
+ * URI into a WSDL definition.
+ *
+ * @param wsdlURI a URI (can be a filename or URL) pointing to a
+ * WSDL XML definition.
+ * @return the definition.
+ */
+ public Definition readWSDL(String wsdlURI) throws WSDLException
+ {
+ return readWSDL(null, wsdlURI);
+ }
+
+ /**
+ * Read the WSDL document accessible via the specified
+ * URI into a WSDL definition.
+ *
+ * @param contextURI the context in which to resolve the
+ * wsdlURI, if the wsdlURI is relative. Can be null, in which
+ * case it will be ignored.
+ * @param wsdlURI a URI (can be a filename or URL) pointing to a
+ * WSDL XML definition.
+ * @return the definition.
+ */
+ public Definition readWSDL(String contextURI, String wsdlURI)
+ throws WSDLException
+ {
+ try
+ {
+ if (verbose)
+ {
+ System.out.println("Retrieving document at '" + wsdlURI + "'" +
+ (contextURI == null
+ ? "."
+ : ", relative to '" + contextURI + "'."));
+ }
+
+ URL contextURL = (contextURI != null)
+ ? StringUtils.getURL(null, contextURI)
+ : null;
+ URL url = StringUtils.getURL(contextURL, wsdlURI);
+ InputStream inputStream = StringUtils.getContentAsInputStream(url);
+ InputSource inputSource = new InputSource(inputStream);
+ inputSource.setSystemId(url.toString());
+ Document doc = getDocument(inputSource, url.toString());
+
+ inputStream.close();
+
+ Definition def = readWSDL(url.toString(), doc);
+
+ return def;
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to resolve imported document at '" +
+ wsdlURI +
+ (contextURI == null
+ ? "'."
+ : "', relative to '" + contextURI + "'.")
+ , e);
+ }
+ }
+
+ /**
+ * Read the specified <wsdl:definitions> element into a WSDL
+ * definition.
+ *
+ * @param documentBaseURI the document base URI of the WSDL definition
+ * described by the element. Will be set as the documentBaseURI
+ * of the returned Definition. Can be null, in which case it
+ * will be ignored.
+ * @param definitionsElement the <wsdl:definitions> element
+ * @return the definition described by the element.
+ */
+ public Definition readWSDL(String documentBaseURI,
+ Element definitionsElement)
+ throws WSDLException
+ {
+ return readWSDL(documentBaseURI, definitionsElement, null);
+ }
+
+ /**
+ * Read the specified <wsdl:definitions> element into a WSDL
+ * definition. The WSDLLocator is used to provide the document
+ * base URIs. The InputSource of the WSDLLocator is ignored, instead
+ * the WSDL is parsed from the given Element.
+ *
+ * @param locator A WSDLLocator object used to provide
+ * the document base URI of the WSDL definition described by the
+ * element.
+ * @param definitionsElement the <wsdl:definitions> element
+ * @return the definition described by the element.
+ */
+ public Definition readWSDL(WSDLLocator locator,
+ Element definitionsElement)
+ throws WSDLException
+ {
+ try
+ {
+ this.loc = locator;
+ return readWSDL(locator.getBaseURI(), definitionsElement, null);
+ }
+ finally
+ {
+ locator.close();
+ this.loc = null;
+ }
+ }
+
+ protected Definition readWSDL(String documentBaseURI,
+ Element definitionsElement,
+ Map importedDefs)
+ throws WSDLException
+ {
+ return parseDefinitions(documentBaseURI, definitionsElement, importedDefs);
+ }
+
+ /**
+ * Read the specified WSDL document into a WSDL definition.
+ *
+ * @param documentBaseURI the document base URI of the WSDL definition
+ * described by the document. Will be set as the documentBaseURI
+ * of the returned Definition. Can be null, in which case it
+ * will be ignored.
+ * @param wsdlDocument the WSDL document, an XML
+ * document obeying the WSDL schema.
+ * @return the definition described in the document.
+ */
+ public Definition readWSDL(String documentBaseURI, Document wsdlDocument)
+ throws WSDLException
+ {
+ return readWSDL(documentBaseURI, wsdlDocument.getDocumentElement());
+ }
+
+ /**
+ * Read a WSDL document into a WSDL definition.
+ *
+ * @param documentBaseURI the document base URI of the WSDL definition
+ * described by the document. Will be set as the documentBaseURI
+ * of the returned Definition. Can be null, in which case it
+ * will be ignored.
+ * @param inputSource an InputSource pointing to the
+ * WSDL document, an XML document obeying the WSDL schema.
+ * @return the definition described in the document pointed to
+ * by the InputSource.
+ */
+ public Definition readWSDL(String documentBaseURI, InputSource inputSource)
+ throws WSDLException
+ {
+ String location = (inputSource.getSystemId() != null ?
+ inputSource.getSystemId() : "- WSDL Document -");
+
+ return readWSDL(documentBaseURI,
+ getDocument(inputSource, location));
+ }
+
+ /**
+ * Read a WSDL document into a WSDL definition.
+ *
+ * @param locator A WSDLLocator object used to provide InputSources
+ * pointing to the wsdl file.
+ * @return the definition described in the document
+ */
+ public Definition readWSDL(WSDLLocator locator) throws WSDLException
+ {
+ InputSource is = locator.getBaseInputSource();
+ String base = locator.getBaseURI();
+
+ if (is == null)
+ {
+ throw new WSDLException(WSDLException.OTHER_ERROR,
+ "Unable to locate document at '" + base + "'.");
+ }
+ is.setSystemId(base);
+
+ this.loc = locator;
+
+ if (verbose)
+ {
+ System.out.println("Retrieving document at '" + base + "'.");
+ }
+
+ try
+ {
+ return readWSDL(base, is);
+ }
+ finally
+ {
+ this.loc.close();
+ this.loc = null;
+ }
+ }
+}
+
Property changes on: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2007-06-06 13:41:06 UTC (rev 3471)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2007-06-06 13:43:55 UTC (rev 3472)
@@ -23,19 +23,6 @@
// $Id$
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.ConnectException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.parsers.DocumentBuilder;
-
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.utils.JBossWSEntityResolver;
@@ -47,6 +34,18 @@
import org.w3c.dom.Element;
import org.xml.sax.EntityResolver;
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.parsers.DocumentBuilder;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.ConnectException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* A factory that creates a <code>WSDLDefinitions</code> object from an URL.
*
@@ -59,138 +58,137 @@
*/
public class WSDLDefinitionsFactory
{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
- // This feature is set by default in wsdl4j, it means the object structure contains the imported arguments
- public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments";
- // Set this feature for additional debugging output
- public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
+ // This feature is set by default in wsdl4j, it means the object structure contains the imported arguments
+ public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments";
+ // Set this feature for additional debugging output
+ public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
- // The WSDL reader features
- private Map features = new HashMap();
+ // The WSDL reader features
+ private Map features = new HashMap();
- // Hide constructor
- private WSDLDefinitionsFactory()
- {
- }
+ // Hide constructor
+ private WSDLDefinitionsFactory()
+ {
+ }
- /**
- * Create a new instance of a wsdl factory
- */
- public static WSDLDefinitionsFactory newInstance()
- {
- return new WSDLDefinitionsFactory();
- }
+ /**
+ * Create a new instance of a wsdl factory
+ */
+ public static WSDLDefinitionsFactory newInstance()
+ {
+ return new WSDLDefinitionsFactory();
+ }
- /**
- * Set a feature on the underlying reader
- */
- public void setFeature(String name, boolean value) throws IllegalArgumentException
- {
- features.put(name, new Boolean(value));
- }
+ /**
+ * Set a feature on the underlying reader
+ */
+ public void setFeature(String name, boolean value) throws IllegalArgumentException
+ {
+ features.put(name, new Boolean(value));
+ }
- /**
- * Read the wsdl document from the given URL
- */
- public WSDLDefinitions parse(URL wsdlLocation) throws WSDLException
- {
- if (wsdlLocation == null)
- throw new IllegalArgumentException("URL cannot be null");
+ /**
+ * Read the wsdl document from the given URL
+ */
+ public WSDLDefinitions parse(URL wsdlLocation) throws WSDLException
+ {
+ if (wsdlLocation == null)
+ throw new IllegalArgumentException("URL cannot be null");
- if(log.isDebugEnabled()) log.debug("parse: " + wsdlLocation.toExternalForm());
-
- EntityResolver entityResolver = new JBossWSEntityResolver();
- WSDLDefinitions wsdlDefinitions = null;
- try
- {
- Document wsdlDoc = getDocument(wsdlLocation);
- String defaultNamespace = getDefaultNamespace(wsdlDoc);
- if (Constants.NS_WSDL11.equals(defaultNamespace))
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose", false);
+ if(log.isDebugEnabled()) log.debug("parse: " + wsdlLocation.toExternalForm());
- // Setup reader features
- Iterator it = features.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Boolean flag = (Boolean)entry.getValue();
- wsdlReader.setFeature(key, flag.booleanValue());
- }
+ EntityResolver entityResolver = new JBossWSEntityResolver();
+ WSDLDefinitions wsdlDefinitions = null;
+ try
+ {
+ Document wsdlDoc = getDocument(wsdlLocation);
+ String defaultNamespace = getDefaultNamespace(wsdlDoc);
+ if (Constants.NS_WSDL11.equals(defaultNamespace))
+ {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance(JBossWSDLFactoryImpl.class.getName());
+ WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose", false);
- // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
- // [TODO] show the usecase that needs this
- //((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
+ // Setup reader features
+ Iterator it = features.entrySet().iterator();
+
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Boolean flag = (Boolean)entry.getValue();
+ wsdlReader.setFeature(key, flag.booleanValue());
+ }
- Definition definition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation));
- wsdlDefinitions = new WSDL11Reader().processDefinition(definition, wsdlLocation);
- wsdlDefinitions.setWsdlDocument(wsdlDoc);
- }
- else
- throw new WSDLException("Invalid default namespace: " + defaultNamespace);
+ Definition definition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation));
+ wsdlDefinitions = new WSDL11Reader().processDefinition(definition, wsdlLocation);
+ wsdlDefinitions.setWsdlDocument(wsdlDoc);
+ }
+ else
+ {
+ throw new WSDLException("Invalid default namespace: " + defaultNamespace);
+ }
+
+ if (log.isTraceEnabled())
+ {
+ StringWriter stwr = new StringWriter();
+ WSDL11Writer wsdlWriter = new WSDL11Writer(wsdlDefinitions);
+ wsdlWriter.write(stwr);
+ log.trace("\n" + stwr.toString());
+ }
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(e);
+ }
- if (log.isTraceEnabled())
- {
- StringWriter stwr = new StringWriter();
- WSDL11Writer wsdlWriter = new WSDL11Writer(wsdlDefinitions);
- wsdlWriter.write(stwr);
- log.trace("\n" + stwr.toString());
- }
- }
- catch (WSDLException e)
- {
- throw e;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSDLException(e);
- }
+ return wsdlDefinitions;
+ }
- return wsdlDefinitions;
- }
+ /** Get the WSDL document.
+ */
+ private Document getDocument(URL wsdlLocation) throws WSDLException
+ {
+ try
+ {
+ InputStream inputStream = new ResourceURL(wsdlLocation).openStream();
+ try
+ {
+ DocumentBuilder builder = DOMUtils.getDocumentBuilder();
+ return builder.parse(inputStream);
+ }
+ finally
+ {
+ inputStream.close();
+ }
+ }
+ catch (ConnectException ex)
+ {
+ throw new WSDLException("Cannot connect to: " + wsdlLocation);
+ }
+ catch (Exception ex)
+ {
+ throw new WSDLException("Cannot parse wsdlLocation: " + wsdlLocation, ex);
+ }
+ }
- /** Get the WSDL document.
- */
- private Document getDocument(URL wsdlLocation) throws WSDLException
- {
- try
- {
- InputStream inputStream = new ResourceURL(wsdlLocation).openStream();
- try
- {
- DocumentBuilder builder = DOMUtils.getDocumentBuilder();
- return builder.parse(inputStream);
- }
- finally
- {
- inputStream.close();
- }
- }
- catch (ConnectException ex)
- {
- throw new WSDLException("Cannot connect to: " + wsdlLocation);
- }
- catch (Exception ex)
- {
- throw new WSDLException("Cannot parse wsdlLocation: " + wsdlLocation, ex);
- }
- }
-
- /** Get the default namespace for the given WSDL
- */
- private String getDefaultNamespace(Document wsdlDoc) throws WSDLException
- {
- Element root = wsdlDoc.getDocumentElement();
- String defaultNamespace = root.getNamespaceURI();
- return defaultNamespace;
- }
+ /** Get the default namespace for the given WSDL
+ */
+ private String getDefaultNamespace(Document wsdlDoc) throws WSDLException
+ {
+ Element root = wsdlDoc.getDocumentElement();
+ String defaultNamespace = root.getNamespaceURI();
+ return defaultNamespace;
+ }
}
18 years, 10 months
JBossWS SVN: r3471 - trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-06 09:41:06 -0400 (Wed, 06 Jun 2007)
New Revision: 3471
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java
Log:
Use local entity resolver
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java 2007-06-06 13:30:09 UTC (rev 3470)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java 2007-06-06 13:41:06 UTC (rev 3471)
@@ -52,8 +52,8 @@
delegate = (DocumentBuilderFactory)clazz.newInstance();
// namespace aware by default
- delegate.setNamespaceAware(true);
- }
+ delegate.setNamespaceAware(true);
+ }
catch (Exception ex)
{
throw new IllegalStateException("Cannot create delegate document builder factory: " + XERCES_DOCUMENT_BUILDER_FACTORY, ex);
@@ -73,7 +73,8 @@
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
{
DocumentBuilder builder = delegate.newDocumentBuilder();
- return builder;
+ builder.setEntityResolver( new JBossWSEntityResolver() );
+ return builder;
}
public void setAttribute(String name, Object value) throws IllegalArgumentException
18 years, 10 months
JBossWS SVN: r3470 - in branches/jbossws-2.0/jbossws-core/src: test/java/org/jboss/test/ws/tools and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-06-06 09:30:09 -0400 (Wed, 06 Jun 2007)
New Revision: 3470
Added:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml
branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
Log:
JBWS-1698 - WSDL To Java - If fault name contains 'Fault' the generated Exception does not match the throws clause on the SEI.
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-06-06 13:01:08 UTC (rev 3469)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -327,7 +327,7 @@
if (cl == null)
{
String faultTypeName = (!xt.getAnonymous()) ? faultXMLType.getLocalPart() : faultXMLName.getLocalPart();
- buf.append(seiPkgName + "." + cleanUpFaultName(faultTypeName));
+ buf.append(seiPkgName + "." + JavaUtils.capitalize(faultTypeName));
}
else buf.append(cl.getName());
buf.append(",");
@@ -441,10 +441,10 @@
XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(), elementName.getNamespaceURI());
XSTypeDefinition xt = xe.getTypeDefinition();
QName xmlType = new QName(xt.getNamespace(), xt.getName());
-
+
// Replace the xt with the real type from the schema.
xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
-
+
if (buf.length() > 0)
{
buf.append(", ");
@@ -754,33 +754,6 @@
return cls.getName() + arraySuffix;
}
- /**
- * WSDL may have appended the Faults with 'Fault' or 'Error'
- * @param faultname
- * @return
- */
- private String cleanUpFaultName(String faultname)
- {
- //Clean up the faultname from Error and Fault
- boolean endsfault = faultname.endsWith("Fault");
-
- if (endsfault)
- {
- int index = faultname.lastIndexOf("Fault");
- faultname = faultname.substring(0, index);
- }
- else
- {
- boolean endsError = faultname.endsWith("Error");
- if (endsError)
- {
- int index = faultname.lastIndexOf("Error");
- faultname = faultname.substring(0, index);
- }
- }
- return JavaUtils.capitalize(faultname);
- }
-
private void checkTypeMapping()
{
if (typeMapping == null)
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.tools.jbws1698;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
+import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
+import org.jboss.ws.tools.WSTools;
+
+/**
+ * Test case for http://jira.jboss.com/jira/browse/JBWS-1698
+ *
+ * WSDL To Java does not use the correct name in the throws
+ * clause for faults that end in 'Fault'
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since Jun 6, 2007
+ */
+public class JBWS1698TestCase extends WSToolsTest
+{
+
+ /**
+ * Test WSDL to Java with a fault called PhoneBookFault
+ */
+ public void testGenerateFault() throws Exception
+ {
+ generateScenario("fault");
+ }
+
+ /**
+ * Test WSDL to Java with a fault called PhoneBookError
+ */
+ public void testGenerateError() throws Exception
+ {
+ generateScenario("error");
+ }
+
+ protected void generateScenario(final String scenario) throws Exception
+ {
+ String resourceDir = "resources/tools/jbws1698/" + scenario;
+ String toolsDir = "tools/jbws1698/" + scenario;
+ String[] args = new String[] { "-dest", toolsDir, "-config", resourceDir + "/wstools-config.xml" };
+ new WSTools().generate(args);
+ File resourceDirFile = new File(resourceDir);
+ String[] expectedFiles = resourceDirFile.list(new FilenameFilter() {
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".java");
+ }
+ });
+
+ for (int i = 0; i < expectedFiles.length; i++)
+ {
+ String currentFile = expectedFiles[i];
+
+ try
+ {
+ compareSource(resourceDir + "/" + currentFile, toolsDir + "/org/jboss/test/ws/jbws1698/" + currentFile);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Validation of '" + currentFile + "' failed.", e);
+ }
+ }
+
+ File packageDir = new File(toolsDir + "/org/jboss/test/ws/jbws1698");
+ String[] generatedFiles = packageDir.list();
+ for (int i = 0; i < generatedFiles.length; i++)
+ {
+ String currentFile = generatedFiles[i];
+
+ boolean matched = "PhoneBookService.java".equals(currentFile);
+
+ for (int j = 0; j < expectedFiles.length && (matched == false); j++)
+ matched = currentFile.equals(expectedFiles[j]);
+
+ assertTrue("File '" + currentFile + "' was not expected to be generated", matched);
+ }
+
+ JaxrpcMappingValidator mappingValidator = new JaxrpcMappingValidator();
+ mappingValidator.validate(resourceDir + "/jaxrpc-mapping.xml", toolsDir + "/jaxrpc-mapping.xml");
+ }
+
+ private static void compareSource(final String expectedName, final String generatedName) throws Exception
+ {
+ File expected = new File(expectedName);
+ File generated = new File(generatedName);
+
+ JBossSourceComparator sc = new JBossSourceComparator(expected, generated);
+ sc.validate();
+ sc.validateImports();
+ }
+
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/tools/jbws1698/JBWS1698TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class Person
+{
+
+protected java.lang.String firstName;
+
+protected java.lang.String surname;
+public Person(){}
+
+public Person(java.lang.String firstName, java.lang.String surname){
+this.firstName=firstName;
+this.surname=surname;
+}
+public java.lang.String getFirstName() { return firstName ;}
+
+public void setFirstName(java.lang.String firstName){ this.firstName=firstName; }
+
+public java.lang.String getSurname() { return surname ;}
+
+public void setSurname(java.lang.String surname){ this.surname=surname; }
+
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/Person.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook'
+ targetNamespace='http://test.jboss.org/ws/jbws1698'
+ xmlns='http://schemas.xmlsoap.org/wsdl/'
+ xmlns:ns1='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698'
+ xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema targetNamespace='http://test.jboss.org/ws/jbws1698/types'
+ xmlns='http://www.w3.org/2001/XMLSchema'
+ xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <complexType name='Person'>
+ <sequence>
+ <element name='firstName' nillable='true' type='string'/>
+ <element name='surname' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <complexType name='PhoneBookError'>
+ <sequence/>
+ </complexType>
+ <complexType name='TelephoneNumber'>
+ <sequence>
+ <element name='areaCode' nillable='true' type='string'/>
+ <element name='number' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <element name='lookup' type='tns:Person'/>
+ <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ <element name='PhoneBookError' type='tns:PhoneBookError'/>
+ </schema>
+ </types>
+
+ <message name='PhoneBook_lookup' xmlns='http://schemas.xmlsoap.org/wsdl/'>
+ <part element='ns1:lookup' name='lookup'/>
+ </message>
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookupResponse' name='lookupResponse'/>
+ </message>
+ <message name='PhoneBookError'>
+ <part element='ns1:PhoneBookError' name='PhoneBookError'/>
+ </message>
+
+ <portType name='PhoneBook'>
+ <operation name='lookup' parameterOrder='lookup'>
+ <input message='tns:PhoneBook_lookup'/>
+ <output message='tns:PhoneBook_lookupResponse'/>
+ <fault message='tns:PhoneBookError' name='PhoneBookError'/>
+ </operation>
+ </portType>
+ <binding name='PhoneBookBinding' type='tns:PhoneBook'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='lookup'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ <fault name='PhoneBookError'>
+ <soap:fault name='PhoneBookError' use='literal'/>
+ </fault>
+ </operation>
+ </binding>
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,18 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class PhoneBookError
+ extends Exception{
+public PhoneBookError(){
+}
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBookError.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,15 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+package org.jboss.test.ws.jbws1698;
+public interface PhoneBook_PortType extends java.rmi.Remote
+{
+
+ public org.jboss.test.ws.jbws1698.TelephoneNumber lookup(org.jboss.test.ws.jbws1698.Person lookup) throws org.jboss.test.ws.jbws1698.PhoneBookError, java.rmi.RemoteException;
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/PhoneBook_PortType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class TelephoneNumber
+{
+
+protected java.lang.String areaCode;
+
+protected java.lang.String number;
+public TelephoneNumber(){}
+
+public TelephoneNumber(java.lang.String areaCode, java.lang.String number){
+this.areaCode=areaCode;
+this.number=number;
+}
+public java.lang.String getAreaCode() { return areaCode ;}
+
+public void setAreaCode(java.lang.String areaCode){ this.areaCode=areaCode; }
+
+public java.lang.String getNumber() { return number ;}
+
+public void setNumber(java.lang.String number){ this.number=number; }
+
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/TelephoneNumber.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,76 @@
+<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698/types</namespaceURI>
+ </package-mapping>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698</namespaceURI>
+ </package-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.Person</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:Person</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>firstName</java-variable-name>
+ <xml-element-name>firstName</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>surname</java-variable-name>
+ <xml-element-name>surname</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.TelephoneNumber</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:TelephoneNumber</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>areaCode</java-variable-name>
+ <xml-element-name>areaCode</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>number</java-variable-name>
+ <xml-element-name>number</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.PhoneBookError</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:PhoneBookError</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ </java-xml-type-mapping>
+ <exception-mapping>
+ <exception-type>org.jboss.test.ws.jbws1698.PhoneBookError</exception-type>
+ <wsdl-message xmlns:exMsgNS='http://test.jboss.org/ws/jbws1698'>exMsgNS:PhoneBookError</wsdl-message>
+ </exception-mapping>
+ <service-interface-mapping>
+ <service-interface>org.jboss.test.ws.jbws1698.PhoneBook_Service</service-interface>
+ <wsdl-service-name xmlns:serviceNS='http://test.jboss.org/ws/jbws1698'>serviceNS:PhoneBook</wsdl-service-name>
+ <port-mapping>
+ <port-name>PhoneBookPort</port-name>
+ <java-port-name>PhoneBookPort</java-port-name>
+ </port-mapping>
+ </service-interface-mapping>
+ <service-endpoint-interface-mapping>
+ <service-endpoint-interface>org.jboss.test.ws.jbws1698.PhoneBook_PortType</service-endpoint-interface>
+ <wsdl-port-type xmlns:portTypeNS='http://test.jboss.org/ws/jbws1698'>portTypeNS:PhoneBook</wsdl-port-type>
+ <wsdl-binding xmlns:bindingNS='http://test.jboss.org/ws/jbws1698'>bindingNS:PhoneBookBinding</wsdl-binding>
+ <service-endpoint-method-mapping>
+ <java-method-name>lookup</java-method-name>
+ <wsdl-operation>lookup</wsdl-operation>
+ <method-param-parts-mapping>
+ <param-position>0</param-position>
+ <param-type>org.jboss.test.ws.jbws1698.Person</param-type>
+ <wsdl-message-mapping>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookup</wsdl-message>
+ <wsdl-message-part-name>lookup</wsdl-message-part-name>
+ <parameter-mode>IN</parameter-mode>
+ </wsdl-message-mapping>
+ </method-param-parts-mapping>
+ <wsdl-return-value-mapping>
+ <method-return-value>org.jboss.test.ws.jbws1698.TelephoneNumber</method-return-value>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookupResponse</wsdl-message>
+ <wsdl-message-part-name>lookupResponse</wsdl-message-part-name>
+ </wsdl-return-value-mapping>
+ </service-endpoint-method-mapping>
+ </service-endpoint-interface-mapping>
+</java-wsdl-mapping>
\ No newline at end of file
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/jaxrpc-mapping.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,5 @@
+<configuration>
+ <wsdl-java location="resources/tools/jbws1698/error/PhoneBook.wsdl" parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/error/wstools-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class Person
+{
+
+protected java.lang.String firstName;
+
+protected java.lang.String surname;
+public Person(){}
+
+public Person(java.lang.String firstName, java.lang.String surname){
+this.firstName=firstName;
+this.surname=surname;
+}
+public java.lang.String getFirstName() { return firstName ;}
+
+public void setFirstName(java.lang.String firstName){ this.firstName=firstName; }
+
+public java.lang.String getSurname() { return surname ;}
+
+public void setSurname(java.lang.String surname){ this.surname=surname; }
+
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/Person.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook'
+ targetNamespace='http://test.jboss.org/ws/jbws1698'
+ xmlns='http://schemas.xmlsoap.org/wsdl/'
+ xmlns:ns1='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698'
+ xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema targetNamespace='http://test.jboss.org/ws/jbws1698/types'
+ xmlns='http://www.w3.org/2001/XMLSchema'
+ xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1698/types'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <complexType name='Person'>
+ <sequence>
+ <element name='firstName' nillable='true' type='string'/>
+ <element name='surname' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <complexType name='PhoneBookFault'>
+ <sequence/>
+ </complexType>
+ <complexType name='TelephoneNumber'>
+ <sequence>
+ <element name='areaCode' nillable='true' type='string'/>
+ <element name='number' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+ <element name='lookup' type='tns:Person'/>
+ <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ <element name='PhoneBookFault' type='tns:PhoneBookFault'/>
+ </schema>
+ </types>
+
+ <message name='PhoneBook_lookup' xmlns='http://schemas.xmlsoap.org/wsdl/'>
+ <part element='ns1:lookup' name='lookup'/>
+ </message>
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookupResponse' name='lookupResponse'/>
+ </message>
+ <message name='PhoneBookFault'>
+ <part element='ns1:PhoneBookFault' name='PhoneBookFault'/>
+ </message>
+
+ <portType name='PhoneBook'>
+ <operation name='lookup' parameterOrder='lookup'>
+ <input message='tns:PhoneBook_lookup'/>
+ <output message='tns:PhoneBook_lookupResponse'/>
+ <fault message='tns:PhoneBookFault' name='PhoneBookFault'/>
+ </operation>
+ </portType>
+ <binding name='PhoneBookBinding' type='tns:PhoneBook'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='lookup'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ <fault name='PhoneBookFault'>
+ <soap:fault name='PhoneBookFault' use='literal'/>
+ </fault>
+ </operation>
+ </binding>
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,18 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class PhoneBookFault
+ extends Exception{
+public PhoneBookFault(){
+}
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBookFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,15 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+package org.jboss.test.ws.jbws1698;
+public interface PhoneBook_PortType extends java.rmi.Remote
+{
+
+ public org.jboss.test.ws.jbws1698.TelephoneNumber lookup(org.jboss.test.ws.jbws1698.Person lookup) throws org.jboss.test.ws.jbws1698.PhoneBookFault, java.rmi.RemoteException;
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/PhoneBook_PortType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,34 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Wed Jun 06 14:58:58 CEST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1698;
+
+
+public class TelephoneNumber
+{
+
+protected java.lang.String areaCode;
+
+protected java.lang.String number;
+public TelephoneNumber(){}
+
+public TelephoneNumber(java.lang.String areaCode, java.lang.String number){
+this.areaCode=areaCode;
+this.number=number;
+}
+public java.lang.String getAreaCode() { return areaCode ;}
+
+public void setAreaCode(java.lang.String areaCode){ this.areaCode=areaCode; }
+
+public java.lang.String getNumber() { return number ;}
+
+public void setNumber(java.lang.String number){ this.number=number; }
+
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/TelephoneNumber.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,76 @@
+<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698/types</namespaceURI>
+ </package-mapping>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1698</package-type>
+ <namespaceURI>http://test.jboss.org/ws/jbws1698</namespaceURI>
+ </package-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.Person</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:Person</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>firstName</java-variable-name>
+ <xml-element-name>firstName</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>surname</java-variable-name>
+ <xml-element-name>surname</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.TelephoneNumber</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:TelephoneNumber</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>areaCode</java-variable-name>
+ <xml-element-name>areaCode</xml-element-name>
+ </variable-mapping>
+ <variable-mapping>
+ <java-variable-name>number</java-variable-name>
+ <xml-element-name>number</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1698.PhoneBookFault</java-type>
+ <root-type-qname xmlns:typeNS='http://test.jboss.org/ws/jbws1698/types'>typeNS:PhoneBookFault</root-type-qname>
+ <qname-scope>complexType</qname-scope>
+ </java-xml-type-mapping>
+ <exception-mapping>
+ <exception-type>org.jboss.test.ws.jbws1698.PhoneBookFault</exception-type>
+ <wsdl-message xmlns:exMsgNS='http://test.jboss.org/ws/jbws1698'>exMsgNS:PhoneBookFault</wsdl-message>
+ </exception-mapping>
+ <service-interface-mapping>
+ <service-interface>org.jboss.test.ws.jbws1698.PhoneBook_Service</service-interface>
+ <wsdl-service-name xmlns:serviceNS='http://test.jboss.org/ws/jbws1698'>serviceNS:PhoneBook</wsdl-service-name>
+ <port-mapping>
+ <port-name>PhoneBookPort</port-name>
+ <java-port-name>PhoneBookPort</java-port-name>
+ </port-mapping>
+ </service-interface-mapping>
+ <service-endpoint-interface-mapping>
+ <service-endpoint-interface>org.jboss.test.ws.jbws1698.PhoneBook_PortType</service-endpoint-interface>
+ <wsdl-port-type xmlns:portTypeNS='http://test.jboss.org/ws/jbws1698'>portTypeNS:PhoneBook</wsdl-port-type>
+ <wsdl-binding xmlns:bindingNS='http://test.jboss.org/ws/jbws1698'>bindingNS:PhoneBookBinding</wsdl-binding>
+ <service-endpoint-method-mapping>
+ <java-method-name>lookup</java-method-name>
+ <wsdl-operation>lookup</wsdl-operation>
+ <method-param-parts-mapping>
+ <param-position>0</param-position>
+ <param-type>org.jboss.test.ws.jbws1698.Person</param-type>
+ <wsdl-message-mapping>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookup</wsdl-message>
+ <wsdl-message-part-name>lookup</wsdl-message-part-name>
+ <parameter-mode>IN</parameter-mode>
+ </wsdl-message-mapping>
+ </method-param-parts-mapping>
+ <wsdl-return-value-mapping>
+ <method-return-value>org.jboss.test.ws.jbws1698.TelephoneNumber</method-return-value>
+ <wsdl-message xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1698'>wsdlMsgNS:PhoneBook_lookupResponse</wsdl-message>
+ <wsdl-message-part-name>lookupResponse</wsdl-message-part-name>
+ </wsdl-return-value-mapping>
+ </service-endpoint-method-mapping>
+ </service-endpoint-interface-mapping>
+</java-wsdl-mapping>
\ No newline at end of file
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/jaxrpc-mapping.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml 2007-06-06 13:30:09 UTC (rev 3470)
@@ -0,0 +1,5 @@
+<configuration>
+ <wsdl-java location="resources/tools/jbws1698/fault/PhoneBook.wsdl" parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/tools/jbws1698/fault/wstools-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
18 years, 10 months
JBossWS SVN: r3469 - branches/jbossws-2.0/jbossws-core/src/main/etc.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-06-06 09:01:08 -0400 (Wed, 06 Jun 2007)
New Revision: 3469
Modified:
branches/jbossws-2.0/jbossws-core/src/main/etc/default.mf
Log:
Update jbossws Class-Path in manifest
Modified: branches/jbossws-2.0/jbossws-core/src/main/etc/default.mf
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/etc/default.mf 2007-06-06 12:30:00 UTC (rev 3468)
+++ branches/jbossws-2.0/jbossws-core/src/main/etc/default.mf 2007-06-06 13:01:08 UTC (rev 3469)
@@ -8,5 +8,6 @@
Implementation-Version: @implementation.version@ (build=(a)build.id@)
Implementation-Vendor: @implementation.vendor@
Implementation-Vendor-Id: @implementation.vendor.id@
-Class-Path: jbossws-spi.jar jboss-jaxrpc.jar jboss-jaxws.jar
- jboss-saaj.jar
\ No newline at end of file
+Class-Path: jbossws-spi.jar jboss-jaxrpc.jar jboss-jaxws.jar jboss-saaj.jar
+ jboss-xml-binding.jar javassist.jar mail.jar activation.jar
+ jaxb-api.jar jaxb-impl.jar policy.jar wsdl4j.jar
\ No newline at end of file
18 years, 10 months