You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2005/12/09 17:22:27 UTC
svn commit: r355529 [2/4] - in /beehive/trunk: system-controls/
system-controls/external/webservice/
system-controls/src/ejb/org/apache/beehive/controls/system/ejb/
system-controls/src/webservice/org/apache/beehive/controls/system/webservice/
system-co...
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/ControlWsdlLocator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/ControlWsdlLocator.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/ControlWsdlLocator.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/ControlWsdlLocator.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+
+import org.xml.sax.InputSource;
+
+import javax.wsdl.xml.WSDLLocator;
+import java.beans.beancontext.BeanContext;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+
+/**
+ * An implementation of WSDLLocator for Beehive controls. This WSDLLocator implementation
+ * may open multiple input streams, its <tt>cleanup()</tt> method should always be called once
+ * the WSDL file has been parsed.
+ */
+public final class ControlWsdlLocator implements WSDLLocator
+{
+ private final String _wsdlName;
+ private final BeanContext _beanContext;
+ private ArrayList<InputStream> _openStreams = new ArrayList<InputStream>();
+
+ /**
+ * Create a new wsdl locator for the wsdl file with the specified name.
+ *
+ * @param wsdlName Name of the WSDL file to try to load. Name may include file path elements.
+ * @param beanContext The ControlBeanContext of the control which wants to load a WSDL file.
+ */
+ public ControlWsdlLocator(String wsdlName, BeanContext beanContext) {
+
+ if (wsdlName == null) {
+ throw new IllegalArgumentException("ERROR: WSDL path is null!");
+ }
+
+ _wsdlName = wsdlName;
+ _beanContext = beanContext;
+ }
+
+ /**
+ * Close any InputStreams opened by this locator.
+ */
+ public void cleanup() {
+
+ for (InputStream i : _openStreams) {
+ try {
+ i.close();
+ }
+ catch (IOException ioe) {
+ // noop
+ }
+ }
+ }
+
+ /**
+ * Find the InputSource for the WSDL file stored in _wsdlName. This method attempts to
+ * find a WSDL file by:
+ * <ol>
+ * <li>If the _wsdlName can be converted to a URL, use url.openStream()</li>
+ * <li>Attempt to locate _wsdlName using the bean context's getResourceAsStream()</li>
+ * <li>Attempt to locate _wsdlName using the current class loader's getResourceAsStream()</li>
+ * </ol>
+ *
+ * @return An InputSource for the WSDL file.
+ */
+ public InputSource getBaseInputSource() {
+
+ InputStream wsdlStream = null;
+
+ // try to open as URL first --
+ try {
+ URL url = new URL(_wsdlName);
+ wsdlStream = url.openStream();
+ }
+ catch (MalformedURLException e) {
+ // not fatal keep trying
+ }
+ catch (IOException e) {
+ // fatal - abort
+ throw new TypeNotPresentException("Cannot load WSDL file: " + _wsdlName, e);
+ }
+
+ if (wsdlStream == null) {
+ wsdlStream = _beanContext.getBeanContext().getResourceAsStream(_wsdlName, null);
+ }
+
+ if (wsdlStream == null) {
+ wsdlStream = this.getClass().getClassLoader().getResourceAsStream(_wsdlName);
+ }
+
+ if (wsdlStream == null) {
+ throw new TypeNotPresentException("Cannot find WSDL file: " + _wsdlName, null);
+ }
+
+ _openStreams.add(wsdlStream);
+ return new InputSource(wsdlStream);
+ }
+
+ /**
+ * Get the base URI for the wsdl file.
+ *
+ * @return null if _wsdlName is not a valid URI.
+ */
+ public String getBaseURI() {
+
+ try {
+ URI uri = new URI(_wsdlName);
+ return uri.toString();
+ }
+ catch (URISyntaxException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Not implemented.
+ *
+ * @param string
+ * @param string1
+ * @return null
+ */
+ public InputSource getImportInputSource(String string, String string1) {
+
+ return null;
+ }
+
+ /**
+ * Not implemented.
+ *
+ * @return null
+ */
+ public String getLatestImportURI() {
+
+ return null;
+ }
+
+}
\ No newline at end of file
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/DomUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/DomUtils.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/DomUtils.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/DomUtils.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * Some simple DOM utility methods.
+ */
+public final class DomUtils {
+
+ /**
+ * <p>Returns the first child element with the given name. Returns
+ * <code>null</code> if not found.</p>
+ *
+ * @param parent parent element
+ * @param name name of the child element
+ * @return child element
+ */
+ public static Element getChildElementByName(Element parent, String name) {
+ NodeList children = parent.getChildNodes();
+
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node;
+ if (element.getTagName().equals(name)) {
+ return element;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * <p>Returns a list of child elements with the given
+ * name. Returns an empty list if there are no such child
+ * elements.</p>
+ *
+ * @param parent parent element
+ * @param name name of the child element
+ * @return child elements
+ */
+ public static List<Element> getChildElementsByName(Element parent, String name) {
+ List<Element> elements = new ArrayList<Element>();
+
+ NodeList children = parent.getChildNodes();
+
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node;
+ if (element.getTagName().equals(name)) {
+ elements.add(element);
+ }
+ }
+ }
+
+ return elements;
+ }
+
+ /**
+ * <p>Returns the text value of a child element. Returns
+ * <code>null</code> if there is no child element found.</p>
+ *
+ * @param parent parent element
+ * @param name name of the child element
+ * @return text value
+ */
+ static String getChildElementText(Element parent, String name) {
+ // Get children
+ List list = DomUtils.getChildElementsByName(parent, name);
+
+ if (list.size() == 1) {
+ Element child = (Element) list.get(0);
+
+ StringBuffer buf = new StringBuffer();
+
+ NodeList children = child.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node.getNodeType() == Node.TEXT_NODE ||
+ node.getNodeType() == Node.CDATA_SECTION_NODE) {
+ Text text = (Text) node;
+ buf.append(text.getData().trim());
+ }
+ }
+
+ return buf.toString();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * <p>Returns the text value of a child element. Returns
+ * <code>null</code> if there is no child element found.</p>
+ *
+ * @param element element
+ * @return text value
+ */
+ static String getElementText(Element element) {
+ StringBuffer buf = new StringBuffer();
+
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node.getNodeType() == Node.TEXT_NODE ||
+ node.getNodeType() == Node.CDATA_SECTION_NODE) {
+ Text text = (Text) node;
+ buf.append(text.getData().trim());
+ }
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ * <p>Returns an array of text values of a child element. Returns
+ * <code>null</code> if there is no child element found.</p>
+ *
+ * @param parent parent element
+ * @param name name of the child element
+ * @return text value
+ */
+ static String[] getChildElementTextArr(Element parent, String name) {
+ // Get all the elements
+ List children = getChildElementsByName(parent, name);
+
+ String str[] = new String[children.size()];
+
+ for (int i = 0; i < children.size(); i++) {
+ Node child = (Node) children.get(i);
+
+ StringBuffer buf = new StringBuffer();
+
+ NodeList nodes = child.getChildNodes();
+ for (int j = 0; j < nodes.getLength(); j++) {
+ Node node = nodes.item(j);
+ if (node.getNodeType() == Node.TEXT_NODE ||
+ node.getNodeType() == Node.CDATA_SECTION_NODE) {
+ Text text = (Text) node;
+ buf.append(text.getData().trim());
+ }
+ }
+
+ str[i] = buf.toString();
+ }
+
+ return str;
+ }
+
+ /**
+ * <p>Retutns the value of the named attribute of the given
+ * element. If there is no such attribute, returns null.</p>
+ *
+ * @param element element
+ * @param name name
+ * @return value
+ */
+ public static String getAttributeValue(Element element, String name) {
+ Attr attribute = element.getAttributeNode(name);
+ if (attribute == null) {
+ return null;
+ } else {
+ return attribute.getValue();
+ }
+ }
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ */
+public final class Wsdl implements java.io.Serializable
+{
+ private Port _port;
+ private final Definition _wsdlDefinition;
+ private final Service _service;
+ private final WsdlNamespaceResolver _namespaceResolver;
+ private HashMap<String, WsdlOperation> _operationCache;
+
+ /**
+ * Loads and parses the specified WSDL file. Default to the first service found
+ * in the wsdl and the first port type found for that service.
+ *
+ * @param wsdlURI URI of a WSDL file.
+ */
+ public Wsdl(URI wsdlURI) {
+
+ try {
+ _wsdlDefinition = parse(wsdlURI);
+ }
+ catch (WSDLException e) {
+ throw new TypeNotPresentException("Could not load WSDL file: " + e.getMessage(), e);
+ }
+
+ _service = (Service) _wsdlDefinition.getServices().values().iterator().next();
+ _port = (Port) _service.getPorts().values().iterator().next();
+ _operationCache = new HashMap<String, WsdlOperation>();
+ _namespaceResolver = new WsdlNamespaceResolver(_wsdlDefinition);
+ }
+
+ /**
+ * Loads and parses the specified WSDL file.
+ *
+ * @param wsdlLocator A javax.wsdl.WSDLLocator instance.
+ * @param serviceQName Name of the service in the WSDL.
+ * @param portName The service port name.
+ */
+ public Wsdl(WSDLLocator wsdlLocator, QName serviceQName, String portName) {
+
+ // load and parse the WSDL
+ try {
+ _wsdlDefinition = parse(wsdlLocator);
+ }
+ catch (WSDLException e) {
+ throw new TypeNotPresentException("Could not load WSDL file: " + e.getMessage(), e);
+ }
+
+ _service = _wsdlDefinition.getService(serviceQName);
+ if (_service == null) {
+ throw new IllegalArgumentException("Service: " + serviceQName + " is not defined in the WSDL file.");
+ }
+
+ _port = _service.getPort(portName);
+ _operationCache = new HashMap<String, WsdlOperation>();
+
+ _namespaceResolver = new WsdlNamespaceResolver(_wsdlDefinition);
+ }
+
+ /**
+ * Find the specified operation in the WSDL definition.
+ *
+ * @param operationName Name of operation to find.
+ * @return A WsdlOperation instance, null if operation can not be found in WSDL.
+ */
+ public WsdlOperation getOperation(String operationName) {
+
+ // is the operation in the cache?
+ if (_operationCache.containsKey(operationName)) {
+ return _operationCache.get(operationName);
+ }
+
+ Binding b = _port.getBinding();
+ PortType pt = b.getPortType();
+ Operation op = pt.getOperation(operationName, null, null);
+ if (op != null) {
+ WsdlOperation wop = new WsdlOperation(b, op, _wsdlDefinition, _namespaceResolver);
+ // cache the operation
+ _operationCache.put(operationName, wop);
+ return wop;
+ }
+ return null;
+ }
+
+ /**
+ * Get a list of all operations defined in this WSDL.
+ *
+ * @return List of WsdlOperations.
+ */
+ public List<WsdlOperation> getOperations() {
+
+ List<WsdlOperation> opList = new ArrayList<WsdlOperation>();
+ PortType pt = _port.getBinding().getPortType();
+
+ List operations = pt.getOperations();
+ for (Object o : operations) {
+ opList.add(getOperation(((Operation) o).getName()));
+ }
+ return opList;
+ }
+
+ /**
+ * Get the name of the current port.
+ *
+ * @return String.
+ */
+ public String getPortName() {
+ return _port.getName();
+ }
+
+ /**
+ * Get the PortType name for the service which has been specified by serviceName and portName
+ * at construction time.
+ *
+ * @return QName of the PortType.
+ */
+ public QName getPortTypeQName() {
+
+ Binding b = _port.getBinding();
+ return b.getPortType().getQName();
+ }
+
+ public String getServiceEndpoint() {
+ return WsdlUtils.getSOAPAddress(_port);
+ }
+
+ /**
+ * Get the name of this service.
+ *
+ * @return String.
+ */
+ public String getServiceName() {
+ return _service.getQName().getLocalPart();
+ }
+
+ /**
+ * Get the target namespace for the WSDL.
+ *
+ * @return String
+ */
+ public String getTargetNamespace() {
+ return _wsdlDefinition.getTargetNamespace();
+ }
+
+ /**
+ * Change the port of the service.
+ *
+ * @param portName The new port name.
+ * @throws IllegalArgumentException if port name is not defined in WSDL.
+ */
+ public void setPort(QName portName) {
+
+ Port port = _service.getPort(portName.getLocalPart());
+ if (port == null) {
+ throw new IllegalArgumentException("Port name: '" + portName + "' was not found in the WSDL file.");
+ }
+
+ _port = port;
+ _operationCache.clear();
+ }
+
+ /**
+ * Get a WSDLReader.
+ *
+ * @return WSDLReader.
+ * @throws WSDLException on error.
+ */
+ private WSDLReader getReader() throws WSDLException {
+
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose", true);
+ wsdlReader.setFeature("javax.wsdl.importDocuments", true);
+ return wsdlReader;
+ }
+
+ /**
+ * Load and parse the WSDL file using the wsdlLocator.
+ *
+ * @param wsdlLocator A WSDLLocator instance.
+ * @return wsdl Definition.
+ * @throws WSDLException on error.
+ */
+ private Definition parse(WSDLLocator wsdlLocator) throws WSDLException {
+
+ WSDLReader wsdlReader = getReader();
+ return wsdlReader.readWSDL(wsdlLocator);
+ }
+
+ /**
+ * Load and parse the WSDL file at the specified URI.
+ *
+ * @param wsdlURI URI of the WSDL file.
+ * @return wsdl Definition
+ * @throws WSDLException on error.
+ */
+ private Definition parse(URI wsdlURI) throws WSDLException {
+
+ WSDLReader wsdlReader = getReader();
+ return wsdlReader.readWSDL(wsdlURI.toString());
+ }
+
+}
Propchange: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java
------------------------------------------------------------------------------
svn:executable = *
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlNamespaceResolver.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlNamespaceResolver.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlNamespaceResolver.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlNamespaceResolver.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import org.w3c.dom.Element;
+
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.schema.Schema;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+/**
+ */
+public final class WsdlNamespaceResolver
+{
+
+ final private HashSet<String> _elementFormQualifiedNamespaces;
+ final private Map/*<String, String>*/ _prefixMappings;
+ final private String _targetNamespace;
+
+
+ WsdlNamespaceResolver(Definition wsdlDefinition) {
+
+ _targetNamespace = wsdlDefinition.getTargetNamespace();
+ _prefixMappings = wsdlDefinition.getNamespaces();
+ _elementFormQualifiedNamespaces =
+ new HashSet<String>(getElementFormQualifiedNamespaces(wsdlDefinition));
+ }
+
+ String getTargetNamespace() {
+ return _targetNamespace;
+ }
+
+ /**
+ * Get the type qname for the type parameter. Resolve namespace references if present,
+ * if a namespace prefix is not found the WSDL's target namespace will be used.
+ *
+ * @param type Name of type.
+ * @return A QName for the type name.
+ */
+ QName getTypeQName(String type) {
+
+ if (type.indexOf(':') > -1) {
+ String prefix = type.substring(0, type.indexOf(':'));
+ type = type.substring(type.indexOf(':') + 1);
+ return new QName((String) _prefixMappings.get(prefix), type);
+ }
+ else {
+ return new QName(_targetNamespace, type);
+ }
+ }
+
+ /**
+ * @param namespaceURI
+ * @return true if element form is qualified
+ */
+ boolean isElementFormQualified(String namespaceURI) {
+ return _elementFormQualifiedNamespaces.contains(namespaceURI);
+ }
+
+ /**
+ * Build a list of schema target namespaces which are element form qualified.
+ *
+ * @return All target namespaces for schemas defined in the WSDL which are element form qualified.
+ */
+ private List<String> getElementFormQualifiedNamespaces(Definition wsdlDefinition) {
+
+ List<String> namespaces = new ArrayList<String>();
+ List schemas = WsdlUtils.getSchemas(wsdlDefinition);
+ for (Object o : schemas) {
+ Element schemaElement = ((Schema) o).getElement();
+
+ if (schemaElement.hasAttribute(WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR)) {
+ String v = schemaElement.getAttribute(WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR);
+ if (WsdlUtils.ELEMENT_FORM_QUALIFIED.equalsIgnoreCase(v)) {
+ namespaces.add(schemaElement.getAttribute(WsdlUtils.TARGET_NAMESPACE_ATTR));
+ }
+ }
+ }
+ return namespaces;
+ }
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFault.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFault.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFault.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFault.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,59 @@
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Operation parameter abstraction.
+ */
+public final class WsdlOpFault extends WsdlOpReturnType implements java.io.Serializable
+{
+
+ private final QName _name;
+ private final boolean _complexType;
+ private final boolean _elementFormQualified;
+
+ /**
+ * Constructor used to create operation parameters whose types do not need to
+ * be unwrapped (found in one of the types schemas). Typically used for RPC style
+ * parameters but also may be used for DOCUMENT style in some cases (BARE parameter
+ * style in use).
+ *
+ * @param name QName of the parameter.
+ * @param xmlType XML type of the parameter.
+ * @param resolver
+ */
+ WsdlOpFault(String name, QName xmlType, boolean isComplex, WsdlNamespaceResolver resolver) {
+
+ _name = resolver.getTypeQName(name);
+ _elementFormQualified = resolver.isElementFormQualified(_name.getNamespaceURI());
+ _xmlType = xmlType;
+ _complexType = isComplex;
+ }
+
+ /**
+ * Get the name of this parameter.
+ *
+ * @return QName.
+ */
+ public QName getName() {
+ return _name;
+ }
+
+ /**
+ * Is the XML type a complex type?
+ *
+ * @return true if xmltype is a complex type.
+ */
+ public boolean isComplextType() {
+ return _complexType;
+ }
+
+ /**
+ * Is this element part of an element form qualifed schema?
+ *
+ * @return true if it is.
+ */
+ public boolean isElementFormQualified() {
+ return _elementFormQualified;
+ }
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFaultList.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFaultList.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFaultList.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpFaultList.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import org.w3c.dom.Element;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ */
+public final class WsdlOpFaultList extends ArrayList<WsdlOpFault>
+{
+
+ private final Definition _wsdlDefinition;
+ private final WsdlNamespaceResolver _resolver;
+
+ /**
+ * Constructor.
+ *
+ * @param wsdlDefinition Wsdl definition.
+ */
+ WsdlOpFaultList(Definition wsdlDefinition, WsdlNamespaceResolver resolver) {
+ _wsdlDefinition = wsdlDefinition;
+ _resolver = resolver;
+ }
+
+ /**
+ * Add a fault to this list.
+ *
+ * @param fault
+ * @return true if this collection was modified as a result of this call.
+ */
+ boolean add(Fault fault) {
+ return add(getFault(fault));
+ }
+
+ /**
+ * @param fault
+ * @return WsdlOpFault
+ */
+ private WsdlOpFault getFault(Fault fault) {
+
+ Message m = fault.getMessage();
+
+ // a fault should only have one message part.
+ Map partMap = m.getParts();
+ assert partMap.size() == 1 : "Invalid part count for fault!!";
+ Part faultPart = (Part) partMap.values().iterator().next();
+
+ // type of fault is specified either in Part's type or element attribute.
+ QName type = faultPart.getTypeName();
+ if (type == null) {
+ type = faultPart.getElementName();
+ }
+
+ return new WsdlOpFault(fault.getName(), type, hasComplexType(faultPart), _resolver);
+ }
+
+ /**
+ * private contstructor.
+ */
+ private WsdlOpFaultList() {
+ _wsdlDefinition = null;
+ _resolver = null;
+ }
+
+ /**
+ * private constructor.
+ *
+ * @param capacity
+ */
+ private WsdlOpFaultList(int capacity) {
+ this();
+ }
+
+ /**
+ * private constructor.
+ *
+ * @param c
+ */
+ private WsdlOpFaultList(Collection<WsdlOpParameter> c) {
+ this();
+ }
+
+ /**
+ * @param p
+ * @return true if part contains a complex type.
+ */
+ private boolean hasComplexType(Part p) {
+ if (p.getElementName() != null) {
+ Element schemaElement = WsdlUtils.findSchemaElement(p.getElementName(), _wsdlDefinition);
+ return !schemaElement.hasAttribute("type");
+ }
+ return false;
+ }
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameter.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,264 @@
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Operation parameter abstraction.
+ */
+public final class WsdlOpParameter extends WsdlOpReturnType implements java.io.Serializable {
+
+ public enum ParameterMode {
+ IN, OUT, INOUT, UNDEFINED
+ }
+
+ private QName _name;
+ private ParameterMode _mode;
+ private boolean _isHeader;
+ private boolean _elementFormQualified;
+
+ /**
+ * Constructor used to create operation parameters whose types do not need to
+ * be unwrapped (found in one of the types schemas). Typically used for RPC style
+ * parameters but also may be used for DOCUMENT style in some cases (BARE parameter
+ * style in use).
+ *
+ * @param name QName of the parameter.
+ * @param xmlType XML type of the parameter.
+ * @param schemaTypeElement The type element from the schema for this parameter,
+ * will be null if xmlType is a built-in schema type.
+ * @param resolver
+ */
+ WsdlOpParameter(String name, QName xmlType, Element schemaTypeElement,
+ WsdlNamespaceResolver resolver) {
+
+ setName(name, resolver);
+ _xmlType = xmlType;
+ _itemXmlType = getArrayItemType(schemaTypeElement, resolver);
+ _isArray = _itemXmlType != null;
+ _isHeader = false;
+ _mode = ParameterMode.UNDEFINED;
+ }
+
+ /**
+ * Create a new WsdlOpParameter for a simple schema type. For pararmeters
+ * of simple type, the name of the parameter corresponds to the name of the
+ * message part which defines it.
+ *
+ * @param name Name of the attribute, if a namespace ref is included it will be resolved.
+ * @param e The schema element which defines the XML type of this attribute.
+ * @param resolver
+ */
+ WsdlOpParameter(String name, Element e, WsdlNamespaceResolver resolver) {
+
+ this(e, resolver);
+ setName(name, resolver);
+ }
+
+ /**
+ * Create a new WsdlOpParameter for a complex schema type.
+ *
+ * @param e The schema element which defines the XML type of this attribute.
+ * @param resolver
+ */
+ WsdlOpParameter(Element e, WsdlNamespaceResolver resolver) {
+
+ _mode = ParameterMode.UNDEFINED;
+ _isArray = isArray(e);
+ _isHeader = false;
+
+ if (e.hasAttribute(WsdlUtils.NAME_ATTR) && e.hasAttribute(WsdlUtils.ELEMENT_TYPE_ATTR)) {
+ setName(e.getAttribute(WsdlUtils.NAME_ATTR), resolver);
+ _xmlType = resolver.getTypeQName(e.getAttribute(WsdlUtils.ELEMENT_TYPE_ATTR));
+ }
+ else {
+ if (e.hasAttribute(WsdlUtils.ELEMENT_REF_ATTR)) {
+ _xmlType = resolver.getTypeQName(e.getAttribute(WsdlUtils.ELEMENT_REF_ATTR));
+ _name = new QName("", _xmlType.getLocalPart());
+ }
+ else {
+ throw new RuntimeException("invalid element: " + e);
+ }
+ }
+ }
+
+ /**
+ * Get the name of this parameter.
+ *
+ * @return QName.
+ */
+ public QName getName() {
+ return _name;
+ }
+
+ /**
+ * Get the mode of this parameter.
+ *
+ * @return ParameterMode
+ */
+ public ParameterMode getMode() {
+ return _mode;
+ }
+
+ /**
+ * @return True if this parameter is.
+ */
+ public boolean isElementFormQualified() {
+ return _elementFormQualified;
+ }
+
+ /**
+ * Is this parameter a SOAP header parameter?
+ *
+ * @return true if it is.
+ */
+ public boolean isHeader() {
+ return _isHeader;
+ }
+
+ /**
+ * Does this element represent an array type?
+ *
+ * @param e Element to check.
+ * @return true if this element represents an array type.
+ */
+ private boolean isArray(Element e) {
+
+ if (e.hasAttribute(WsdlUtils.MAXOCCURS_ATTR)
+ && !"1".equals(e.getAttribute(WsdlUtils.MAXOCCURS_ATTR))) {
+ return true;
+ }
+
+ if (e.hasAttribute(WsdlUtils.MINOCCURS_ATTR)) {
+ String minOccurs = e.getAttribute(WsdlUtils.MINOCCURS_ATTR);
+ try {
+ int i = new Integer(minOccurs);
+ if (i > 1) {
+ return true;
+ }
+ }
+ catch (NumberFormatException nfe) {
+ // don't fail - just means minOccurs isn't set
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method differs from the isArray(e) method in that it is checking
+ * a schema type to see if it is an array type. In order to be an array type
+ * it must be a complex type which includes a sequence of a single element which
+ * has it's minoccurs and/or maxoccures attributes set to values which denote an array.
+ *
+ * @param type Either a complexType or a simpleType node from the schema.
+ * @return The QName of the array's item type, null if the type is not an array,
+ */
+ private QName getArrayItemType(Element type, WsdlNamespaceResolver resolver) {
+
+ if (type == null || "simpleElement".equals(type.getLocalName())) {
+ return null;
+ }
+
+ Element sequence = DomUtils.getChildElementByName(type, "sequence");
+ if (sequence != null) {
+ return getArrayItemTypeFromSequence(sequence, resolver);
+ }
+
+ Element complexContent = DomUtils.getChildElementByName(type, "complexContent");
+ if (complexContent != null) {
+ return getArrayItemTypeFromComplexContent(complexContent, resolver);
+ }
+
+ assert false : "Unexpected element type, expected 'sequence' or 'complexContent'";
+ return null;
+ }
+
+ /**
+ *
+ * @param sequenceElement
+ * @param resolver
+ * @return QName
+ */
+ private QName getArrayItemTypeFromSequence(Element sequenceElement, WsdlNamespaceResolver resolver) {
+
+ Element element = DomUtils.getChildElementByName(sequenceElement, "element");
+ if (element == null) {
+ return null;
+ }
+ if (!isArray(element)) {
+ return null;
+ }
+ return resolver.getTypeQName(element.getAttribute("type"));
+ }
+
+ /**
+ *
+ * @param ccElement
+ * @param resolver
+ * @return QName
+ */
+ private QName getArrayItemTypeFromComplexContent(Element ccElement, WsdlNamespaceResolver resolver) {
+
+ Element restriction = DomUtils.getChildElementByName(ccElement, "restriction");
+ if (restriction == null) {
+ return null;
+ }
+
+ String base = restriction.getAttribute("base");
+ if (!"soapenc:Array".equals(base)) {
+ return null;
+ }
+
+ Element attribute = DomUtils.getChildElementByName(restriction, "attribute");
+ if (attribute == null) {
+ return null;
+ }
+
+ String arrayType = attribute.getAttribute("wsdl:arrayType");
+ if (arrayType == null) {
+ return null;
+ }
+ return resolver.getTypeQName(arrayType);
+ }
+
+ /**
+ * Mark this parameter as a SOAP header parameter.
+ */
+ void setHeader() {
+ _isHeader = true;
+ }
+
+ /**
+ * Set the mode of this parameter (IN/OUT/INOUT).
+ *
+ * @param mode the mode to set.
+ */
+ public void setMode(ParameterMode mode) {
+ _mode = mode;
+ }
+
+ /**
+ * Set the name of this parameter.
+ *
+ * @param name parameter name.
+ * @param resolver
+ */
+ void setName(String name, WsdlNamespaceResolver resolver) {
+ _name = resolver.getTypeQName(name);
+ _elementFormQualified = resolver.isElementFormQualified(_name.getNamespaceURI());
+ }
+
+ /**
+ * Override the equals method.
+ *
+ * @param o Object to compare to.
+ * @return true if equal
+ */
+ public boolean equals(Object o) {
+ if (o instanceof WsdlOpParameter) {
+ return _name.equals(((WsdlOpParameter) o).getName());
+ }
+ return false;
+ }
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpParameterList.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import org.w3c.dom.Element;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * This class represents the list of parameters for an operaiton.
+ */
+public final class WsdlOpParameterList extends ArrayList<WsdlOpParameter>
+{
+
+ private final Definition _wsdlDefinition;
+ private final Operation _operation;
+ private final WsdlNamespaceResolver _resolver;
+ private final HashSet<String> _headerNames;
+
+ private WsdlOperation.SOAPParameterStyle _parameterStyle;
+ private WsdlOpParameter _returnParam;
+ private boolean _outOnly = false;
+
+ /**
+ * Constructor.
+ *
+ * @param op Operation this arg list is for.
+ * @param binding Binding for the operation.
+ * @param wsdlDefinition Wsdl definition.
+ */
+ WsdlOpParameterList(Operation op, Binding binding,
+ Definition wsdlDefinition, WsdlNamespaceResolver resolver) {
+
+ _wsdlDefinition = wsdlDefinition;
+ _resolver = resolver;
+ _returnParam = null;
+ _operation = op;
+ _parameterStyle = WsdlOperation.SOAPParameterStyle.BARE;
+ _headerNames = WsdlUtils.getSOAPHeaders(binding, op.getName());
+ }
+
+ /**
+ * Was there a 'return type' parameter in this list? If so return its
+ * XML type.
+ *
+ * @return QName of the XML type, null if not present.
+ */
+ WsdlOpReturnType getReturnType() {
+ return _returnParam;
+ }
+
+ /**
+ * Get the style (WRAPPED or BARE) of the parameters in this list.
+ *
+ * @return WRAPPED or BARE enum type.
+ */
+ WsdlOperation.SOAPParameterStyle getParameterStyle() {
+ return _parameterStyle;
+ }
+
+ /**
+ * Add a parameter to this list.
+ *
+ * @param p Message part defining the parameter.
+ * @param requestPart tue if this parameter is part of an reqest message.
+ * @return true if this collection was modified as a result of this call.
+ */
+ boolean add(Part p, boolean requestPart) {
+
+ List<WsdlOpParameter> params = getParameter(p, requestPart);
+ for (WsdlOpParameter op : params) {
+
+ if (_headerNames.contains(op.getName().getLocalPart())) {
+ op.setHeader();
+ }
+
+ if (requestPart) {
+ // just set mode and add
+ op.setMode(WsdlOpParameter.ParameterMode.IN);
+ add(op);
+ }
+ else {
+ addOutputParameter(op);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Generate a WsdlOpParameter from the message part.
+ *
+ * @param part A list of message part.
+ * @param requesPart true if part from request message.
+ */
+ private List<WsdlOpParameter> getParameter(Part part, boolean requesPart) {
+
+ List<WsdlOpParameter> params = new ArrayList<WsdlOpParameter>();
+
+ if (part.getElementName() != null) {
+ if (WsdlUtils.isWrappedParameterStyle(_operation.getName(), !requesPart, part.getName())) {
+ _parameterStyle = WsdlOperation.SOAPParameterStyle.WRAPPED;
+ }
+ params.addAll(unwrapPartElement(part));
+ }
+ else {
+ params.add(new WsdlOpParameter(part.getName(), part.getTypeName(),
+ WsdlUtils.findSchemaType(part.getTypeName(), _wsdlDefinition), _resolver));
+ }
+ return params;
+ }
+
+ /**
+ * Add an response param to the parameter list. Some rules for determining
+ * if the request param is the return value for the operation:
+ * <p/>
+ * <ol>
+ * <li>If the operation has 'parameterOrder' set:</li>
+ * <ol>
+ * <li>If the response parameter is not in the operation's parameterOrder
+ * attribute, then it represents the return value of the call.
+ * If there is no such part, then the method does not return a value.</li>
+ * b) If the response parameter is found in the parameterOrder list,
+ * add it as an OUT mode parameter.</li>
+ * </ol>
+ * <li>If the operation does not have 'parameterOrder' set:</li>
+ * <ol>
+ * <li>If there is a single part in the output message that is not also
+ * in the input message it is mapped to the return type of the method.</li>
+ * <li>If there is more than one part in the output message that is not in
+ * the input message they are all mapped as out arguments and the return
+ * type of the method is void.</li>
+ * </ol></ol>
+ *
+ * @param responseParam
+ */
+ private void addOutputParameter(WsdlOpParameter responseParam) {
+
+ //
+ // is this in IN/OUT param ?
+ //
+ for (WsdlOpParameter param : this) {
+ if (param.equals(responseParam)) {
+ param.setMode(WsdlOpParameter.ParameterMode.INOUT);
+ return;
+ }
+ }
+
+ // if made it to here it is an out mode param
+ responseParam.setMode(WsdlOpParameter.ParameterMode.OUT);
+
+ List parameterOrder = _operation.getParameterOrdering();
+ if (parameterOrder != null) {
+ if (!parameterOrder.contains(responseParam.getName().getLocalPart())) {
+ assert _returnParam == null : "Invalid state!!!";
+ _returnParam = responseParam;
+ }
+ else {
+ add(responseParam);
+ }
+ }
+ else {
+ if (_returnParam == null && !_outOnly) {
+ _returnParam = responseParam;
+ }
+ else if (_returnParam != null) {
+ // move _returnParam into main arg list
+ add(_returnParam);
+ _returnParam = null;
+ _outOnly = true;
+
+ add(responseParam);
+ }
+ else {
+ add(responseParam);
+ }
+ }
+ }
+
+ /**
+ * private contstructor.
+ */
+ private WsdlOpParameterList() {
+ _wsdlDefinition = null;
+ _resolver = null;
+ _operation = null;
+ _headerNames = null;
+ }
+
+ /**
+ * private constructor.
+ *
+ * @param capacity
+ */
+ private WsdlOpParameterList(int capacity) {
+ this();
+ }
+
+ /**
+ * private constructor.
+ *
+ * @param c
+ */
+ private WsdlOpParameterList(Collection<WsdlOpParameter> c) {
+ this();
+ }
+
+ /**
+ * Using the proper schema from the WSDL's types section, resolve a Part's element attribute
+ * value to a concrete XML type.
+ *
+ * @param p A message part.
+ * @return A list of parameters resulting from the schema type -- typically the list will only
+ * contains a single parameter.
+ */
+ private List<WsdlOpParameter> unwrapPartElement(Part p) {
+
+ ArrayList<WsdlOpParameter> unwrappedParams = new ArrayList<WsdlOpParameter>();
+ Element schemaElement = WsdlUtils.findSchemaElement(p.getElementName(), _wsdlDefinition);
+
+ if (schemaElement.hasAttribute("type")) {
+ // this is a simple type
+ unwrappedParams.add(new WsdlOpParameter(p.getName(), schemaElement, _resolver));
+ }
+ else {
+ // this is a complex type
+ Element complex = DomUtils.getChildElementByName(schemaElement, "complexType");
+ Element sequence = DomUtils.getChildElementByName(complex, "sequence");
+
+ //todo: verify this block
+ // may occaisionally find a <complex/> tag map to empty but this may be a bug in WSM
+ if (sequence == null) {
+ return unwrappedParams;
+ }
+
+ List<Element> seqElements = DomUtils.getChildElementsByName(sequence, "element");
+
+ for (Element e : seqElements) {
+ WsdlOpParameter op = new WsdlOpParameter(e, _resolver);
+
+ // special case for bare arrays, change the name of the param
+ // to the name of the complex type.
+ if (op.isArray() && _parameterStyle == WsdlOperation.SOAPParameterStyle.BARE) {
+ op.setName(schemaElement.getAttribute("name"), _resolver);
+ }
+ unwrappedParams.add(op);
+ }
+ }
+ return unwrappedParams;
+ }
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpReturnType.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpReturnType.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpReturnType.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOpReturnType.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents the return value for an operation.
+ */
+public class WsdlOpReturnType implements java.io.Serializable
+{
+ protected QName _xmlType;
+ protected boolean _isArray;
+
+ // used for the xmlType of an Array's items
+ protected QName _itemXmlType;
+
+ /**
+ * Constructor.
+ */
+ protected WsdlOpReturnType() {
+ }
+
+ /**
+ * Get the Xml type.
+ *
+ * @return QName for the XML type.
+ */
+ public QName getXmlType() {
+ return _xmlType;
+ }
+
+ /**
+ * If the return type is an array, get the xml type of the
+ * items in the array.
+ * @return QName for the item XML type, null if not an array.
+ */
+ public QName getItemXmlType() {
+ return _itemXmlType;
+ }
+
+ /**
+ * Is this an array type?
+ *
+ * @return true if this is an array type.
+ */
+ public boolean isArray() {
+ return _isArray;
+ }
+
+
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOperation.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOperation.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOperation.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlOperation.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,209 @@
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * WSDL Operation abstraction used by webservice control.
+ */
+public final class WsdlOperation implements java.io.Serializable
+{
+
+ /**
+ * Parameter style enumeration.
+ */
+ public enum SOAPParameterStyle
+ {
+ BARE, WRAPPED
+ }
+
+ /**
+ * SOAP Binding style enumeration.
+ */
+ public enum SOAPBindingStyle
+ {
+ DOCUMENT, RPC
+ }
+
+ /**
+ * SOAP Binding use enumeration.
+ */
+ public enum SOAPBindingUse
+ {
+ LITERAL, ENCODED
+ }
+
+ private final SOAPBindingStyle _bindingStyle;
+ private final SOAPBindingUse _bindingUse;
+ private final QName _operationName;
+ private final WsdlOpParameterList _params;
+ private final WsdlOpFaultList _faults;
+ private final SOAPParameterStyle _parameterStyle;
+ private final WsdlOpReturnType _returnType;
+
+ private boolean _oneway;
+
+
+ /**
+ * Create a new wsdl operation instance for the specified binding and operation.
+ *
+ * @param binding Binding for the operation.
+ * @param op The operation.
+ * @param wsdlDefinition
+ * @param resolver
+ */
+ WsdlOperation(Binding binding, Operation op,
+ Definition wsdlDefinition, WsdlNamespaceResolver resolver) {
+
+ _operationName = new QName(resolver.getTargetNamespace(), op.getName());
+ _oneway = true;
+
+ String soapBindingStyle = WsdlUtils.getSOAPBindingStyle(binding);
+ if ("rpc".equals(soapBindingStyle)) {
+ _bindingStyle = SOAPBindingStyle.RPC;
+ }
+ else {
+ _bindingStyle = SOAPBindingStyle.DOCUMENT;
+ }
+
+ String soapBindingUse = WsdlUtils.getSOAPBindingUse(binding, op.getName());
+ if ("encoded".equals(soapBindingUse)) {
+ _bindingUse = SOAPBindingUse.ENCODED;
+ }
+ else {
+ _bindingUse = SOAPBindingUse.LITERAL;
+ }
+
+ _params = new WsdlOpParameterList(op, binding, wsdlDefinition, resolver);
+ loadParameters(op);
+
+ _faults = new WsdlOpFaultList(wsdlDefinition, resolver);
+ loadFaults(op);
+
+ _returnType = _params.getReturnType();
+ _parameterStyle = _params.getParameterStyle();
+ }
+
+ /**
+ * Get the faults defined for this operation.
+ *
+ * @return WsdlOpFaultList
+ */
+ public WsdlOpFaultList getFaults() {
+ return _faults;
+ }
+
+ /**
+ * Get the operation's QName.
+ *
+ * @return Operation QName.
+ */
+ public QName getOperationName() {
+ return _operationName;
+ }
+
+ /**
+ * Get the SOAPBinding Style.
+ *
+ * @return A SOAPBindingStyle enum type value.
+ */
+ public SOAPBindingStyle getSOAPBindingStyle() {
+ return _bindingStyle;
+ }
+
+ /**
+ * Get the SOAPBinding use.
+ *
+ * @return A SOAPBindingUse enum type value.
+ */
+ public SOAPBindingUse getSOAPBindingUse() {
+ return _bindingUse;
+ }
+
+ /**
+ * Get the SOAPParameter style.
+ *
+ * @return A SOAPParameterStyle enum type value.
+ */
+ public SOAPParameterStyle getSOAPParameterStyle() {
+ return _parameterStyle;
+ }
+
+ /**
+ * Get the parameter list for this operation.
+ *
+ * @return An ordered list of parameters, empty list if this operation has no parameters.
+ */
+ public List<WsdlOpParameter> getParameters() {
+ return _params;
+ }
+
+ /**
+ * Get the XML return type for this operation.
+ *
+ * @return A WsdlOpReturnType instance, null if this operation does not have a return value.
+ */
+ public WsdlOpReturnType getReturnType() {
+ return _returnType;
+ }
+
+ /**
+ * Is this a oneway operation?
+ *
+ * @return true if this is a oneway operation.
+ */
+ public boolean isOneway() {
+ return _oneway;
+ }
+
+ /**
+ * Create the fault list for this operation.
+ *
+ * @param op Operation
+ */
+ private void loadFaults(Operation op) {
+ Map faultMap = op.getFaults();
+ for (Object o : faultMap.values()) {
+ _faults.add((Fault) o);
+ }
+ }
+
+ /**
+ * Create the parameter list for this operations parameter set.
+ *
+ * @param op Operation.
+ */
+ private void loadParameters(Operation op) {
+
+ Input input = op.getInput();
+ if (input != null) {
+ Message in = input.getMessage();
+ List paramOrdering = op.getParameterOrdering();
+ List inParts = in.getOrderedParts(paramOrdering);
+
+ for (Object p : inParts) {
+ _params.add((Part) p, true);
+ }
+ }
+
+ Output output = op.getOutput();
+ if (output != null) {
+ Message out = output.getMessage();
+ List outParts = out.getOrderedParts(null);
+
+ for (Object p : outParts) {
+ _oneway = false;
+ _params.add((Part) p, false);
+ }
+ }
+ }
+}
Added: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlUtils.java?rev=355529&view=auto
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlUtils.java (added)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/wsdl/WsdlUtils.java Fri Dec 9 08:21:32 2005
@@ -0,0 +1,322 @@
+package org.apache.beehive.controls.system.webservice.wsdl;
+
+import org.w3c.dom.Element;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.ElementExtensible;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ */
+final class WsdlUtils
+{
+
+ // extensibility element names
+ static final String SOAP_BINDING_ELEMENT_NAME = "binding";
+ static final String SCHEMA_ELEMENT_NAME = "schema";
+ static final String SOAPBODY_ELEMENT_NAME = "body";
+ static final String SOAPHEADER_ELEMENT_NAME = "header";
+
+ // return values
+ static final String SOAP_BINDING_DEFAULT = "document";
+
+ // schema names
+ static final String ELEMENT_FORM_DEFAULT_ATTR = "elementFormDefault";
+ static final String TARGET_NAMESPACE_ATTR = "targetNamespace";
+ static final String ELEMENT_FORM_QUALIFIED = "qualified";
+ static final String ELEMENT_NAME = "element";
+ static final String COMPLEX_TYPE_NAME = "complexType";
+ static final String SIMPLE_TYPE_NAME = "simpleType";
+ static final String NAME_ATTR = "name";
+ static final String ELEMENT_TYPE_ATTR = "type";
+ static final String ELEMENT_REF_ATTR = "ref";
+ static final String MAXOCCURS_ATTR = "maxOccurs";
+ static final String MINOCCURS_ATTR = "minOccurs";
+
+
+ /**
+ * Return a list of of all schemas defined by the WSDL definition.
+ *
+ * @param wsdlDefinition
+ * @return A list of javax.wsdl.extension.schema.Schema elements.
+ */
+ static List getSchemas(Definition wsdlDefinition) {
+
+ if (wsdlDefinition.getTypes() == null) {
+ return Collections.EMPTY_LIST;
+ }
+ return findExtensibilityElements(wsdlDefinition.getTypes(), SCHEMA_ELEMENT_NAME);
+ }
+
+ /**
+ * Get the SOAP address location for the specified port.
+ *
+ * @param p Port.
+ * @return String.
+ */
+ static String getSOAPAddress(Port p) {
+ ExtensibilityElement e = findExtensibilityElement(p, "address");
+ return ((SOAPAddress) e).getLocationURI();
+ }
+
+ /**
+ * Get the SOAPBinding style for the specifed wsdl Port.
+ *
+ * @param binding WSDL binding instance.
+ * @return String either 'document' or 'rpc', if not found in WSDL default to 'document'.
+ */
+ static String getSOAPBindingStyle(Binding binding) {
+ String style = SOAP_BINDING_DEFAULT;
+ ExtensibilityElement soapBindingElem =
+ findExtensibilityElement(binding, SOAP_BINDING_ELEMENT_NAME);
+
+ if (soapBindingElem != null) {
+ style = ((SOAPBinding) soapBindingElem).getStyle();
+ }
+ return style;
+ }
+
+ /**
+ * Get the Use type for the specified operation.
+ *
+ * @param binding The Binding for the operation.
+ * @param operationName The name of the operation.
+ * @return Either 'literal' or 'encoded'.
+ * @throws RuntimeException If the use type cannot be determined.
+ */
+ static String getSOAPBindingUse(Binding binding, String operationName) {
+
+ BindingOperation bindingOperation = binding.getBindingOperation(operationName, null, null);
+
+ if (bindingOperation == null) {
+ throw new IllegalArgumentException("Can not find operation: " + operationName);
+ }
+
+ //
+ // first try getting the use setting from the input message
+ //
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ if (bindingInput != null) {
+ ExtensibilityElement soapBodyElem =
+ WsdlUtils.findExtensibilityElement(bindingInput, SOAPBODY_ELEMENT_NAME);
+ return ((SOAPBody) soapBodyElem).getUse();
+ }
+
+ //
+ // if there was no input message try getting the use from the output message
+ //
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+ if (bindingOutput != null) {
+ ExtensibilityElement soapBodyElem =
+ WsdlUtils.findExtensibilityElement(bindingOutput, SOAPBODY_ELEMENT_NAME);
+ return ((SOAPBody) soapBodyElem).getUse();
+ }
+
+ throw new RuntimeException("Unable to determine SOAP use for operation: " + operationName);
+ }
+
+ /**
+ * Does this parameter have a parameter style of WRAPPED ? It does if the <tt>name</tt> attribute of
+ * the part is NOT the same as its operation name.
+ *
+ * @param operationName Name of the part's operation.
+ * @param outputParam true if this is an output parameter.
+ * @param messagePartName Name of the message part.
+ * @return true if parameter style is wrapped.
+ */
+ static boolean isWrappedParameterStyle(String operationName, boolean outputParam, String messagePartName) {
+
+ if (outputParam) {
+ if (messagePartName.equals(operationName + "Response")) {
+ return false;
+ }
+ }
+ else {
+ if (messagePartName.equals(operationName)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Find the element in its schema from the types section of the WSDL.
+ *
+ * @param elementName Name of element to find.
+ * @param wsdlDefinition Wsdl definition.
+ * @return The element node.
+ * @throws IllegalArgumentException if element cannot be found in the schema.
+ */
+ static Element findSchemaElement(QName elementName, Definition wsdlDefinition) {
+
+ Schema s = getSchema(wsdlDefinition, elementName.getNamespaceURI());
+ Element schemaRoot = s.getElement();
+ List<Element> elements = DomUtils.getChildElementsByName(schemaRoot, ELEMENT_NAME);
+
+ Element schemaElement = null;
+ for (Element e : elements) {
+ String schemaElementName = e.getAttribute(NAME_ATTR);
+ if (elementName.getLocalPart().equals(schemaElementName)) {
+ schemaElement = e;
+ break;
+ }
+ }
+
+ if (schemaElement == null) {
+ throw new IllegalArgumentException("Could not find element in schema!");
+ }
+ return schemaElement;
+ }
+
+ /**
+ *
+ * @param typeName
+ * @param wsdlDefinition
+ * @return null if type not found.
+ */
+ static Element findSchemaType(QName typeName, Definition wsdlDefinition) {
+
+ Schema s = getSchema(wsdlDefinition, typeName.getNamespaceURI());
+ if (s == null) {
+ return null;
+ }
+
+ Element schemaRoot = s.getElement();
+ // get all simple and complex types defined at the top-level.
+ List<Element> types = DomUtils.getChildElementsByName(schemaRoot, COMPLEX_TYPE_NAME);
+ types.addAll(DomUtils.getChildElementsByName(schemaRoot, SIMPLE_TYPE_NAME));
+
+ Element schemaType = null;
+ for (Element t : types) {
+ String schemaTypeName = t.getAttribute(NAME_ATTR);
+ if (typeName.getLocalPart().equals(schemaTypeName)) {
+ schemaType = t;
+ break;
+ }
+ }
+ return schemaType;
+ }
+
+
+ /**
+ * Build a HashSet of soap header names for the specified operation and binding.
+ *
+ * @param binding Binding of the operation.
+ * @param operationName Name of the operation.
+ * @return HashSet of soap header names, empty set if no headers present.
+ */
+ static HashSet<String> getSOAPHeaders(Binding binding, String operationName) {
+
+ List<ExtensibilityElement> headers = new ArrayList<ExtensibilityElement>();
+ BindingOperation bindingOperation = binding.getBindingOperation(operationName, null, null);
+ if (bindingOperation == null) {
+ throw new IllegalArgumentException("Can not find operation: " + operationName);
+ }
+
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ if (bindingInput != null) {
+ headers.addAll(WsdlUtils.findExtensibilityElements(bindingInput, SOAPHEADER_ELEMENT_NAME));
+ }
+
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+ if (bindingOutput != null) {
+ headers.addAll(WsdlUtils.findExtensibilityElements(bindingOutput, SOAPHEADER_ELEMENT_NAME));
+ }
+
+ HashSet<String> headerSet = new HashSet<String>(headers.size());
+ for (ExtensibilityElement e : headers) {
+ headerSet.add(((SOAPHeader) e).getPart());
+ }
+
+ return headerSet;
+ }
+
+ /**
+ * Find the specified extensibility element, if more than one with the specified name exists in the list,
+ * return the first one found.
+ *
+ * @param extensibleElement
+ * @param elementType Name of the extensiblity element to find.
+ * @return ExtensibilityElement
+ */
+ private static ExtensibilityElement findExtensibilityElement(ElementExtensible extensibleElement,
+ String elementType) {
+
+ List extensibilityElements = extensibleElement.getExtensibilityElements();
+ if (extensibilityElements != null) {
+ for (Object o : extensibilityElements) {
+ ExtensibilityElement element = (ExtensibilityElement) o;
+ if (element.getElementType().getLocalPart().equalsIgnoreCase(elementType)) {
+ return element;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Find all of the extensibility elements with the specified name.
+ *
+ * @param elementType
+ * @param elementType Name of the extensiblity element to find.
+ * @return List of ExtensibilityElements, may be empty.
+ */
+ private static List<ExtensibilityElement> findExtensibilityElements(ElementExtensible extensibleElement,
+ String elementType) {
+
+ ArrayList<ExtensibilityElement> elements = new ArrayList<ExtensibilityElement>();
+ List extensibilityElements = extensibleElement.getExtensibilityElements();
+
+ if (extensibilityElements != null) {
+ for (Object o : extensibilityElements) {
+ ExtensibilityElement element = (ExtensibilityElement) o;
+
+ if (element.getElementType().getLocalPart().equalsIgnoreCase(elementType)) {
+ elements.add(element);
+ }
+ }
+ }
+ return elements;
+ }
+
+ /**
+ * Get the schema with the specified target namespace.
+ *
+ * @param wsdlDefinition Wsdl definition.
+ * @param targetNamespace target namespace of the schema to get.
+ * @return null if not found.
+ */
+ private static Schema getSchema(Definition wsdlDefinition, String targetNamespace) {
+
+ if (wsdlDefinition.getTypes() == null) {
+ return null;
+ }
+
+ List<ExtensibilityElement> schemas =
+ WsdlUtils.findExtensibilityElements(wsdlDefinition.getTypes(), "schema");
+
+ for (ExtensibilityElement e : schemas) {
+ Element schemaRoot = ((Schema) e).getElement();
+ String tns = schemaRoot.getAttribute("targetNamespace");
+ if (targetNamespace.equals(tns)) {
+ return (Schema) e;
+ }
+ }
+ return null;
+ }
+}
Modified: beehive/trunk/system-controls/systemcontrols-imports.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/systemcontrols-imports.xml?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/systemcontrols-imports.xml (original)
+++ beehive/trunk/system-controls/systemcontrols-imports.xml Fri Dec 9 08:21:32 2005
@@ -20,6 +20,7 @@
<fileset file="${beehive.home}/wsm/build/jars/beehive-wsdltypes.jar"/>
<fileset file="${beehive.home}/wsm/build/jars/beehive-jsr181.jar"/>
<path refid="servlet.dependency.path"/>
+ <fileset dir="${external.dir}/webservice" includes="*.jar"/>
<fileset dir="${beehive.home}/wsm/external/axis-1.2" includes="*.jar"/>
</path>
Modified: beehive/trunk/system-controls/test/src/webservice/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/build.xml?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/build.xml (original)
+++ beehive/trunk/system-controls/test/src/webservice/build.xml Fri Dec 9 08:21:32 2005
@@ -78,7 +78,7 @@
</taskdef>
<target name="drt_debug">
- <antcall target="build-client"/>
+<!-- <antcall target="build-client"/> -->
<junit failureproperty="drtfailed"
printsummary="on"
tempdir="${client.build}"
@@ -90,7 +90,6 @@
<formatter type="plain"/>
<batchtest filtertrace="off" todir="${log.dir}">
<fileset dir="${junit-source.dir}">
-<!-- <include name="**/SanityTest.java"/> -->
<include name="**/SoapMarshallingRpcLitArrayTypesTest.java"/>
</fileset>
</batchtest>
@@ -98,6 +97,15 @@
</target>
+ <target name="generate_jcx_dbg">
+
+ <taskdef name="scgen"
+ classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
+ classpathref="client.classpath"/>
+ <scgen srcdir="/tmp/wsdls" destdir="${client.jcxgensrc}" destPackageName="${client.jcxgen.packageName}"/>
+ </target>
+
+
<target name="build">
<ant dir="jcxgen-tests" target="build" inheritAll="false"/>
<antcall target="build-webapp"/>
@@ -153,7 +161,7 @@
</fileset>
</batchtest>
</junit>
- <antcall target="undeploy-webapps"/>
+ <antcall target="undeploy"/>
<stop-server/>
</sequential>
</parallel>
@@ -226,6 +234,13 @@
<mkdir dir="${webapp.lib}"/>
<deploy-wsm webappDir="${webapp.build.dir}"/>
+ <!-- add the jars necessary for attachment support -->
+ <copy todir="${webapp.lib}">
+ <fileset dir="${external.dir}/webservice">
+ <include name="**/*.jar"/>
+ </fileset>
+ </copy>
+
<!-- gen xbeans for webapp -->
<build-schemas srcdir="${webapp.schemas}" destdir="${webapp.classes}"/>
@@ -242,6 +257,13 @@
tempdir="${webapp.beansrc}"
classpathref="client.classpath"/>
+ <copy todir="${webapp.classes}">
+ <fileset dir="${webapp.ws.src}">
+ <include name="**/*.gif"/>
+ <include name="**/*.jpg"/>
+ </fileset>
+ </copy>
+
<echo message="----------------------------------------------------"/>
<echo message="| Web service control drt webapp build ending |"/>
<echo message="----------------------------------------------------"/>
@@ -264,6 +286,8 @@
ignoreDuplicatesInNamespaces="http://soapMarshalling,http://header">
<fileset dir="${wsdls.dir}">
<include name="*.wsdl"/>
+ <exclude name="ImagesDocLitWrapped.wsdl"/>
+ <exclude name="ImagesRpcLit.wsdl"/>
</fileset>
</xmlbeanbuild>
@@ -316,6 +340,10 @@
<check-wsdl webservicePath="handlers" webserviceName="HandlerRpcLitEndpoint" drtWsdlDir="${wsdls.dir}"/>
<check-wsdl webservicePath="handlers" webserviceName="HandlerRpcEncEndpoint" drtWsdlDir="${rpc.encoded.wsdls.dir}"/>
+ <check-wsdl webservicePath="attachments/images" webserviceName="ImagesDocLitWrapped" drtWsdlDir="${wsdls.dir}"/>
+ <check-wsdl webservicePath="attachments/images" webserviceName="ImagesRpcLit" drtWsdlDir="${wsdls.dir}"/>
+ <check-wsdl webservicePath="attachments/images" webserviceName="ImagesRpcEnc" drtWsdlDir="${rpc.encoded.wsdls.dir}"/>
+
<check-wsdl webservicePath="soapMarshalling" webserviceName="SoapMarshallingRpcEnc"
drtWsdlDir="${rpc.encoded.wsdls.dir}"/>
<check-wsdl webservicePath="soapMarshalling" webserviceName="SoapMarshallingRpcEncArrayTypes"
@@ -398,10 +426,6 @@
</waitfor>
</target>
- <target name="undeploy-webapps">
- <undeploy-webapp contextPath="${context.path}"/>
- </target>
-
<target name="deploy" description="Deploy webapp">
<echo message="** deploying ${webapp.build.dir} to ${context.path} **"/>
<deploy-webapp webappDir="${webapp.build.dir}" contextPath="${context.path}"/>
@@ -410,11 +434,6 @@
<target name="undeploy" description="Undeploy webapp">
<undeploy-webapp contextPath="${context.path}"/>
</target>
-
- <target name="redeploy" description="Redeploy webapp">
- <redeploy-webapp contextPath="${context.path}"/>
- </target>
-
<!-- =================================================================== -->
<!-- Check a DRT wsdl against the one generated from the webservice -->
Modified: beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitBareWsdlTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitBareWsdlTest.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitBareWsdlTest.java (original)
+++ beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitBareWsdlTest.java Fri Dec 9 08:21:32 2005
@@ -49,8 +49,8 @@
public void testMethodSignatures() throws Exception {
testMethodSignature("changeAddressInBody", "int", GenericHolder.class);
testMethodSignature("changeAddressInHeader", "int", GenericHolder.class);
- testMethodSignature("createAddressInBody", "void", GenericHolder.class, IntHolder.class);
- testMethodSignature("createAddressInHeader", "void", GenericHolder.class, IntHolder.class);
+ testMethodSignature("createAddressInBody", "int", GenericHolder.class);
+ testMethodSignature("createAddressInHeader", "int", GenericHolder.class);
testMethodSignature("returnAddressFromBody", "doclitbar.web.complex.Address", doclitbar.web.complex.Address.class);
testMethodSignature("returnAddressFromHeader", "doclitbar.web.complex.Address", doclitbar.web.complex.Address.class);
testMethodSignature("throwAddressException", "int", int.class);
Modified: beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java (original)
+++ beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java Fri Dec 9 08:21:32 2005
@@ -49,7 +49,7 @@
public void testMethodSignatures() throws Exception {
testMethodSignature("changeAddressInBody", "int", GenericHolder.class);
testMethodSignature("changeAddressInHeader", "int", GenericHolder.class);
- testMethodSignature("createAddressInBody", "void", GenericHolder.class, IntHolder.class);
+ testMethodSignature("createAddressInBody", "void", IntHolder.class, GenericHolder.class);
testMethodSignature("createAddressInHeader", "void", GenericHolder.class, IntHolder.class);
testMethodSignature("returnAddressFromBody", "doclitwrap.web.complex.Address", doclitwrap.web.complex.Address.class);
testMethodSignature("returnAddressFromHeader", "doclitwrap.web.complex.Address", doclitwrap.web.complex.Address.class);
Modified: beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java (original)
+++ beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java Fri Dec 9 08:21:32 2005
@@ -48,8 +48,8 @@
public void testMethodSignatures() throws Exception {
testMethodSignature("changeAddressInBody", "int", GenericHolder.class);
testMethodSignature("changeAddressInHeader", "int", GenericHolder.class);
- testMethodSignature("createAddressInBody", "void", GenericHolder.class, IntHolder.class);
- testMethodSignature("createAddressInHeader", "void", GenericHolder.class, IntHolder.class);
+ testMethodSignature("createAddressInBody", "int", GenericHolder.class);
+ testMethodSignature("createAddressInHeader", "int", GenericHolder.class);
testMethodSignature("returnAddressFromBody", "org.apache.beehive.web.webservice.rpcExamples.Address", org.apache.beehive.web.webservice.rpcExamples.Address.class);
testMethodSignature("returnAddressFromHeader", "org.apache.beehive.web.webservice.rpcExamples.Address", org.apache.beehive.web.webservice.rpcExamples.Address.class);
testMethodSignature("throwAddressException", "int", int.class);
Modified: beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/wsdls/ReservedKeywordDocLit.wsdl
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/wsdls/ReservedKeywordDocLit.wsdl?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/wsdls/ReservedKeywordDocLit.wsdl (original)
+++ beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/wsdls/ReservedKeywordDocLit.wsdl Fri Dec 9 08:21:32 2005
@@ -13,7 +13,7 @@
<schema elementFormDefault="qualified"
targetNamespace="http://beehive.apache.org/reservedWords"
xmlns="http://www.w3.org/2001/XMLSchema">
- <complexType name="reservedWordsType">
+ <element name="reservedWordsType"><complexType>
<sequence>
<xsd:element name="abstract" nillable="true" type="xsd:int"/>
<xsd:element name="assert" nillable="true" type="xsd:int"/>
@@ -53,7 +53,7 @@
<xsd:element name="return" nillable="true" type="xsd:int"/>
<xsd:element name="short" nillable="true" type="xsd:int"/>
<xsd:element name="static" nillable="true" type="xsd:int"/>
-<!-- XMLBeans barfs - XMLBEANS-191 <xsd:element name="strictfp" nillable="true" type="xsd:int"/> -->
+ <!-- XMLBeans barfs - XMLBEANS-191 <xsd:element name="strictfp" nillable="true" type="xsd:int"/> -->
<xsd:element name="super" nillable="true" type="xsd:int"/>
<xsd:element name="switch" nillable="true" type="xsd:int"/>
<xsd:element name="synchronized" nillable="true" type="xsd:int"/>
@@ -72,6 +72,7 @@
<xsd:element name="Exception" nillable="true" type="xsd:int"/>
</sequence>
</complexType>
+ </element>
<xsd:element name="abstract" nillable="true" type="xsd:int"/>
<xsd:element name="assert" nillable="true" type="xsd:int"/>
@@ -111,7 +112,7 @@
<xsd:element name="return" nillable="true" type="xsd:int"/>
<xsd:element name="short" nillable="true" type="xsd:int"/>
<xsd:element name="static" nillable="true" type="xsd:int"/>
-<!-- XMLBeans barfs - XMLBEANS-191 <xsd:element name="strictfp" nillable="true" type="xsd:int"/> -->
+ <!-- XMLBeans barfs - XMLBEANS-191 <xsd:element name="strictfp" nillable="true" type="xsd:int"/> -->
<xsd:element name="super" nillable="true" type="xsd:int"/>
<xsd:element name="switch" nillable="true" type="xsd:int"/>
<xsd:element name="synchronized" nillable="true" type="xsd:int"/>
@@ -157,8 +158,9 @@
</wsdl:portType>
- <wsdl:binding name="ReservedWordsWrappedSoapBinding" type="tns:ReservedWordsWrapped">
+ <wsdl:binding name="ReservedWordsWrappedSoapBinding" type="impl:ReservedWordsWrapped">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
<wsdl:operation name="abstract">
<wsdlsoap:operation soapAction="abstract"/>
<wsdl:input name="abstractReq">
@@ -168,29 +170,30 @@
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
+
<wsdl:operation name="Exception">
<wsdlsoap:operation soapAction="Exception"/>
<wsdl:input name="ExceptionReq">
<wsdlsoap:body use="literal"/>
</wsdl:input>
- <wsdl:output name="abstractResp">
+ <wsdl:output name="ExceptionResp">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
- <!--<wsdl:operation name="dot.name">-->
- <!--<wsdlsoap:operation soapAction="dot.name"/>-->
- <!--<wsdl:input name="dot.nameReq">-->
- <!--<wsdlsoap:body use="literal"/>-->
- <!--</wsdl:input>-->
- <!--<wsdl:output name="dot.nameResp">-->
- <!--<wsdlsoap:body use="literal"/>-->
- <!--</wsdl:output>-->
- <!--</wsdl:operation>-->
+ <wsdl:operation name="dot.name">
+ <wsdlsoap:operation soapAction="dot.name"/>
+ <wsdl:input name="dot.nameReq">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="dot.nameResp">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
</wsdl:binding>
<wsdl:service name="ReservedWordsSampleService">
- <wsdl:port binding="tns:ReservedWordsWrappedeSoapBinding" name="ReservedWordsSample">
+ <wsdl:port binding="impl:ReservedWordsWrappedSoapBinding" name="ReservedWordsSample">
<wsdlsoap:address location="http://localhost:8080/ReservedWordsSampleServiceWrappedSample.jws"/>
</wsdl:port>
</wsdl:service>