Author: thomas.diesler(a)jboss.com
Date: 2006-12-06 09:11:26 -0500 (Wed, 06 Dec 2006)
New Revision: 1573
Added:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/EndpointInvocation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/SOAPMessageMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/SOAPMessageUnMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextPropertyHelper.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/UnboundHeader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java
Removed:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11DefinitionFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Reader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Writer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Reader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Writer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitionsFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLLocatorImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLWriter.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/MessageContextPropertyHelper.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitions.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/HTTPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/MessageBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/PayloadBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java
Log:
partial commit
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11DefinitionFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11DefinitionFactory.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11DefinitionFactory.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,96 +0,0 @@
-/*
-* 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.common.metadata.wsdl;
-
-// $Id$
-
-import java.net.URL;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.utils.JBossWSEntityResolver;
-import org.xml.sax.EntityResolver;
-
-import com.ibm.wsdl.xml.WSDLReaderImpl;
-
-/**
- * A factory that creates a WSDL-1.1 <code>Definition</code> from an URL.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public class WSDL11DefinitionFactory
-{
- // provide logging
- private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class);
-
- // This feature is set by default in wsdl4j, it means the object structore 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 WSDLReader that is used by this factory
- private WSDLReader wsdlReader;
-
- // Hide constructor
- private WSDL11DefinitionFactory() throws WSDLException
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- wsdlReader = wsdlFactory.newWSDLReader();
- wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
- }
-
- /** Create a new instance of a wsdl factory */
- public static WSDL11DefinitionFactory newInstance() throws WSDLException
- {
- return new WSDL11DefinitionFactory();
- }
-
- /** Set a feature on the underlying reader */
- public void setFeature(String name, boolean value) throws IllegalArgumentException
- {
- wsdlReader.setFeature(name, value);
- }
-
- /**
- * Read the wsdl document from the given URL
- */
- public Definition parse(URL wsdlLocation) throws WSDLException
- {
- if (wsdlLocation == null)
- throw new IllegalArgumentException("URL cannot be null");
-
- log.trace("parse: " + wsdlLocation.toExternalForm());
-
- EntityResolver entityResolver = new JBossWSEntityResolver();
-
- // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
- ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
-
- Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver,
wsdlLocation));
- return wsdlDefinition;
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Reader.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Reader.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Reader.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,1196 +0,0 @@
-/*
- * 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.common.metadata.wsdl;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Import;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.mime.MIMEContent;
-import javax.wsdl.extensions.mime.MIMEMultipartRelated;
-import javax.wsdl.extensions.mime.MIMEPart;
-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.wsdl.extensions.soap.SOAPOperation;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.jaxrpc.Style;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.common.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.DOMWriter;
-import org.jboss.ws.tools.JavaToXSD;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
- * @since 10-Oct-2004
- */
-public class WSDL11Reader
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDL11Reader.class);
-
- private static QName SOAP12_BINDING = new QName(Constants.NS_SOAP12,
"binding");
- private static QName SOAP12_BODY = new QName(Constants.NS_SOAP12, "body");
- private static QName SOAP12_OPERATION = new QName(Constants.NS_SOAP12,
"operation");
- private static QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12,
"address");
-
- private WSDLDefinitions destWsdl;
-
- // Maps wsdl message parts to their corresponding element names
- private Map<String, QName> messagePartToElementMap = new HashMap<String,
QName>();
-
- // Map of <ns,URL> for schemalocation keyed by namespace
- private Map<String, URL> schemaLocationsMap = new HashMap<String, URL>();
-
- private LinkedHashMap<QName, Binding> allBindings;
- private LinkedHashMap<QName, Binding> portTypeBindings;
-
- // Temporary files used by this reader.
- private List<File> tempFiles = new ArrayList<File>();
-
- /**
- * Takes a WSDL11 Definition element and converts into
- * our object graph that has been developed for WSDL20
- *
- * @param srcWsdl The src WSDL11 definition
- * @param wsdlLoc The source location, if null we cannot process imports or includes
- */
- public WSDLDefinitions processDefinition(Definition srcWsdl, URL wsdlLoc) throws
IOException
- {
- log.trace("processDefinition: " + wsdlLoc);
-
- destWsdl = new WSDLDefinitions();
- destWsdl.setWsdlTypes(new XSModelTypes());
- destWsdl.setWsdlOneOneDefinition(srcWsdl);
- destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
-
- processNamespaces(srcWsdl);
- processTypes(srcWsdl, wsdlLoc);
- processServices(srcWsdl);
-
- if (getAllDefinedBindings(srcWsdl).size() != destWsdl.getBindings().length)
- processUnreachableBindings(srcWsdl);
-
- cleanupTemporaryFiles();
-
- return destWsdl;
- }
-
- private void cleanupTemporaryFiles()
- {
- for (File current : tempFiles)
- {
- current.delete();
- }
- }
-
- // process all bindings not within service separetly
- private void processUnreachableBindings(Definition srcWsdl)
- {
- log.trace("processUnreachableBindings");
-
- Iterator it = getAllDefinedBindings(srcWsdl).values().iterator();
- while (it.hasNext())
- {
- Binding srcBinding = (Binding)it.next();
- QName srcQName = srcBinding.getQName();
-
- WSDLBinding destBinding = destWsdl.getBinding(new NCName(srcQName));
- if (destBinding == null)
- {
- processBinding(srcWsdl, srcBinding);
- }
- }
- }
-
- private void processNamespaces(Definition srcWsdl)
- {
- String targetNS = srcWsdl.getTargetNamespace();
- destWsdl.setTargetNamespace(targetNS);
-
- // Copy wsdl namespaces
- Map nsMap = srcWsdl.getNamespaces();
- Iterator iter = nsMap.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry)iter.next();
- String prefix = (String)entry.getKey();
- String nsURI = (String)entry.getValue();
- destWsdl.registerNamespaceURI(nsURI, prefix);
- }
- }
-
- private void processTypes(Definition srcWsdl, URL wsdlLoc) throws IOException
- {
- log.trace("BEGIN processTypes: " + wsdlLoc);
-
- WSDLTypes destTypes = destWsdl.getWsdlTypes();
-
- Types srcTypes = srcWsdl.getTypes();
- if (srcTypes != null && srcTypes.getExtensibilityElements().size() > 0)
- {
- List extElements = srcTypes.getExtensibilityElements();
- int len = extElements.size();
-
- for (int i = 0; i < len; i++)
- {
- ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
-
- Element domElement;
- if (extElement instanceof Schema)
- {
- domElement = ((Schema)extElement).getElement();
- }
- else if (extElement instanceof UnknownExtensibilityElement)
- {
- domElement = ((UnknownExtensibilityElement)extElement).getElement();
- }
- else
- {
- throw new WSException("Unsupported extensibility element: " +
extElement);
- }
-
- Element domElementClone = (Element)domElement.cloneNode(true);
- copyParentNamespaceDeclarations(domElementClone, domElement);
-
- String localname = domElementClone.getLocalName();
- try
- {
- if ("import".equals(localname))
- {
- processSchemaImport(destTypes, wsdlLoc, domElementClone);
- }
- else if ("schema".equals(localname))
- {
- processSchemaInclude(destTypes, wsdlLoc, domElementClone);
- }
- else
- {
- throw new IllegalArgumentException("Unsuported schema element:
" + localname);
- }
- }
- catch (IOException e)
- {
- throw new WSException("Cannot extract schema definition", e);
- }
- }
-
- if (len > 0)
- {
- JavaToXSD jxsd = new JavaToXSD();
- JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap);
- WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel);
- }
- }
- else
- {
- log.trace("Empty wsdl types element, processing imports");
- Iterator it = srcWsdl.getImports().values().iterator();
- while (it.hasNext())
- {
- List<Import> srcImports = (List<Import>)it.next();
- for (Import srcImport : srcImports)
- {
- Definition impDefinition = srcImport.getDefinition();
- String impLoc = impDefinition.getDocumentBaseURI();
- processTypes(impDefinition, new URL(impLoc));
- }
- }
- }
-
- log.trace("END processTypes: " + wsdlLoc + "\n" + destTypes);
- }
-
- private void copyParentNamespaceDeclarations(Element destElement, Element srcElement)
- {
- Node parent = srcElement.getParentNode();
- while (parent != null)
- {
- if (parent.hasAttributes())
- {
- NamedNodeMap attributes = parent.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++)
- {
- Attr attr = (Attr)attributes.item(i);
- String name = attr.getName();
- String value = attr.getValue();
- if (name.startsWith("xmlns:") &&
destElement.hasAttribute(name) == false)
- destElement.setAttribute(name, value);
- }
- }
- parent = parent.getParentNode();
- }
- }
-
- private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl)
throws IOException
- {
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process import, parent location
not set");
-
- log.trace("processSchemaImport: " + wsdlLoc);
-
- String location = getOptionalAttribute(importEl, "schemaLocation");
- if (location == null)
- throw new IllegalArgumentException("schemaLocation is null for
xsd:import");
-
- URL locationURL = getLocationURL(wsdlLoc, location);
- Element rootElement = DOMUtils.parse(locationURL.openStream());
- URL newloc = processSchemaInclude(types, locationURL, rootElement);
- if (newloc != null)
- importEl.setAttribute("schemaLocation", newloc.toExternalForm());
- }
-
- private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl)
throws IOException
- {
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process iclude, parent location
not set");
-
- File tmpFile = null;
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process include, parent location
not set");
-
- log.trace("processSchemaInclude: " + wsdlLoc);
-
- String schemaPrefix = schemaEl.getPrefix();
-
- String importTag = (schemaPrefix == null) ? "import" : schemaPrefix +
":import";
- Element importElement =
schemaEl.getOwnerDocument().createElementNS(Constants.NS_SCHEMA_XSD, importTag);
- importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC);
- schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl));
-
- // Handle schema includes
- Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "include"));
- while (it.hasNext())
- {
- Element includeEl = (Element)it.next();
- String location = getOptionalAttribute(includeEl, "schemaLocation");
- if (location == null)
- throw new IllegalArgumentException("schemaLocation is null for
xsd:include");
-
- URL locationURL = getLocationURL(wsdlLoc, location);
- Element rootElement = DOMUtils.parse(locationURL.openStream());
- URL newloc = processSchemaInclude(types, locationURL, rootElement);
- if (newloc != null)
- includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
- }
-
- String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
- if (targetNS != null)
- {
- log.trace("processSchemaInclude: [targetNS=" + targetNS +
",parentURL=" + wsdlLoc + "]");
-
- tmpFile = SchemaUtils.getSchemaTempFile(targetNS);
- tempFiles.add(tmpFile);
-
- FileWriter fwrite = new FileWriter(tmpFile);
- new DOMWriter(fwrite).setPrettyprint(true).print(schemaEl);
- fwrite.close();
-
- schemaLocationsMap.put(targetNS, tmpFile.toURL());
- }
-
- // schema elements that have no target namespace are skipped
- //
- // <xsd:schema>
- // <xsd:import
namespace="http://org.jboss.webservice/example/types"
schemaLocation="Hello.xsd"/>
- // <xsd:import
namespace="http://org.jboss.webservice/example/types/arrays/org/jboss/test/webservice/admindevel"
schemaLocation="subdir/HelloArr.xsd"/>
- // </xsd:schema>
- if (targetNS == null)
- {
- log.trace("Schema element without target namespace in: " + wsdlLoc);
- }
-
- handleSchemaImports(schemaEl, wsdlLoc);
-
- return tmpFile != null ? tmpFile.toURL() : null;
- }
-
- private void handleSchemaImports(Element schemaEl, URL wsdlLoc) throws
MalformedURLException
- {
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process import, parent location
not set");
-
- Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "import"));
- while (it.hasNext())
- {
- Element includeEl = (Element)it.next();
- String schemaLocation = getOptionalAttribute(includeEl,
"schemaLocation");
- String namespace = getOptionalAttribute(includeEl, "namespace");
-
- log.trace("handleSchemaImport: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
-
- // Skip, let the entity resolver resolve these
- if (namespace != null && schemaLocation != null)
- {
- URL currLoc = getLocationURL(wsdlLoc, schemaLocation);
- schemaLocationsMap.put(namespace, currLoc);
- }
- else
- {
- log.trace("Skip schema import: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
- }
- }
- }
-
- private URL getLocationURL(URL parentURL, String location) throws
MalformedURLException
- {
- log.trace("getLocationURL: [location=" + location + ",parent="
+ parentURL + "]");
-
- URL locationURL = null;
- try
- {
- locationURL = new URL(location);
- }
- catch (MalformedURLException e)
- {
- // ignore malformed URL
- }
-
- if (locationURL == null)
- {
- String parentProtocol = parentURL.getProtocol();
- if (parentProtocol.equals("file") &&
!location.startsWith("/"))
- {
- String path = parentURL.toExternalForm();
- path = path.substring(0, path.lastIndexOf("/"));
- locationURL = new URL(path + "/" + location);
- }
- else if (parentProtocol.startsWith("http") &&
location.startsWith("/"))
- {
- String path = parentProtocol + "://" + parentURL.getHost() +
":" + parentURL.getPort();
- locationURL = new URL(path + location);
- }
- else if (parentProtocol.equals("jar") &&
!location.startsWith("/"))
- {
- String path = parentURL.toExternalForm();
- path = path.substring(0, path.lastIndexOf("/"));
- locationURL = new URL(path + "/" + location);
- }
- else
- {
- throw new WSException("Unsupported schemaLocation: " + location);
- }
- }
-
- log.trace("Modified schemaLocation: " + locationURL);
- return locationURL;
- }
-
- private void processPortType(Definition srcWsdl, PortType srcPortType)
- {
- log.trace("processPortType: " + srcPortType.getQName());
-
- QName qname = srcPortType.getQName();
- NCName ncName = new NCName(qname);
- if (destWsdl.getInterface(ncName) == null)
- {
- WSDLInterface destInterface = new WSDLInterface(destWsdl);
- destInterface.setName(ncName);
- destInterface.setQName(qname);
-
- // eventing extensions
- QName eventSourceProp =
(QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSE_EVENTSOURCE);
- if (eventSourceProp != null &&
eventSourceProp.getLocalPart().equals(Boolean.TRUE.toString()))
- {
- destInterface.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_EVENTSOURCE, eventSourceProp.getLocalPart()));
- }
-
- destWsdl.addInterface(destInterface);
-
- processPortTypeOperations(srcWsdl, destInterface, srcPortType);
- }
- }
-
- private void processPortTypeOperations(Definition srcWsdl, WSDLInterface
destInterface, PortType srcPortType)
- {
- Iterator itOperations = srcPortType.getOperations().iterator();
- while (itOperations.hasNext())
- {
- Operation srcOperation = (Operation)itOperations.next();
-
- WSDLInterfaceOperation destOperation = new
WSDLInterfaceOperation(destInterface);
- destOperation.setName(new NCName(srcOperation.getName()));
- destOperation.setStyle(getOperationStyle(srcWsdl, srcPortType, srcOperation));
-
- processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
- processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
- processOperationFaults(srcOperation, destOperation, destInterface);
-
- destInterface.addOperation(destOperation);
- }
- }
-
- private void processOperationInput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
- {
- Input srcInput = srcOperation.getInput();
- if (srcInput != null)
- {
- Message srcMessage = srcInput.getMessage();
- log.trace("processOperationInput: " + srcMessage.getQName());
-
- QName wsaAction =
(QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
- if (wsaAction != null)
- destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN,
wsaAction.getLocalPart()));
-
- List<String> paramOrder = (List<String>)
srcOperation.getParameterOrdering();
- if (paramOrder != null)
- {
- for (String name : paramOrder)
- {
- if (srcMessage.getPart(name) != null)
- destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name));
- }
- }
-
- WSDLInterfaceOperationInput rpcInput = new
WSDLInterfaceOperationInput(destOperation);
- for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(paramOrder))
- {
- if (Constants.URI_STYLE_IRI == destOperation.getStyle())
- {
- WSDLInterfaceOperationInput destInput = new
WSDLInterfaceOperationInput(destOperation);
- QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
- destInput.setElement(elementName);
-
- //Lets remember the Message name
- destInput.setMessageName(srcMessage.getQName());
- destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN,
srcMessage.getQName().getLocalPart()));
-
- destInput.setPartName(srcPart.getName());
-
- destOperation.addInput(destInput);
- }
- else
- {
- // If we don't have a type then we aren't a valid RPC parameter
- // This could happen on a header element, in which case the
- // binding will pick it up
- QName xmlType = srcPart.getTypeName();
- if (xmlType != null)
- rpcInput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
- else
- messagePartToElementName(srcWsdl, srcPortType, srcOperation,
srcMessage, srcPart);
- }
- }
- if (Constants.URI_STYLE_RPC == destOperation.getStyle())
- {
- // This is really a place holder, but also the actual value used in
- // WSDL 2.0 RPC bindings
- rpcInput.setElement(destOperation.getQName());
- rpcInput.setMessageName(srcMessage.getQName());
- destOperation.addInput(rpcInput);
- }
- }
- }
-
- private void processOperationOutput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
- {
- Output srcOutput = srcOperation.getOutput();
- if (srcOutput == null)
- {
- destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
- return;
- }
-
- Message srcMessage = srcOutput.getMessage();
- log.trace("processOperationOutput: " + srcMessage.getQName());
-
- destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
- QName wsaAction = (QName)
srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
- if (wsaAction != null)
- destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT,
wsaAction.getLocalPart()));
-
- List<String> paramOrder = (List<String>)
srcOperation.getParameterOrdering();
- if (paramOrder != null)
- {
- for (String name : paramOrder)
- {
- if (srcMessage.getPart(name) != null)
- {
- WSDLRPCSignatureItem item = destOperation.getRpcSignatureitem(name);
- if (item != null)
- item.setDirection(Direction.INOUT);
- else
- destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name,
Direction.OUT));
- }
- }
- }
-
- WSDLInterfaceOperationOutput rpcOutput = new
WSDLInterfaceOperationOutput(destOperation);
- for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(null))
- {
- if (Constants.URI_STYLE_IRI == destOperation.getStyle())
- {
- WSDLInterfaceOperationOutput destOutput = new
WSDLInterfaceOperationOutput(destOperation);
-
- QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
- destOutput.setElement(elementName);
-
- // Lets remember the Message name
- destOutput.setMessageName(srcMessage.getQName());
- destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT, srcMessage.getQName()
- .getLocalPart()));
-
- // Remember the original part name
- destOutput.setPartName(srcPart.getName());
-
- destOperation.addOutput(destOutput);
- }
- else
- {
- // If we don't have a type then we aren't a valid RPC parameter
- // This could happen on a header element, in which case the
- // binding will pick it up
- QName xmlType = srcPart.getTypeName();
- if (xmlType != null)
- rpcOutput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
- else
- messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage,
srcPart);
- }
- }
-
- if (Constants.URI_STYLE_RPC == destOperation.getStyle())
- {
- // This is really a place holder, but also the actual value used in
- // WSDL 2.0 RPC bindings
- QName name = destOperation.getQName();
- rpcOutput.setElement(new QName(name.getNamespaceURI(), name.getLocalPart() +
"Response"));
- rpcOutput.setMessageName(srcMessage.getQName());
- destOperation.addOutput(rpcOutput);
- }
- }
-
- private void processOperationFaults(Operation srcOperation, WSDLInterfaceOperation
destOperation, WSDLInterface destInterface)
- {
-
- Map faults = srcOperation.getFaults();
- Iterator itFaults = faults.values().iterator();
- while (itFaults.hasNext())
- {
- Fault srcFault = (Fault)itFaults.next();
- processOperationFault(destOperation, destInterface, srcFault);
- }
- }
-
- private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface
destInterface, Fault srcFault)
- {
- String faultName = srcFault.getName();
- log.trace("processOperationFault: " + faultName);
-
- WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface);
- NCName ncName = new NCName(faultName);
- destFault.setName(ncName);
-
- Message message = srcFault.getMessage();
- QName messageName = message.getQName();
-
- Map partsMap = message.getParts();
- if (partsMap.size() != 1)
- throw new WSException("Unsupported number of fault parts in message "
+ messageName);
-
- Part part = (Part)partsMap.values().iterator().next();
- QName xmlName = part.getElementName();
-
- if (xmlName != null)
- {
- destFault.setElement(xmlName);
- }
- else
- {
- destFault.setElement(messageName);
- log.warn("Unsupported fault message part in message: " +
messageName);
- }
-
- WSDLInterfaceFault prevFault = destInterface.getFault(ncName);
- if (prevFault != null && prevFault.getName().equals(ncName) == false)
- throw new WSException("Fault name must be unique: " + faultName);
-
- // Add the fault to the interface
- destInterface.addFault(destFault);
-
- // Add the fault refererence to the operation
- WSDLInterfaceOperationOutfault opOutFault = new
WSDLInterfaceOperationOutfault(destOperation);
- opOutFault.setRef(new QName(destWsdl.getTargetNamespace(), faultName));
- destOperation.addOutfault(opOutFault);
- }
-
- /** Translate the message part name into an XML element name.
- */
- private QName messagePartToElementName(Definition srcWsdl, PortType srcPortType,
Operation srcOperation, Message srcMessage, Part srcPart)
- {
- // <part name="param" element="tns:SomeType" />
- QName xmlName = srcPart.getElementName();
-
- // <part name="param" type="xsd:string" />
- if (xmlName == null)
- xmlName = new QName(srcPart.getName());
-
- xmlName = destWsdl.registerQName(xmlName);
- String key = srcMessage.getQName() + "->" + srcPart.getName();
- messagePartToElementMap.put(key, xmlName);
-
- return xmlName;
- }
-
- private BindingOperation getBindingOperation(Definition srcWsdl, PortType srcPortType,
Operation srcOperation)
- {
- Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
-
- if (srcBinding == null)
- throw new WSException("Cannot find binding for: " +
srcPortType.getQName());
-
- String srcOperationName = srcOperation.getName();
- BindingOperation srcBindingOperation =
srcBinding.getBindingOperation(srcOperationName, null, null);
- if (srcBindingOperation == null)
- throw new WSException("Cannot find binding operation for: " +
srcOperationName);
- return srcBindingOperation;
- }
-
- private String getOperationStyle(Definition srcWsdl, PortType srcPortType, Operation
srcOperation)
- {
- Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
- BindingOperation srcBindingOperation = getBindingOperation(srcWsdl, srcPortType,
srcOperation);
-
- String operationStyle = null;
- List<ExtensibilityElement> extList =
srcBindingOperation.getExtensibilityElements();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPOperation)
- {
- SOAPOperation soapOp = (SOAPOperation)extElement;
- operationStyle = soapOp.getStyle();
- }
- else if (SOAP12_OPERATION.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- operationStyle = getOptionalAttribute(domElement, "style");
- }
- }
-
- if (operationStyle == null)
- {
- for (ExtensibilityElement extElement : (List<ExtensibilityElement>)
srcBinding.getExtensibilityElements())
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPBinding)
- {
- SOAPBinding soapBinding = (SOAPBinding) extElement;
- operationStyle = soapBinding.getStyle();
- }
- else if (SOAP12_BINDING.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)
extElement).getElement();
- operationStyle = getOptionalAttribute(domElement, "style");
- }
- }
- }
-
- return ("rpc".equals(operationStyle)) ? Constants.URI_STYLE_RPC :
Constants.URI_STYLE_IRI;
- }
-
- private void processBinding(Definition srcWsdl, Binding srcBinding)
- {
- QName srcBindingQName = srcBinding.getQName();
- log.trace("processBinding: " + srcBindingQName);
-
- NCName ncName = new NCName(srcBindingQName);
- if (destWsdl.getBinding(ncName) == null)
- {
- PortType srcPortType = srcBinding.getPortType();
- if (srcPortType == null)
- throw new WSException("Cannot find port type for binding: " +
ncName);
-
- processPortType(srcWsdl, srcPortType);
-
- WSDLBinding destBinding = new WSDLBinding(destWsdl);
- destBinding.setQName(srcBindingQName);
- destBinding.setName(ncName);
- destBinding.setInterfaceName(srcPortType.getQName());
-
- String bindingStyle = Style.getDefaultStyle().toString();
- List<ExtensibilityElement> extList =
srcBinding.getExtensibilityElements();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPBinding)
- {
- destBinding.setType(Constants.NS_SOAP11);
- SOAPBinding soapBinding = (SOAPBinding)extElement;
- bindingStyle = soapBinding.getStyle();
- }
- else if (SOAP12_BINDING.equals(elementType))
- {
- destBinding.setType(Constants.NS_SOAP12);
- Element domElement =
((UnknownExtensibilityElement)extElement).getElement();
- bindingStyle = getOptionalAttribute(domElement, "style");
- }
- }
- destWsdl.addBinding(destBinding);
- processBindingOperations(destBinding, srcBinding, bindingStyle);
- }
- }
-
- private Map<QName, Binding> getPortTypeBindings(Definition srcWsdl)
- {
- getAllDefinedBindings(srcWsdl);
- return portTypeBindings;
- }
-
- private Map<QName, Binding> getAllDefinedBindings(Definition srcWsdl)
- {
- if (allBindings != null)
- return allBindings;
-
- allBindings = new LinkedHashMap<QName, Binding>();
- portTypeBindings = new LinkedHashMap<QName, Binding>();
- Map srcBindings = srcWsdl.getBindings();
- Iterator itBinding = srcBindings.values().iterator();
- while (itBinding.hasNext())
- {
- Binding srcBinding = (Binding)itBinding.next();
- allBindings.put(srcBinding.getQName(), srcBinding);
- portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
- }
-
- // Bindings not available when pulled in through <wsdl:import>
- //
http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&...
- Iterator itService = srcWsdl.getServices().values().iterator();
- while (itService.hasNext())
- {
- Service srcService = (Service)itService.next();
- Iterator itPort = srcService.getPorts().values().iterator();
- while (itPort.hasNext())
- {
- Port srcPort = (Port)itPort.next();
- Binding srcBinding = srcPort.getBinding();
- allBindings.put(srcBinding.getQName(), srcBinding);
- portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
- }
- }
-
- return allBindings;
- }
-
- private void processBindingOperations(WSDLBinding destBinding, Binding srcBinding,
String bindingStyle)
- {
- Iterator it = srcBinding.getBindingOperations().iterator();
- while (it.hasNext())
- {
- BindingOperation srcBindingOperation = (BindingOperation)it.next();
- processBindingOperation(destBinding, bindingStyle, srcBindingOperation);
- }
- }
-
- private void processBindingOperation(WSDLBinding destBinding, String bindingStyle,
BindingOperation srcBindingOperation)
- {
- String srcBindingName = srcBindingOperation.getName();
- log.trace("processBindingOperation: " + srcBindingName);
-
- WSDLInterface destInterface = destBinding.getInterface();
- String namespaceURI = destInterface.getQName().getNamespaceURI();
-
- WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding);
- QName refQName = new QName(namespaceURI, srcBindingName);
- destBindingOperation.setRef(refQName);
- destBinding.addOperation(destBindingOperation);
-
- String opName = srcBindingName;
- WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(new
NCName(opName));
-
- // Process soap:operation@soapAction, soap:operation@style
- List<ExtensibilityElement> extList =
srcBindingOperation.getExtensibilityElements();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPOperation)
- {
- SOAPOperation soapOp = (SOAPOperation)extElement;
- destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
- }
- else if (SOAP12_OPERATION.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- destBindingOperation.setSOAPAction(getOptionalAttribute(domElement,
"soapAction"));
- }
- }
-
- BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
- if (srcBindingInput != null)
- {
- processBindingInput(destBindingOperation, destIntfOperation,
srcBindingOperation, srcBindingInput);
- }
-
- BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
- if (srcBindingOutput != null)
- {
- processBindingOutput(destBindingOperation, destIntfOperation,
srcBindingOperation, srcBindingOutput);
- }
- }
-
- interface ReferenceCallback
- {
- void removeReference(QName element);
- void removeRPCPart(String partName);
- QName getXmlType(String partName);
- }
-
- private void processBindingInput(WSDLBindingOperation destBindingOperation, final
WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation,
BindingInput srcBindingInput)
- {
- log.trace("processBindingInput");
-
- QName soap11Body = new QName(Constants.NS_SOAP11, "body");
- List<ExtensibilityElement> extList =
srcBindingInput.getExtensibilityElements();
- WSDLBindingOperationInput input = new
WSDLBindingOperationInput(destBindingOperation);
- destBindingOperation.addInput(input);
-
- ReferenceCallback cb = new ReferenceCallback()
- {
- public QName getXmlType(String partName)
- {
- return
srcBindingOperation.getOperation().getInput().getMessage().getPart(partName).getTypeName();
- }
-
- public void removeReference(QName element)
- {
- WSDLInterfaceOperationInput destIntfInput =
destIntfOperation.getInput(element);
- if (destIntfInput == null)
- destIntfOperation.removeInput(element);
- }
-
- public void removeRPCPart(String partName)
- {
- WSDLInterfaceOperationInput operationInput =
destIntfOperation.getInput(destIntfOperation.getQName());
- operationInput.removeChildPart(partName);
- }
- };
-
- processBindingReference(destBindingOperation, destIntfOperation, soap11Body,
extList, input, cb);
- }
-
- private void processBindingOutput(WSDLBindingOperation destBindingOperation, final
WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation,
BindingOutput srcBindingOutput)
- {
- log.trace("processBindingInput");
-
- QName soap11Body = new QName(Constants.NS_SOAP11, "body");
- List<ExtensibilityElement> extList =
srcBindingOutput.getExtensibilityElements();
- WSDLBindingOperationOutput output = new
WSDLBindingOperationOutput(destBindingOperation);
- destBindingOperation.addOutput(output);
-
- ReferenceCallback cb = new ReferenceCallback()
- {
- public QName getXmlType(String partName)
- {
- return
srcBindingOperation.getOperation().getOutput().getMessage().getPart(partName).getTypeName();
- }
-
- public void removeReference(QName element)
- {
- WSDLInterfaceOperationOutput destIntfOutput =
destIntfOperation.getOutput(element);
- if (destIntfOutput == null)
- destIntfOperation.removeInput(element);
- }
-
- public void removeRPCPart(String partName)
- {
- QName name = destIntfOperation.getQName();
- WSDLInterfaceOperationOutput operationOutput =
destIntfOperation.getOutput(new QName(name.getNamespaceURI(), name.getLocalPart() +
"Response"));
- operationOutput.removeChildPart(partName);
- }
- };
-
- processBindingReference(destBindingOperation, destIntfOperation, soap11Body,
extList, output, cb);
- }
-
-
- private void processBindingReference(WSDLBindingOperation destBindingOperation,
WSDLInterfaceOperation destIntfOperation,
- QName soap11Body, List<ExtensibilityElement> extList,
WSDLBindingMessageReference reference, ReferenceCallback callback)
- {
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
- {
- processEncodingStyle(extElement, destBindingOperation);
- }
- else if (extElement instanceof SOAPHeader)
- {
- SOAPHeader header = (SOAPHeader)extElement;
- QName messageQName = header.getMessage();
- String partName = header.getPart();
-
- String key = messageQName + "->" + partName;
- QName elementName = (QName)messagePartToElementMap.get(key);
- if (elementName == null)
- throw new WSException("Could not determine element name from header:
" + partName);
-
- reference.addSoapHeader(new WSDLSOAPHeader(elementName, partName));
- if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
- {
- callback.removeReference(elementName);
- }
- else
- {
- // Just in case
- callback.removeRPCPart(partName);
- }
- }
- else if (extElement instanceof MIMEMultipartRelated)
- {
- MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
- Iterator i = related.getMIMEParts().iterator();
- while (i.hasNext())
- {
- MIMEPart part = (MIMEPart)i.next();
- Iterator j = part.getExtensibilityElements().iterator();
- String name = null;
- String types = null;
-
- while (j.hasNext())
- {
- ExtensibilityElement inner = (ExtensibilityElement)j.next();
- if (inner instanceof MIMEContent)
- {
- MIMEContent content = (MIMEContent)inner;
- name = content.getPart();
- if (types == null)
- {
- types = content.getType();
- }
- else
- {
- types += "," + content.getType();
- }
- }
- }
-
- // Found content types in this part
- if (name != null)
- {
- QName xmlType = callback.getXmlType(name);
- reference.addMimePart(new WSDLMIMEPart(name, xmlType, types));
- if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
- {
- // A mime part must be defined as <part type="">
- callback.removeReference(new QName(name));
- }
- else
- {
- callback.removeRPCPart(name);
- }
- }
- }
- }
- }
- }
-
-
- private void processEncodingStyle(ExtensibilityElement extElement,
WSDLBindingOperation destBindingOperation)
- {
- log.trace("processEncodingStyle");
-
- String encStyle = null;
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPBody)
- {
- SOAPBody body = (SOAPBody)extElement;
- List encStyleList = body.getEncodingStyles();
- if (encStyleList != null)
- {
- if (encStyleList.size() > 1)
- log.warn("Multiple encoding styles not supported: " +
encStyleList);
-
- if (encStyleList.size() > 0)
- {
- encStyle = (String)encStyleList.get(0);
- }
- }
- }
- else if (SOAP12_BODY.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- encStyle = getOptionalAttribute(domElement, "encodingStyle");
- }
-
- if (encStyle != null)
- {
- String setStyle = destBindingOperation.getEncodingStyle();
- if (encStyle.equals(setStyle) == false)
- log.warn("Encoding style '" + encStyle + "' not
supported for: " + destBindingOperation.getRef());
-
- destBindingOperation.setEncodingStyle(encStyle);
- }
- }
-
- private void processServices(Definition srcWsdl)
- {
- log.trace("BEGIN processServices: " + srcWsdl.getDocumentBaseURI());
-
- // Each definition needs a clear binding cache
- allBindings = null;
-
- if (srcWsdl.getServices().size() > 0)
- {
- Iterator it = srcWsdl.getServices().values().iterator();
- while (it.hasNext())
- {
- Service srcService = (Service)it.next();
- QName qname = srcService.getQName();
- WSDLService destService = new WSDLService(destWsdl);
- destService.setName(new NCName(qname));
- destService.setQName(qname);
- destWsdl.addService(destService);
- processPorts(srcWsdl, destService, srcService);
- }
- }
- else
- {
- log.trace("Empty wsdl services, processing imports");
- Iterator it = srcWsdl.getImports().values().iterator();
- while (it.hasNext())
- {
- List<Import> srcImports = (List<Import>)it.next();
- for (Import srcImport : srcImports)
- {
- Definition importDefinition = srcImport.getDefinition();
- processServices(importDefinition);
- }
- }
-
- // The binding cache must be clear after imports, so that undefined bindings can
be located
- allBindings = null;
- }
-
- log.trace("END processServices: " + srcWsdl.getDocumentBaseURI());
- }
-
- private void processPorts(Definition srcWsdl, WSDLService destService, Service
srcService)
- {
- Iterator it = srcService.getPorts().values().iterator();
- while (it.hasNext())
- {
- Port srcPort = (Port)it.next();
- processPort(srcWsdl, destService, srcPort);
- }
- }
-
- private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort)
- {
- log.trace("processPort: " + srcPort.getName());
-
- Binding srcBinding = srcPort.getBinding();
-
- WSDLEndpoint destEndpoint = new WSDLEndpoint(destService);
- destEndpoint.setName(new NCName(srcPort.getName()));
- destEndpoint.setBinding(srcBinding.getQName());
- destEndpoint.setQName(new QName(srcWsdl.getTargetNamespace(), srcPort.getName()));
- destEndpoint.setAddress(getSOAPAddress(srcPort));
- destService.addEndpoint(destEndpoint);
-
- processBinding(srcWsdl, srcBinding);
- }
-
- /** Get the endpoint address from the ports extensible element
- */
- private String getSOAPAddress(Port srcPort)
- {
- String soapAddress = "dummy";
-
- Iterator it = srcPort.getExtensibilityElements().iterator();
- while (it.hasNext())
- {
- ExtensibilityElement extElement = (ExtensibilityElement)it.next();
- QName elementType = extElement.getElementType();
-
- if (extElement instanceof SOAPAddress)
- {
- SOAPAddress addr = (SOAPAddress)extElement;
- soapAddress = addr.getLocationURI();
- break;
- }
- else if (SOAP12_ADDRESS.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- soapAddress = getOptionalAttribute(domElement, "location");
- break;
- }
- else if ("address".equals(elementType.getLocalPart()))
- {
- log.warn("Unprocessed extension element: " + elementType);
- }
- }
-
- if (soapAddress == null)
- throw new WSException("Cannot obtain SOAP address");
-
- return soapAddress;
- }
-
- private String getOptionalAttribute(Element domElement, String attrName)
- {
- String attrValue = domElement.getAttribute(attrName);
- return (attrValue.length() > 0 ? attrValue : null);
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Writer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Writer.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Writer.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,518 +0,0 @@
-/*
-* 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.common.metadata.wsdl;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.DOMWriter;
-import org.w3c.dom.Element;
-
-/**
- * A WSDL Writer that writes a WSDL 1.1 file. It works off
- * of the WSDL20 Object Graph.
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- */
-public class WSDL11Writer extends WSDLWriter
-{
- //Used Internally
- private String wsdlStyle = Constants.RPC_LITERAL;
-
- // Used to prevent duplicates
- private HashSet<String> writtenFaultMessages = new HashSet<String>();
-
- /** Use WSDLDefinitions.writeWSDL instead. */
- public WSDL11Writer(WSDLDefinitions wsdl)
- {
- super(wsdl);
- }
-
- public void write(Writer writer) throws IOException
- {
- write(writer, null);
- }
-
-
- public void write(Writer writer, String charset) throws IOException
- {
- write(writer, charset, null);
- }
-
- public void write(Writer writer, String charset, WriterResolver resolver) throws
IOException
- {
- // Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader)
- if (wsdl.getWsdlOneOneDefinition() != null)
- {
- Definition wsdlDefinition = wsdl.getWsdlOneOneDefinition();
- try
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
- wsdlWriter.writeWSDL(wsdlDefinition, writer);
- }
- catch (WSDLException e)
- {
- this.logException(e);
- throw new IOException(e.toString());
- }
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
-
- //Detect the WSDL Style early
- wsdlStyle = utils.getWSDLStyle(wsdl);
-
- StringBuilder importBuffer = new StringBuilder();
- for (WSDLImport wsdlImport : wsdl.getImports())
- {
- if (resolver == null)
- continue;
-
- ResolvedWriter resolved = resolver.resolve(wsdlImport.getLocation());
- if (resolved == null)
- continue;
-
- String namespace = wsdlImport.getNamespace();
- importBuffer.append("<import namespace='" + namespace +
"' location='" + resolved.actualFile + "'/>");
- if (resolved != null)
- {
- StringBuilder builder = new StringBuilder();
-
- appendDefinitions(builder, namespace);
- appendBody(builder, namespace);
- writeBuilder(builder, resolved.writer, resolved.charset);
- resolved.writer.close();
- }
- }
-
- appendDefinitions(buffer, wsdl.getTargetNamespace());
- if (importBuffer.length() > 0)
- buffer.append(importBuffer);
-
- appendBody(buffer, wsdl.getTargetNamespace());
- writeBuilder(buffer, writer, charset);
- }
- }
-
- private void writeBuilder(StringBuilder builder, Writer writer, String charset) throws
IOException
- {
- Element element = DOMUtils.parse(builder.toString());
-
- if (charset != null)
- writer.write("<?xml version=\"1.0\" encoding=\"" +
charset + "\"?>\n");
- new DOMWriter(writer).setPrettyprint(true).print(element);
- }
-
- protected void appendBody(StringBuilder builder, String namespace)
- {
- writtenFaultMessages.clear();
-
- appendTypes(builder, namespace);
- appendMessages(builder, namespace);
- appendInterfaces(builder, namespace);
- appendBindings(builder, namespace);
- appendServices(builder, namespace);
- builder.append("</definitions>");
- }
-
- protected void appendMessages(StringBuilder buffer, String namespace)
- {
- WSDLInterface[] interfaces = wsdl.getInterfaces();
- int len = interfaces != null ? interfaces.length : 0;
- for (int i = 0; i < len; i++)
- {
- WSDLInterface intf = interfaces[i];
- if (! namespace.equals(intf.getQName().getNamespaceURI()))
- continue;
-
- WSDLInterfaceOperation[] operations = intf.getSortedOperations();
- int lenOps = operations.length;
- for (int j = 0; j < lenOps; j++)
- {
- appendMessage(buffer, operations[j]);
- appendMessagesForExceptions(buffer, operations[j]);
- }
- }
- }
-
- private void appendMessage(StringBuilder buffer, WSDLInterfaceOperation operation)
- {
- String opname = operation.getName().toString();
- //Determine the style of the wsdl
- if (Constants.URI_STYLE_RPC.equals(operation.getStyle()) == false)
- wsdlStyle = Constants.DOCUMENT_LITERAL; //Not RPC/Literal
-
- String interfaceName = operation.getWsdlInterface().getName().toString();
- buffer.append("<message name='" + interfaceName + "_" +
opname + "' >");
- for (WSDLInterfaceOperationInput input : operation.getInputs())
- appendMessageParts(buffer, input);
- buffer.append("</message>");
-
- if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
- {
- buffer.append("<message name='" + interfaceName + "_"
+ opname + "Response' >");
- WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
- for (WSDLInterfaceOperationOutput output : outputs)
- appendMessageParts(buffer, output);
- buffer.append("</message>");
- }
- }
-
- private void appendMessagesForExceptions(StringBuilder buffer, WSDLInterfaceOperation
operation)
- {
- //Get the outfaults
- WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
- int len = faults != null ? faults.length : 0;
-
- for (int i = 0; i < len; i++)
- {
- WSDLInterfaceOperationOutfault fault = faults[i];
- String exceptionName = fault.getRef().getLocalPart();
- if (writtenFaultMessages.contains(exceptionName))
- continue;
-
- WSDLInterfaceFault interfaceFault = operation.getWsdlInterface().getFault(new
NCName(exceptionName));
- QName xmlName = interfaceFault.getElement();
-
- buffer.append("<message name='" + exceptionName + "'
>");
- String prefix = wsdl.getPrefix(xmlName.getNamespaceURI());
- String xmlNameStr = prefix + ":" + xmlName.getLocalPart();
- buffer.append("<part name='" + exceptionName + "'
element='" + xmlNameStr + "' />");
- buffer.append("</message>");
-
- writtenFaultMessages.add(exceptionName);
- }
- }
-
- private String getReferenceString(QName name)
- {
- String namespaceURI = name.getNamespaceURI();
- String prefix = wsdl.getPrefix(namespaceURI);
- if (prefix == null)
- throw new WSException("Prefix not bound for namespace: " +
namespaceURI);
-
- return prefix + ":" + name.getLocalPart();
- }
-
- private void appendMessageParts(StringBuilder buffer, WSDLInterfaceMessageReference
reference)
- {
- if (wsdlStyle.equals(Constants.RPC_LITERAL))
- {
- for (WSDLRPCPart part : reference.getChildParts())
- {
- buffer.append("<part name='" +
part.getName()).append('\'');
- buffer.append(" type='" + getReferenceString(part.getType()) +
"'/>");
- }
- }
- else
- {
- QName element = reference.getElement();
- // Null represents empty message
- if (element != null)
- {
- buffer.append("<part name='" + reference.getPartName() +
'\'');
- buffer.append(" element='" + getReferenceString(element) +
"'/>");
- }
- }
-
- WSDLBindingMessageReference bindingReference = getBindingReference(reference);
- if (bindingReference == null)
- return;
-
- for (WSDLSOAPHeader header : bindingReference.getSoapHeaders())
- {
- if (header.isIncludeInSignature());
- {
- QName element = header.getElement();
- buffer.append("<part name='" + header.getPartName() +
'\'');
- buffer.append(" element='" + getReferenceString(element) +
"'/>");
- }
- }
- }
-
- private WSDLBindingMessageReference getBindingReference(WSDLInterfaceMessageReference
reference)
- {
- WSDLInterfaceOperation operation = reference.getWsdlOperation();
- WSDLInterface wsdlInterface = operation.getWsdlInterface();
- WSDLBinding binding =
wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getQName());
- WSDLBindingOperation bindingOperation =
binding.getOperationByRef(operation.getQName());
- WSDLBindingMessageReference[] bindingReferences;
-
- if (reference instanceof WSDLInterfaceOperationInput)
- bindingReferences = bindingOperation.getInputs();
- else
- bindingReferences = bindingOperation.getOutputs();
-
- if (bindingReferences.length > 1)
- throw new IllegalArgumentException("WSDl 1.1 only supports In-Only, and
In-Out MEPS, more than reference input found");
-
- if (bindingReferences.length == 1)
- return bindingReferences[0];
-
- return null;
- }
-
- protected void appendInterfaces(StringBuilder buffer, String namespace)
- {
- WSDLInterface[] intfs = wsdl.getInterfaces();
- for (int i = 0; i < intfs.length; i++)
- {
- WSDLInterface intf = intfs[i];
- if (!namespace.equals(intf.getQName().getNamespaceURI()))
- continue;
-
- buffer.append("<portType name='" + intf.getName() +
"'>");
- appendPortOperations(buffer, intf);
- buffer.append("</portType>");
- }
- }
-
- private String getParameterOrder(WSDLInterfaceOperation operation)
- {
- StringBuilder builder = new StringBuilder();
- for (WSDLRPCSignatureItem item : operation.getRpcSignatureItems())
- {
- if (item.getDirection() != Direction.RETURN)
- {
- if (builder.length() > 0)
- builder.append(' ');
- builder.append(item.getName());
- }
- }
-
- return builder.toString();
- }
-
- protected void appendPortOperations(StringBuilder buffer, WSDLInterface intf)
- {
- String prefix = wsdl.getPrefix(intf.getQName().getNamespaceURI());
- WSDLInterfaceOperation[] operations = intf.getSortedOperations();
- for (int i = 0; i < operations.length; i++)
- {
- WSDLInterfaceOperation operation = operations[i];
- buffer.append("<operation name='" +
operation.getName().toString() + "'");
-
- String parameterOrder = getParameterOrder(operation);
- if (parameterOrder.length() > 0)
- buffer.append("
parameterOrder='").append(parameterOrder).append("'");
- buffer.append(">");
-
- String opname = operation.getName().toString();
- String interfaceName = operation.getWsdlInterface().getName().toString();
- String msgEl = prefix + ":" + interfaceName + "_" + opname;
-
- buffer.append("<input message='" + msgEl +
"'>").append("</input>");
-
- if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
- {
- buffer.append("<output message='" + msgEl +
"Response'>");
- buffer.append("</output>");
- }
-
- //Append the Faults
- for (WSDLInterfaceOperationOutfault fault : operation.getOutfaults())
- {
- QName element = fault.getRef();
- buffer.append("<fault message='" +
utils.getFormattedString(element));
- buffer.append("' name='" + element.getLocalPart() +
"'/>");
- }
-
- buffer.append("</operation>");
- }
- }
-
- protected void appendBindings(StringBuilder buffer, String namespace)
- {
- WSDLBinding[] bindings = wsdl.getBindings();
- for (int i = 0; i < bindings.length; i++)
- {
- WSDLBinding binding = bindings[i];
- if (!namespace.equals(binding.getQName().getNamespaceURI()))
- continue;
- buffer.append("<binding name='" + binding.getName() +
"' type='" + getQNameRef(binding.getInterfaceName()) +
"'>");
- //TODO:Need to derive the WSDLStyle from the Style attribute of
InterfaceOperation
- if (wsdlStyle == null)
- throw new IllegalArgumentException("WSDL Style is null (should be rpc or
document");
- String style = "rpc";
- if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
- style = "document";
- buffer.append("<" + soapPrefix + ":binding
transport='http://schemas.xmlsoap.org/soap/http' style='" + style +
"'/>");
- appendBindingOperations(buffer, binding);
- buffer.append("</binding>");
- }
- }
-
- protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
- {
- WSDLBindingOperation[] operations = binding.getOperations();
- Arrays.sort(operations);
-
- for (int i = 0; i < operations.length; i++)
- {
- WSDLBindingOperation operation = operations[i];
- String interfaceName =
operation.getWsdlBinding().getInterfaceName().getLocalPart();
-
- WSDLInterface wsdlInterface = wsdl.getInterface(new NCName(interfaceName));
- if (wsdlInterface == null)
- throw new WSException("WSDL Interface should not be null");
- WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
-
- buffer.append("<operation name='" +
interfaceOperation.getName() + "'>");
- String soapAction = (operation.getSOAPAction() != null ?
operation.getSOAPAction() : "");
- buffer.append("<" + soapPrefix + ":operation
soapAction=\"" + soapAction + "\"/>");
-
- WSDLBindingOperationInput[] inputs = operation.getInputs();
- if (inputs.length != 1)
- throw new WSException("WSDl 1.1 only supports In-Only, and In-Out
MEPS.");
-
- buffer.append("<input>");
- appendSOAPBinding(buffer, wsdlInterface, operation, inputs);
- buffer.append("</input>");
-
- if (!
Constants.WSDL20_PATTERN_IN_ONLY.equals(getBindingOperationPattern(operation)))
- {
- buffer.append("<output>");
- WSDLBindingOperationOutput[] outputs = operation.getOutputs();
- appendSOAPBinding(buffer, wsdlInterface, operation, outputs);
- buffer.append("</output>");
- }
-
- //Append faults
- WSDLInterfaceOperationOutfault[] faults = interfaceOperation.getOutfaults();
- if (faults != null)
- {
- for (WSDLInterfaceOperationOutfault fault : faults)
- {
- String n = "name='" + fault.getRef().getLocalPart() +
"'";
- buffer.append("<fault " + n + ">");
- buffer.append("<" + soapPrefix + ":fault " + n +
" use='literal' />");
- buffer.append("</fault>");
- }
- buffer.append("</operation>");
- }
- }
- }
-
- private void appendSOAPBinding(StringBuilder buffer, WSDLInterface wsdlInterface,
WSDLBindingOperation operation, WSDLBindingMessageReference[] inputs)
- {
- String tns = wsdl.getTargetNamespace();
- WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
- WSDLInterfaceMessageReference reference = (inputs instanceof
WSDLBindingOperationInput[]) ? interfaceOperation.getInputs()[0]
- : interfaceOperation.getOutputs()[0];
-
- StringBuilder bodyParts = new StringBuilder();
- if (Constants.DOCUMENT_LITERAL == wsdlStyle)
- {
- bodyParts.append(reference.getPartName());
- }
- else
- {
- for (WSDLRPCPart part : reference.getChildParts())
- {
- if (bodyParts.length() > 0)
- bodyParts.append(" ");
- bodyParts.append(part.getName());
- }
- }
-
- StringBuilder soapHeader = new StringBuilder();
- for (WSDLSOAPHeader header : inputs[0].getSoapHeaders())
- {
- if (header.isIncludeInSignature())
- {
- String messageName = wsdlInterface.getName() + "_" +
operation.getRef().getLocalPart();
- if (reference instanceof WSDLInterfaceOperationOutput)
- messageName += "Response";
- soapHeader.append("<").append(soapPrefix).append(":header
use='literal' message='tns:").append(messageName);
- soapHeader.append("'
part='").append(header.getElement().getLocalPart()).append("'/>");
- }
- }
-
- buffer.append("<" + soapPrefix + ":body
use='literal'");
- if (wsdlStyle != Constants.DOCUMENT_LITERAL)
- buffer.append(" namespace='" + tns + "'");
- if (soapHeader.length() > 0)
- {
- buffer.append("
parts='").append(bodyParts).append("'/>");
- buffer.append(soapHeader);
- }
- else
- {
- buffer.append("/>");
- }
- }
-
- private String getBindingOperationPattern(WSDLBindingOperation operation)
- {
- WSDLBinding binding = operation.getWsdlBinding();
- String pattern = binding.getInterface().getOperation(new
NCName(operation.getRef().getLocalPart())).getPattern();
-
- return pattern;
- }
-
- protected void appendServices(StringBuilder buffer, String namespace)
- {
- WSDLService[] services = wsdl.getServices();
- int len = services.length;
- for (int i = 0; i < len; i++)
- {
-
- WSDLService service = services[i];
- if (!namespace.equals(service.getQName().getNamespaceURI()))
- continue;
- buffer.append("<service name='" + service.getName() +
"'>");
- WSDLEndpoint[] endpoints = service.getEndpoints();
- int lenend = endpoints.length;
- for (int j = 0; j < lenend; j++)
- {
- WSDLEndpoint endpoint = endpoints[j];
- appendServicePort(buffer, endpoint);
- }
-
- buffer.append("</service>");
- }
- }
-
- protected void appendServicePort(StringBuilder buffer, WSDLEndpoint endpoint)
- {
- String name = endpoint.getName().toString();
- QName endpointBinding = endpoint.getBinding();
- String prefix = endpointBinding.getPrefix();
- prefix = wsdl.getPrefix(endpointBinding.getNamespaceURI());
- String ebname = prefix + ":" + endpointBinding.getLocalPart();
- buffer.append("<port name='" + name + "'
binding='" + ebname + "'>");
- buffer.append("<" + soapPrefix + ":address location='" +
endpoint.getAddress() + "'/>");
- buffer.append("</port>");
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Reader.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Reader.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Reader.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,557 +0,0 @@
-/*
-* 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.common.metadata.wsdl;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-import javax.wsdl.xml.WSDLLocator;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-
-/**
- * A factory that creates a WSDL <code>Definition</code> from an URL.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDL20Reader implements ObjectModelFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDL20Reader.class);
-
- private WSDLLocator locator = null;
-
- public WSDLDefinitions readWSDL(WSDLLocator wsdlLocator) throws WSDLException,
IOException
- {
- locator = wsdlLocator;
-
- String wsdlURI = wsdlLocator.getBaseURI();
- InputSource inputSource = wsdlLocator.getBaseInputSource();
- if (inputSource == null)
- throw new WSException("Cannot obtain WSDL input source for: " +
wsdlURI);
-
- InputStream is = inputSource.getByteStream();
- try
- {
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setNamespaceAware(true);
- unmarshaller.setValidation(true);
-
- WSDLDefinitions wsdl = new WSDLDefinitions();
- wsdl.setWsdlNamespace(Constants.NS_WSDL20);
-
- unmarshaller.unmarshal(is, this, wsdl);
- return wsdl;
- }
- catch (RuntimeException re)
- {
- throw re;
- }
- catch (Exception e)
- {
- throw new WSDLException("Cannot unmarshal: " + wsdlURI, e);
- }
- finally
- {
- is.close();
- }
- }
-
- public void setFeature(String name, boolean value)
- {
- }
-
- /**
- * This method is called by the object model factory and returns the root of the
object graph.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- /**
- * WSDL2.0 Assertions (
http://www.w3.org/TR/wsdl20-primer)
- * The value of the WSDL target namespace MUST be an absolute URI.
- */
- WSDLDefinitions wsdl = null;
-
- StringBuilder buf = null;
-
- if (root instanceof WSDLDefinitions)
- {
- wsdl = (WSDLDefinitions)root;
-
- String targetNamespace = attrs.getValue("targetNamespace");
- boolean abs = (targetNamespace.startsWith("http"));
- if (targetNamespace == null || abs == false)
- throw new RuntimeException("WSDL 2.0 Assertion: targetNamespace must be
an absolute uri");
-
- wsdl.setWsdlNamespace(Constants.NS_WSDL20);
- wsdl.setTargetNamespace(targetNamespace);
-
- Iterator uris = navigator.getNamespaceURIs();
- while (uris.hasNext())
- {
- String namespace = (String)uris.next();
- String prefix = navigator.getNamespaceContext().getPrefix(namespace);
- if (prefix.length() > 0)
- wsdl.registerNamespaceURI(namespace, prefix);
- }
- return wsdl;
- }
- else if (root instanceof WSDLTypes)
- {
- wsdl = ((WSDLTypes)root).getWsdlDefinitions();
- if ("import".equalsIgnoreCase(localName))
- {
- importTypes(wsdl, attrs);
- return null;
- }
- if ("schema".equalsIgnoreCase(localName))
- {
- //Included Schema - wsdl 2.0
- //We will start writing whatever the parser has obtained
- buf = new StringBuilder("<schema ");
- Iterator uris = navigator.getNamespaceURIs();
- String targetNS = attrs.getValue("targetNamespace");
- buf.append(" targetNamespace='" + targetNS +
"'");
- while (uris.hasNext())
- {
- String namespace = (String)uris.next();
- Iterator iter = navigator.getNamespaceContext().getPrefixes(namespace);
- if (namespace.equals(Constants.NS_WSDL20))
- continue;
- if (iter == null)
- buf.append(" xmlns='" + namespace + "'");
- else
- {
- while (iter.hasNext())
- {
- String prefix = (String)iter.next();
- if (prefix.length() == 0)
- buf.append(" xmlns='" + namespace +
"'");
- else buf.append(" xmlns:" + prefix + "='" +
namespace + "'");
- }
- }
- }
- buf.append(">");
- return buf;
- }
- }
- else if (root instanceof StringBuilder)
- {
- return newChild((StringBuilder)root, navigator, namespaceURI, localName,
attrs);
- }
- else
- {
- throw new IllegalArgumentException("Invalid root for namespace: " +
namespaceURI);
- }
-
- return null;
- }
-
- /**
- * This method is called by the object model factory and returns the root of the
object graph.
- */
- public Object newChild(WSDLTypes types, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- /**
- * WSDL2.0 Assertions (
http://www.w3.org/TR/wsdl20-primer)
- * The value of the WSDL target namespace MUST be an absolute URI.
- */
- WSDLDefinitions wsdl = types.getWsdlDefinitions();
-
- StringBuilder buf = null;
- if ("import".equalsIgnoreCase(localName))
- {
- importTypes(wsdl, attrs);
- return null;
- }
- if ("schema".equalsIgnoreCase(localName))
- {
- //Included Schema - wsdl 2.0
- //We will start writing whatever the parser has obtained
- buf = new StringBuilder("<schema ");
- Iterator uris = navigator.getNamespaceURIs();
- String targetNS = attrs.getValue("targetNamespace");
- buf.append(" targetNamespace='" + targetNS + "'");
- while (uris.hasNext())
- {
- String namespace = (String)uris.next();
- Iterator iter = navigator.getNamespaceContext().getPrefixes(namespace);
- if (namespace.equals(Constants.NS_WSDL20))
- continue;
- if (iter == null)
- buf.append(" xmlns='" + namespace + "'");
- else
- {
- while (iter.hasNext())
- {
- String prefix = (String)iter.next();
- if (prefix.length() == 0)
- buf.append(" xmlns='" + namespace +
"'");
- else buf.append(" xmlns:" + prefix + "='" +
namespace + "'");
- }
- }
- }
- buf.append(">");
- return buf;
- }
-
- return null;
- }
-
- /**
- * The JBossXB has completed the parsing of the WSDL 2.0 document
- * @param root
- * @param ctx
- * @param uri
- * @param name
- * @return
- */
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
- {
- return root;
- }
-
- /**
- * Used in the parsing of the included XML Schema in WSDL 2.0
- * @param buf
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(StringBuilder buf, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- int len = attrs.getLength();
- buf.append("<" + localName);
- for (int i = 0; i < len; i++)
- {
- String val = attrs.getValue(i);
- String attrname = attrs.getLocalName(i);
- buf.append(" " + attrname + "='" + val +
"'");
- }
- buf.append(">");
- return buf;
- }
-
- /**
- * Used in the parsing of the included XML Schema in WSDL 2.0
- * We have reached the end of an xml element.
- * @param buf
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @return
- */
- public Object addChild(StringBuilder buf, StringBuilder buf1, UnmarshallingContext
navigator, String namespaceURI, String localName) throws WSDLException
- {
- buf.append("</" + localName + ">");
- return buf;
-
- }
-
- /**
- * Used in the parsing of the included XML Schema in WSDL 2.0
- * We have parsed the schema completely. Write it into a file and update WSDLTypes
(schemaLocation)
- * @param types
- * @param buf
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @return
- * @throws WSDLException
- */
- public Object addChild(WSDLTypes types, StringBuilder buf, UnmarshallingContext
navigator, String namespaceURI, String localName) throws WSDLException
- {
- buf.append("</schema>");
- String targetNS = types.getWsdlDefinitions().getTargetNamespace();
- try
- {
- File file = SchemaUtils.getSchemaTempFile(targetNS);
- file.deleteOnExit();
- FileWriter fwrite = new FileWriter(file);
- fwrite.write(buf.toString());
- fwrite.flush();
- fwrite.close();
- }
- catch (IOException e)
- {
- String msg = "Cannot extract schema definition for target namespace: "
+ targetNS;
- log.error(msg, e);
- throw new WSException(msg);
- }
- return types;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdl20
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- * @throws WSDLException
- */
- public Object newChild(WSDLDefinitions wsdl20, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs) throws WSDLException
- {
- /**
- * WSDL 20 Assertions
- * Each interface must be given a name that is unique within the set of interfaces
defined in this WSDL target NS
- * Interface names are tokens that must not contain a space or colon
(":")
- */
- String defaultNamespace = wsdl20.getWsdlNamespace();
- if (Constants.NS_WSDL20.equals(defaultNamespace))
- {
- if ("types".equals(localName))
- {
- WSDLTypes wsdlTypes = new XSModelTypes();
- wsdl20.setWsdlTypes(wsdlTypes);
- return wsdlTypes;
- }
- else if ("interface".equals(localName))
- {
- WSDLInterface wsdlInterface = new WSDLInterface(wsdl20);
- String name = attrs.getValue("name");
- if (name == null)
- throw new RuntimeException("Interface name should not be
null");
- if (name.indexOf(" ") > -1 || name.indexOf(":") >
-1)
- throw new RuntimeException("WSDL 2.0 Assertion:Interface names are
tokens " + "that must not contain a space or colon");
-
- NCName ncname = new NCName(name);
- if (wsdl20.getInterface(ncname) != null)
- throw new RuntimeException("WSDL 2.0 Assertion:Each interface must be
given a name that is "
- + "unique within the set of interfaces defined in this WSDL
target namespace");
-
- wsdlInterface.setName(ncname);
- wsdl20.addInterface(wsdlInterface);
-
- return wsdlInterface;
- }
- else if ("binding".equals(localName))
- {
- /**
- * WSDL 2.0 Assertion: Each name must be unique among all bindings in this
WSDL target namespace
- */
- String name = attrs.getValue("name");
- NCName ncname = new NCName(name);
- if (wsdl20.getBinding(ncname) != null)
- throw new RuntimeException("WSDL 2.0 Assertion:Each name must be
unique among " + "all bindings in this WSDL target namespace");
- WSDLBinding wsdlBinding = new WSDLBinding(wsdl20);
- wsdlBinding.setName(ncname);
- wsdl20.addBinding(wsdlBinding);
-
- return wsdlBinding;
- }
- else if ("service".equals(localName))
- {
- WSDLService wsdlService = new WSDLService(wsdl20);
- wsdlService.setName(new NCName(attrs.getValue("name")));
- wsdl20.addService(wsdlService);
-
wsdlService.setInterfaceName(navigator.resolveQName(attrs.getValue("interface")));
- return wsdlService;
- }
- else log.warn("Unrecogized child element: " + localName);
- }
- else throw new WSDLException("Invalid default namespace: " +
defaultNamespace);
-
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlInterface
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLInterface wsdlInterface, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- /**
- * WSDL .0 Assertion: Operation names must also be unique within an interface
- */
- if ("operation".equals(localName))
- {
- String name = attrs.getValue("name");
- if (name == null)
- throw new RuntimeException("Operation name must not be null");
- NCName ncname = new NCName(name);
- if (wsdlInterface.containsInterfaceOperation(ncname))
- throw new RuntimeException("WSDL 2.0 Assertion:Each operation must be
given a name that is "
- + "unique within an interface defined in this WSDL target
namespace");
- WSDLInterfaceOperation wsdlOperation = new
WSDLInterfaceOperation(wsdlInterface);
- wsdlOperation.setName(ncname);
- wsdlInterface.addOperation(wsdlOperation);
- return wsdlOperation;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlOperation
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLInterfaceOperation wsdlOperation, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("input".equals(localName))
- {
- WSDLInterfaceOperationInput wsdlInterfaceOperationInput = new
WSDLInterfaceOperationInput(wsdlOperation);
-
wsdlInterfaceOperationInput.setElement(navigator.resolveQName(attrs.getValue("element")));
- wsdlInterfaceOperationInput.setMessageLabel(new
NCName(attrs.getValue("messageLabel")));
- wsdlOperation.addInput(wsdlInterfaceOperationInput);
- return wsdlInterfaceOperationInput;
- }
- else if ("output".equals(localName))
- {
- WSDLInterfaceOperationOutput output = new
WSDLInterfaceOperationOutput(wsdlOperation);
- output.setElement(navigator.resolveQName(attrs.getValue("element")));
- output.setMessageLabel(new NCName(attrs.getValue("messageLabel")));
- wsdlOperation.addOutput(output);
- return output;
- }
- else if ("outfault".equals(localName))
- {
- WSDLInterfaceOperationOutfault fault = new
WSDLInterfaceOperationOutfault(wsdlOperation);
- String messageLabel = attrs.getValue("messageLabel");
- fault.setRef(navigator.resolveQName(attrs.getValue("ref")));
- if (messageLabel != null)
- fault.setMessageLabel(new NCName(messageLabel));
- wsdlOperation.addOutfault(fault);
- return wsdlOperation;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlBinding
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLBinding wsdlBinding, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- if ("operation".equals(localName))
- {
- WSDLBindingOperation wsdlBindingOperation = new
WSDLBindingOperation(wsdlBinding);
-
wsdlBindingOperation.setRef(navigator.resolveQName(attrs.getValue("ref")));
- wsdlBinding.addOperation(wsdlBindingOperation);
- return wsdlBindingOperation;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlBindingOperation
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLBindingOperation wsdlBindingOperation, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("input".equals(localName))
- {
- WSDLBindingOperationInput wsdlBindingOperationInput = new
WSDLBindingOperationInput(wsdlBindingOperation);
- wsdlBindingOperationInput.setMessageLabel(new
NCName(attrs.getValue("messageLabel")));
- wsdlBindingOperation.addInput(wsdlBindingOperationInput);
- return wsdlBindingOperationInput;
- }
- if ("output".equals(localName))
- {
- WSDLBindingOperationOutput wsdlBindingOperationOutput = new
WSDLBindingOperationOutput(wsdlBindingOperation);
- wsdlBindingOperationOutput.setMessageLabel(new
NCName(attrs.getValue("messageLabel")));
- wsdlBindingOperation.addOutput(wsdlBindingOperationOutput);
- return wsdlBindingOperationOutput;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlService
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLService wsdlService, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- if ("endpoint".equals(localName))
- {
- WSDLEndpoint wsdlEndpoint = new WSDLEndpoint(wsdlService);
- wsdlEndpoint.setName(new NCName(attrs.getValue("name")));
-
wsdlEndpoint.setBinding(navigator.resolveQName(attrs.getValue("binding")));
- wsdlService.addEndpoint(wsdlEndpoint);
- return wsdlEndpoint;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Method that deals with importing schema
- * @param wsdl
- * @param attrs
- */
- private void importTypes(WSDLDefinitions wsdl, Attributes attrs)
- {
- // [TODO]
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Writer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Writer.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL20Writer.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,200 +0,0 @@
-/*
-* 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.common.metadata.wsdl;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-
-/**
- * A WSDL writer that writes out a WSDL-2.0 compliant wsdl.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDL20Writer extends WSDLWriter
-{
- // provide logging
- protected static final Logger log = Logger.getLogger(WSDL20Writer.class);
-
- protected WSDLUtils utils = WSDLUtils.getInstance();
-
- /** Use WSDLDefinitions.writeWSDL instead. */
- public WSDL20Writer(WSDLDefinitions wsdl)
- {
- super(wsdl);
- }
-
-
- protected void appendInterfaces(StringBuilder buffer, String namespace)
- {
- WSDLInterface[] interfaces = wsdl.getInterfaces();
- for (int i = 0; i < interfaces.length; i++)
- {
- WSDLInterface intf = interfaces[i];
- buffer.append("<interface name='" + intf.getName() +
"'>");
- appendInterfaceFaults(buffer, intf);
- appendInterfaceOperations(buffer, intf);
- buffer.append("</interface>");
- }
- }
-
- private void appendInterfaceFaults(StringBuilder buffer, WSDLInterface intf)
- {
- WSDLInterfaceFault[] faults = intf.getFaults();
- for (int i = 0; i < faults.length; i++)
- {
- WSDLInterfaceFault fault = faults[i];
- buffer.append("<fault name='" + fault.getName() +
"'");
- buffer.append(" element='" + getQNameRef(fault.getElement()) +
"'>");
- if (fault.getDocumentation() != null)
- {
- buffer.append(fault.getDocumentation());
- }
- buffer.append("</fault>");
- }
- }
-
- private void appendInterfaceOperations(StringBuilder buffer, WSDLInterface intf)
- {
- WSDLInterfaceOperation[] operations = intf.getOperations();
- for (int i = 0; i < operations.length; i++)
- {
- WSDLInterfaceOperation operation = operations[i];
- buffer.append("<operation name='" + operation.getName() +
"'>");
-
- WSDLInterfaceOperationInput[] inputs = operation.getInputs();
- for (int j = 0; j < inputs.length; j++)
- {
- WSDLInterfaceOperationInput ip = inputs[j];
- buffer.append("<input element='" +
getQNameRef(ip.getElement()) + "'");
- if (ip.getMessageLabel() != null)
- {
- buffer.append(" messageLabel='" + ip.getMessageLabel() +
"'");
- }
- buffer.append(">");
- appendProperties(buffer, ip.getProperties());
- buffer.append("</input>");
- }
-
- WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
- for (int j = 0; j < outputs.length; j++)
- {
- WSDLInterfaceOperationOutput op = outputs[j];
- buffer.append("<output element='" +
getQNameRef(op.getElement()) + "'");
- if (op.getMessageLabel() != null)
- {
- buffer.append(" messageLabel='" + op.getMessageLabel() +
"'");
- }
- buffer.append(">");
- appendProperties(buffer, op.getProperties());
- buffer.append("</output>");
- }
-
- WSDLInterfaceOperationOutfault[] outfaults = operation.getOutfaults();
- for (int j = 0; j < outfaults.length; j++)
- {
- WSDLInterfaceOperationOutfault outfault = outfaults[j];
- buffer.append("<outfault ref='" +
getQNameRef(outfault.getRef()) + "'>");
- if (outfault.getMessageLabel() != null)
- {
- buffer.append(" messageLabel='" + outfault.getMessageLabel()
+ "'");
- }
- buffer.append("</outfault>");
- }
- buffer.append("</operation>");
- }
- }
-
- private void appendProperties(StringBuilder buffer, WSDLProperty[] wsdlProperties)
- {
- for (int i = 0; i < wsdlProperties.length; i++)
- {
- WSDLProperty wsdlProperty = wsdlProperties[i];
- String uri = wsdlProperty.getURI();
- String value = wsdlProperty.getValue();
- buffer.append("<property uri='" + uri + "'>" +
(value != null ? "<value>" + value + "</value>" :
"") + "</property>");
- }
- }
-
- protected void appendBindings(StringBuilder buffer, String namespace)
- {
- WSDLBinding[] bindings = wsdl.getBindings();
- for (int i = 0; i < bindings.length; i++)
- {
- WSDLBinding binding = bindings[i];
- buffer.append("<binding name='" + binding.getName() +
"'");
- if (binding.getInterfaceName() != null)
- {
- buffer.append(" interface='" +
getQNameRef(binding.getInterfaceName()) + "'");
- }
- buffer.append(">");
- appendBindingOperations(buffer, binding);
- buffer.append("</binding>");
- }
- }
-
- protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
- {
- WSDLBindingOperation[] operations = binding.getOperations();
- for (int i = 0; i < operations.length; i++)
- {
- WSDLBindingOperation operation = operations[i];
- buffer.append("<operation ref='" +
getQNameRef(operation.getRef()) + "'>");
- buffer.append("</operation>");
- }
- }
-
- protected void appendServices(StringBuilder buffer, String namespace)
- {
- WSDLService[] services = wsdl.getServices();
- for (int i = 0; i < services.length; i++)
- {
- WSDLService service = services[i];
- buffer.append("<service name='" + service.getName() +
"'");
- if (service.getInterfaceName() != null)
- {
- buffer.append(" interface='" +
getQNameRef(service.getInterfaceName()) + "'");
- }
- buffer.append(">");
-
- WSDLEndpoint[] endpoints = service.getEndpoints();
- for (int j = 0; j < endpoints.length; j++)
- {
- WSDLEndpoint endpoint = endpoints[j];
- buffer.append("<endpoint name='" + endpoint.getName() +
"'");
- if (endpoint.getBinding() != null)
- {
- buffer.append(" binding='" +
getQNameRef(endpoint.getBinding()) + "'");
- }
- if (endpoint.getAddress() != null)
- {
- buffer.append(" address='" + endpoint.getAddress() +
"'");
- }
- buffer.append("></endpoint>");
- }
-
- buffer.append("</service>");
- }
- }
-}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitions.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitions.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitions.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -23,9 +23,7 @@
// $Id$
-import java.io.IOException;
import java.io.Serializable;
-import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -37,8 +35,6 @@
import org.jboss.logging.Logger;
import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.metadata.wsdl.WSDLWriter.WriterResolver;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Document;
@@ -299,28 +295,4 @@
if(pre != null && pre.equals(prefix))
namespaces.removePrefixMapping(prefix);
}
-
- /** Write the wsdl definition to the given writer, clients should not care about the
wsdl version. */
- public void write(Writer writer, String charset) throws IOException
- {
- write(writer, charset, null);
- }
-
- public void write(Writer writer, String charset, WriterResolver resolver) throws
IOException
- {
- if (Constants.NS_WSDL11.equals(wsdlNamespace))
- {
- WSDL11Writer wsdl11Writer = new WSDL11Writer(this);
- wsdl11Writer.write(writer, charset, resolver);
- }
- else if (Constants.NS_WSDL20.equals(wsdlNamespace))
- {
- WSDL20Writer wsdl20Writer = new WSDL20Writer(this);
- wsdl20Writer.write(writer);
- }
- else
- {
- throw new WSException("Unsupported wsdl version: " + wsdlNamespace);
- }
- }
}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitionsFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitionsFactory.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitionsFactory.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,211 +0,0 @@
-/*
-* 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.common.metadata.wsdl;
-
-// $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.common.Constants;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.JBossWSEntityResolver;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.EntityResolver;
-
-import com.ibm.wsdl.xml.WSDLReaderImpl;
-
-/**
- * A factory that creates a <code>WSDLDefinitions</code> object from an URL.
- *
- * This implementations deals with different WSDL versions so that clients of this
- * factory do need to know about WSDL version specifics. The Java object view of the
- * WSDL document (WSDLDefinitions) is modeled on WSDL-2.0
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLDefinitionsFactory
-{
- // 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";
-
- // The WSDL reader features
- private Map features = new HashMap();
-
- // Hide constructor
- private 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));
- }
-
- /**
- * 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");
-
- log.debug("parse: " + wsdlLocation.toExternalForm());
-
- EntityResolver entityResolver = new JBossWSEntityResolver();
- WSDLDefinitions wsdlDefinitions = null;
- try
- {
- Document wsdlDoc = getDocument(wsdlLocation);
- String defaultNamespace = getDefaultNamespace(wsdlDoc);
- if (Constants.NS_WSDL20.equals(defaultNamespace))
- {
- WSDL20Reader wsdlReader = new WSDL20Reader();
-
- // 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());
- }
-
- wsdlDefinitions = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver,
wsdlLocation));
- wsdlDefinitions.setWsdlDocument(wsdlDoc);
- }
- else if (Constants.NS_WSDL11.equals(defaultNamespace))
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- 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();
- String key = (String)entry.getKey();
- Boolean flag = (Boolean)entry.getValue();
- wsdlReader.setFeature(key, flag.booleanValue());
- }
-
- // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
- ((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())
- {
- StringWriter stwr = new StringWriter();
- WSDL20Writer wsdl20Writer = new WSDL20Writer(wsdlDefinitions);
- wsdl20Writer.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;
- }
-
- /** Get the WSDL document.
- */
- private Document getDocument(URL wsdlLocation) throws WSDLException
- {
- try
- {
- InputStream wsdlInputStream = wsdlLocation.openStream();
- try
- {
- DocumentBuilder builder = DOMUtils.getDocumentBuilder();
- return builder.parse(wsdlInputStream);
- }
- finally
- {
- wsdlInputStream.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;
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLLocatorImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLLocatorImpl.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLLocatorImpl.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,159 +0,0 @@
-/*
- * 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.common.metadata.wsdl;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.wsdl.xml.WSDLLocator;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.WSException;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-/* A WSDLLocator that can handle wsdl imports
- */
-class WSDLLocatorImpl implements WSDLLocator
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
-
- private EntityResolver entityResolver;
- private URL wsdlURL;
- private String latestImportURI;
-
- public WSDLLocatorImpl(EntityResolver entityResolver, URL wsdlFile)
- {
- if (wsdlFile == null)
- throw new IllegalArgumentException("WSDL file argument cannot be
null");
-
- this.entityResolver = entityResolver;
- this.wsdlURL = wsdlFile;
- }
-
- public InputSource getBaseInputSource()
- {
- log.trace("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
- try
- {
- InputStream is = wsdlURL.openStream();
- if (is == null)
- throw new IllegalArgumentException("Cannot obtain wsdl from [" +
wsdlURL + "]");
-
- return new InputSource(is);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Cannot access wsdl from [" + wsdlURL +
"], " + e.getMessage());
- }
- }
-
- public String getBaseURI()
- {
- return wsdlURL.toExternalForm();
- }
-
- public InputSource getImportInputSource(String parent, String resource)
- {
- log.trace("getImportInputSource [parent=" + parent +
",resource=" + resource + "]");
-
- URL parentURL = null;
- try
- {
- parentURL = new URL(parent);
- }
- catch (MalformedURLException e)
- {
- log.error("Not a valid URL: " + parent);
- return null;
- }
-
- String wsdlImport = null;
- String external = parentURL.toExternalForm();
-
- // An external URL
- if (resource.startsWith("http://") ||
resource.startsWith("https://"))
- {
- wsdlImport = resource;
- }
-
- // Absolute path
- else if (resource.startsWith("/"))
- {
- String beforePath = external.substring(0,
external.indexOf(parentURL.getPath()));
- wsdlImport = beforePath + resource;
- }
-
- // A relative path
- else
- {
- String parentDir = external.substring(0, external.lastIndexOf("/"));
-
- // remove references to current dir
- while (resource.startsWith("./"))
- resource = resource.substring(2);
-
- // remove references to parentdir
- while (resource.startsWith("../"))
- {
- parentDir = parentDir.substring(0, parentDir.lastIndexOf("/"));
- resource = resource.substring(3);
- }
-
- wsdlImport = parentDir + "/" + resource;
- }
-
- try
- {
- log.trace("Trying to resolve: " + wsdlImport);
- InputSource inputSource = entityResolver.resolveEntity(wsdlImport, wsdlImport);
- if (inputSource != null)
- {
- latestImportURI = wsdlImport;
- }
- else
- {
- throw new IllegalArgumentException("Cannot resolve imported resource:
" + wsdlImport);
- }
-
- return inputSource;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException("Cannot access imported wsdl [" + wsdlImport +
"], " + e.getMessage());
- }
- }
-
- public String getLatestImportURI()
- {
- return latestImportURI;
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLWriter.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLWriter.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLWriter.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,207 +0,0 @@
-/*
-* 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.common.metadata.wsdl;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.DOMWriter;
-import org.w3c.dom.Element;
-
-/**
- * A helper that writes out a WSDL definition
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public abstract class WSDLWriter
-{
- // provide logging
- protected static final Logger log = Logger.getLogger(WSDLWriter.class);
-
- protected WSDLDefinitions wsdl;
- protected WSDLUtils utils = WSDLUtils.getInstance();
-
- // The soap prefix
- protected String soapPrefix = "soap";
-
- /**
- * Include or import WSDL Types
- */
- protected boolean includeSchemaInWSDL = true;
-
- public static class ResolvedWriter
- {
- public String actualFile;
- public String charset;
- public Writer writer;
- }
-
- public static interface WriterResolver
- {
- public ResolvedWriter resolve(String suggestedFile) throws IOException;
- }
-
- /** Use WSDLDefinitions.writeWSDL instead. */
- protected WSDLWriter(WSDLDefinitions wsdl)
- {
- if (wsdl == null)
- throw new IllegalArgumentException("WSDL definitions is NULL");
-
- this.wsdl = wsdl;
- }
-
- public void write(Writer writer) throws IOException
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append(Constants.XML_HEADER);
-
- appendDefinitions(buffer, wsdl.getTargetNamespace());
- appendTypes(buffer, wsdl.getTargetNamespace());
- appendInterfaces(buffer, wsdl.getTargetNamespace());
- appendBindings(buffer, wsdl.getTargetNamespace());
- appendServices(buffer, wsdl.getTargetNamespace());
-
- buffer.append("</definitions>");
-
- Element element = DOMUtils.parse(buffer.toString());
- new DOMWriter(writer).setPrettyprint(true).print(element);
- }
-
- protected void appendDefinitions(StringBuilder buffer, String namespace)
- {
- buffer.append("<definitions");
- //Append service name as done by wscompile, if there is just one
- WSDLService[] services = wsdl.getServices();
- if (services != null && services.length == 1)
- {
- WSDLService ser = services[0];
- buffer.append(" name='" + ser.getName() + "'");
- }
- buffer.append(" targetNamespace='" + namespace + "'");
- buffer.append(" xmlns='" + wsdl.getWsdlNamespace() +
"'");
-
- Iterator it = wsdl.getRegisteredNamespaceURIs();
- while (it.hasNext())
- {
- String namespaceURI = (String)it.next();
- String prefix = wsdl.getPrefix(namespaceURI);
- if (prefix.length() > 0)
- {
- buffer.append(" xmlns:" + prefix + "='" +
namespaceURI + "'");
- if (Constants.PREFIX_SOAP11.equals(prefix) ||
Constants.PREFIX_SOAP12.equals(prefix))
- soapPrefix = prefix;
- }
- }
- buffer.append(">");
- }
-
- protected void appendTypes(StringBuilder buffer, String namespace)
- {
- WSDLTypes wsdlTypes = wsdl.getWsdlTypes();
- // If the type section is bound to a particular namespace, verify it mataches,
otherwise skip
- if (wsdlTypes.getNamespace() != null &&
!wsdlTypes.getNamespace().equals(namespace))
- return;
-
- if (wsdlTypes instanceof XSModelTypes)
- {
- buffer.append("<types>");
- JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdlTypes);
- String schema = xsM.serialize();
- buffer.append(schema);
- buffer.append("</types>");
- }
- else if (wsdlTypes instanceof DOMTypes)
- {
- synchronized (wsdlTypes)
- {
- buffer.append(DOMWriter.printNode(((DOMTypes)wsdlTypes).getElement(),
true));
- }
- }
- }
-
- protected abstract void appendInterfaces(StringBuilder buffer, String namespace);
-
- protected abstract void appendBindings(StringBuilder buffer, String namespace);
-
- protected abstract void appendServices(StringBuilder buffer, String namespace);
-
- /** Get a prefixed name of form prefix:localPart */
- protected String getQNameRef(QName qname)
- {
- String retStr = qname.getLocalPart();
-
- String prefix = qname.getPrefix();
- String nsURI = qname.getNamespaceURI();
- if (prefix.length() == 0 && nsURI.length() > 0)
- {
- qname = wsdl.registerQName(qname);
- prefix = qname.getPrefix();
- }
-
- if (prefix.length() > 0)
- retStr = prefix + ":" + retStr;
-
- return retStr;
- }
-
- public WSDLDefinitions getWsdl()
- {
- return wsdl;
- }
-
- public void setWsdl(WSDLDefinitions wsdl)
- {
- this.wsdl = wsdl;
- }
-
- public boolean isIncludeTypesInWSDL()
- {
- return includeSchemaInWSDL;
- }
-
- public void logException(Exception e)
- {
- if (log.isTraceEnabled())
- {
- log.trace(e);
- }
- }
-
- public void logMessage(String msg)
- {
- if (log.isTraceEnabled())
- {
- log.trace(msg);
- }
- }
-}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -44,12 +44,12 @@
import org.jboss.ws.common.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.common.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.core.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
/**
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java 2006-12-06
11:19:33 UTC (rev 1572)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -29,8 +29,7 @@
import org.jboss.ws.common.binding.BindingException;
import org.jboss.ws.common.umdm.OperationMetaData;
-import org.jboss.ws.core.binding.EndpointInvocation;
-import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.soap.UnboundHeader;
/**
* The base interface for protocol bindings.
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-06
11:19:33 UTC (rev 1572)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -47,14 +47,13 @@
import org.jboss.ws.common.umdm.EndpointMetaData.Type;
import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.common.utils.HolderUtils;
-import org.jboss.ws.core.binding.EndpointInvocation;
-import org.jboss.ws.core.binding.UnboundHeader;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.core.soap.EndpointInfo;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPConnectionImpl;
+import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -32,6 +32,7 @@
import org.jboss.ws.common.binding.SerializationContext;
import org.jboss.ws.common.umdm.EndpointMetaData;
import org.jboss.ws.common.umdm.OperationMetaData;
+import org.jboss.ws.core.server.MessageContextPropertyHelper;
import org.jboss.xb.binding.NamespaceRegistry;
/**
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -57,8 +57,6 @@
import org.jboss.ws.common.utils.DOMUtils;
import org.jboss.ws.common.utils.JavaUtils;
import org.jboss.ws.common.utils.MimeUtils;
-import org.jboss.ws.core.binding.EndpointInvocation;
-import org.jboss.ws.core.binding.UnboundHeader;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.core.soap.MessageContextAssociation;
@@ -71,6 +69,7 @@
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.core.soap.SOAPHeaderElementImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
import org.jboss.ws.core.soap.attachment.CIDGenerator;
import org.jboss.ws.extras.xop.XOPContext;
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/EndpointInvocation.java
(from rev 1571,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/EndpointInvocation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/EndpointInvocation.java 2006-12-06
10:47:51 UTC (rev 1571)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/EndpointInvocation.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,357 @@
+/*
+* 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.core;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.common.umdm.OperationMetaData;
+import org.jboss.ws.common.umdm.ParameterMetaData;
+import org.jboss.ws.common.umdm.WrappedParameter;
+import org.jboss.ws.common.utils.HolderUtils;
+import org.jboss.ws.common.utils.JavaUtils;
+import org.jboss.ws.common.utils.MimeUtils;
+import org.jboss.ws.core.jaxrpc.ParameterWrapping;
+import org.jboss.ws.core.soap.SOAPContentElement;
+
+/** A web service invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Oct-2004
+ */
+public class EndpointInvocation
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(EndpointInvocation.class);
+
+ // The operation meta data for this invocation
+ private OperationMetaData opMetaData;
+ // Map the named endpoint parameters
+ private Map<QName, Object> reqPayload = new LinkedHashMap<QName,
Object>();
+ // Map the named endpoint parameters
+ private Map<QName, Object> resPayload = new LinkedHashMap<QName,
Object>();
+ // The return value
+ private Object returnValue;
+ // Map of output parameters, key being the parameter index in the method signature
+ private Map<Integer, Object> outParameters = new HashMap<Integer,
Object>();
+
+ public EndpointInvocation(OperationMetaData opMetaData)
+ {
+ this.opMetaData = opMetaData;
+ }
+
+ public OperationMetaData getOperationMetaData()
+ {
+ return opMetaData;
+ }
+
+ public Method getJavaMethod()
+ {
+ return opMetaData.getJavaMethod();
+ }
+
+ public Map<Integer, Object> getOutParameters()
+ {
+ return outParameters;
+ }
+
+ public List<QName> getRequestParamNames()
+ {
+ List<QName> xmlNames = new ArrayList<QName>();
+ xmlNames.addAll(reqPayload.keySet());
+ return xmlNames;
+ }
+
+ public void setRequestParamValue(QName xmlName, Object value)
+ {
+ log.debug("setRequestParamValue: [name=" + xmlName + ",value="
+ getTypeName(value) + "]");
+ reqPayload.put(xmlName, value);
+ }
+
+ public Object getRequestParamValue(QName xmlName) throws SOAPException
+ {
+ log.debug("getRequestParamValue: " + xmlName);
+ Object paramValue = reqPayload.get(xmlName);
+ ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ return paramValue;
+ }
+
+ /** Returns the payload that can be passed on to the endpoint implementation
+ */
+ public Object[] getRequestPayload() throws SOAPException
+ {
+ log.debug("getRequestPayload");
+ List<QName> xmlNames = getRequestParamNames();
+
+ Object[] payload = new
Object[opMetaData.getJavaMethod().getParameterTypes().length];
+ for (int i = 0; i < xmlNames.size(); i++)
+ {
+ QName xmlName = xmlNames.get(i);
+ Object paramValue = getRequestParamValue(xmlName);
+
+ ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
+ syncEndpointInputParam(paramMetaData, paramValue, payload);
+ }
+
+ return payload;
+ }
+
+ public List<QName> getResponseParamNames()
+ {
+ List<QName> xmlNames = new ArrayList<QName>();
+ xmlNames.addAll(resPayload.keySet());
+ return xmlNames;
+ }
+
+ public void setResponseParamValue(QName xmlName, Object value)
+ {
+ log.debug("setResponseParamValue: [name=" + xmlName + ",value="
+ getTypeName(value) + "]");
+ resPayload.put(xmlName, value);
+ }
+
+ public Object getResponseParamValue(QName xmlName) throws SOAPException
+ {
+ log.debug("getResponseParamValue: " + xmlName);
+ Object paramValue = resPayload.get(xmlName);
+ ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ if (paramValue != null)
+ {
+ Class valueType = paramValue.getClass();
+ if (HolderUtils.isHolderType(valueType))
+ {
+ paramValue = HolderUtils.getHolderValue(paramValue);
+ }
+ }
+ return paramValue;
+ }
+
+ public void setReturnValue(Object value)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (value != null && retMetaData == null)
+ throw new WSException("Operation does not have a return value: " +
opMetaData.getQName());
+
+ log.debug("setReturnValue: " + getTypeName(value));
+ this.returnValue = value;
+ }
+
+ public Object getReturnValue() throws SOAPException
+ {
+ log.debug("getReturnValue");
+ Object paramValue = returnValue;
+ ParameterMetaData paramMetaData = opMetaData.getReturnParameter();
+ if (paramMetaData != null)
+ {
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ }
+ return paramValue;
+ }
+
+ private Object transformPayloadValue(ParameterMetaData paramMetaData, final Object
paramValue) throws SOAPException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ QName xmlType = paramMetaData.getXmlType();
+ Class javaType = paramMetaData.getJavaType();
+ String javaName = paramMetaData.getJavaTypeName();
+
+ if (xmlType == null)
+ throw new IllegalStateException("Cannot obtain xml type for:
[xmlName=" + xmlName + ",javaName=" + javaName + "]");
+
+ Object retValue = paramValue;
+
+ // Handle attachment part
+ if (paramValue instanceof AttachmentPart)
+ {
+ AttachmentPart part = (AttachmentPart)paramValue;
+
+ Set mimeTypes = paramMetaData.getMimeTypes();
+ if (DataHandler.class.isAssignableFrom(javaType) &&
!javaType.equals(Object.class))
+ {
+ DataHandler handler = part.getDataHandler();
+ String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new SOAPException("Mime type " + mimeType + " not
allowed for parameter " + xmlName + " allowed types are " + mimeTypes);
+
+ retValue = part.getDataHandler();
+ }
+ else
+ {
+ retValue = part.getContent();
+ String mimeType = MimeUtils.getBaseMimeType(part.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new SOAPException("Mime type " + mimeType + " not
allowed for parameter " + xmlName + " allowed types are " + mimeTypes);
+
+ if (retValue != null)
+ {
+ Class valueType = retValue.getClass();
+ if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
+ throw new SOAPException("javaType [" + javaType.getName() +
"] is not assignable from attachment content: " + valueType.getName());
+ }
+ }
+ }
+ else if (paramValue instanceof SOAPContentElement)
+ {
+ // For type other than xsd:anyType we return the object value
+ if (xmlType.getLocalPart().equals("anyType") == false)
+ {
+ SOAPContentElement soapElement = (SOAPContentElement)paramValue;
+ retValue = soapElement.getObjectValue();
+ }
+ }
+
+ log.debug("transformPayloadValue: " + getTypeName(paramValue) + "
-> " + getTypeName(retValue));
+ return retValue;
+ }
+
+ /** Synchronize the operation IN, INOUT paramters with the call input parameters.
+ * Essetially it unwrapps holders and converts primitives to wrapper types.
+ */
+ public void initInputParams(Object[] inputParams)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Class javaType = paramMetaData.getJavaType();
+
+ Object value;
+ if (opMetaData.isDocumentWrapped() && paramMetaData.isInHeader() ==
false)
+ {
+ value = ParameterWrapping.wrapRequestParameters(paramMetaData, inputParams);
+ }
+ else
+ {
+ value = inputParams[paramMetaData.getIndex()];
+ if (value != null)
+ {
+ Class inputType = value.getClass();
+
+ if (HolderUtils.isHolderType(inputType))
+ {
+ // At runtime we lose the generic info for JAX-WS types,
+ // So we use the actual instance type if possible
+ value = HolderUtils.getHolderValue(value);
+ inputType = (value == null) ? HolderUtils.getValueType(inputType) :
value.getClass();
+ }
+
+ // Verify that the java type matches a registered xmlType
+ // Attachments are skipped because they don't use type mapping
+ if (!paramMetaData.isSwA() && !paramMetaData.isXOP())
+ {
+ if (JavaUtils.isAssignableFrom(javaType, inputType) == false)
+ throw new WSException("Parameter '" + javaType +
"' not assignable from: " + inputType);
+ }
+ }
+ }
+
+ setRequestParamValue(xmlName, value);
+ }
+ }
+
+ /**
+ * Synchronize the operation paramters with the endpoint method parameters
+ */
+ private void syncEndpointInputParam(ParameterMetaData paramMetaData, final Object
paramValue, Object[] payload)
+ {
+ Object retValue = paramValue;
+ Method method = opMetaData.getJavaMethod();
+ Class[] targetParameterTypes = method.getParameterTypes();
+
+ if (opMetaData.isDocumentWrapped() && paramMetaData.isInHeader() == false
&& paramMetaData.isMessageType() == false)
+ {
+ outParameters = ParameterWrapping.unwrapRequestParameters(paramMetaData,
paramValue, payload);
+ syncOutWrappedParameters(targetParameterTypes);
+ }
+ else
+ {
+ // Replace INOUT and OUT parameters by their respective holder values
+ int index = paramMetaData.getIndex();
+ Class targetParameterType = targetParameterTypes[index];
+
+ if (paramMetaData.getMode() == ParameterMode.INOUT || paramMetaData.getMode() ==
ParameterMode.OUT)
+ {
+ retValue = HolderUtils.createHolderInstance(paramValue,
targetParameterType);
+
+ QName xmlName = paramMetaData.getXmlName();
+ setResponseParamValue(xmlName, retValue);
+ }
+
+ if (retValue != null)
+ {
+ Class valueType = retValue.getClass();
+ if (JavaUtils.isAssignableFrom(targetParameterType, valueType) == false)
+ throw new WSException("Parameter " +
targetParameterType.getName() + " is not assignable from: " +
getTypeName(retValue));
+
+ if (valueType.isArray())
+ retValue = JavaUtils.syncArray(retValue, targetParameterType);
+ }
+
+ log.debug("syncEndpointInputParam: " + getTypeName(paramValue) +
" -> " + getTypeName(retValue) + "(" + index + ")");
+ payload[index] = retValue;
+ }
+ }
+
+ private void syncOutWrappedParameters(Class[] targetParameterTypes)
+ {
+ ParameterMetaData returnMetaData = opMetaData.getReturnParameter();
+ if (returnMetaData != null)
+ {
+ for (WrappedParameter param : returnMetaData.getWrappedParameters())
+ {
+ try
+ {
+ if (param.getIndex() >= 0)
+ outParameters.put(param.getIndex(),
targetParameterTypes[param.getIndex()].newInstance());
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Could not add output param: " +
param.getName(), e);
+
+ }
+ }
+ }
+ }
+
+ private String getTypeName(Object value)
+ {
+ String valueType = (value != null ? value.getClass().getName() : null);
+ return valueType;
+ }
+}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/MessageContextPropertyHelper.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/MessageContextPropertyHelper.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/MessageContextPropertyHelper.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -1,41 +0,0 @@
-/*
- * 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.core;
-
-/**
- * Interface to be implemented by property helpers to assist the retrieval
- * of objects added to the property context.
- *
- * If an instance of MessageContextPropertyHelper is added to the
- * CommonMessageContext a call to get for the same property will return
- * the result of callig get on the helper instead of returning the helper
- * itself.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since Oct 22, 2006
- */
-public interface MessageContextPropertyHelper
-{
-
- public Object get();
-
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/SOAPMessageMarshaller.java
(from rev 1571,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java 2006-12-06
10:47:51 UTC (rev 1571)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/SOAPMessageMarshaller.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,92 @@
+/*
+* 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.core;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class SOAPMessageMarshaller implements Marshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(SOAPMessageMarshaller.class);
+
+ /**
+ * Marshaller will need to take the dataObject and convert
+ * into primitive java data types and write to the
+ * given output.
+ *
+ * @param dataObject Object to be writen to output
+ * @param output The data output to write the object
+ * data to.
+ */
+ public void write(Object dataObject, OutputStream output) throws IOException
+ {
+ if (dataObject instanceof InvocationRequest)
+ dataObject = ((InvocationRequest)dataObject).getParameter();
+
+ if (dataObject instanceof OnewayInvocation)
+ dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
+
+ if ((dataObject instanceof SOAPMessage) == false)
+ throw new IllegalArgumentException("Not a SOAPMessage: " +
dataObject);
+
+ try
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
+
+ // debug the outgoing message
+ if (log.isTraceEnabled())
+ {
+ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
+ log.trace("Outgoing SOAPMessage\n" + envStr);
+ }
+
+ soapMessage.writeTo(output);
+ }
+ catch (SOAPException e)
+ {
+ log.error("Cannot marshall SOAPMessage", e);
+ throw new IOException(e.toString());
+ }
+ }
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ return new SOAPMessageMarshaller();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/SOAPMessageUnMarshaller.java (from
rev 1571,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java 2006-12-06
10:47:51 UTC (rev 1571)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/SOAPMessageUnMarshaller.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,124 @@
+/*
+ * 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.core;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class SOAPMessageUnMarshaller implements UnMarshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(SOAPMessageUnMarshaller.class);
+
+ private static List validResponseCodes = new ArrayList();
+ static
+ {
+ validResponseCodes.add(HttpServletResponse.SC_OK);
+ validResponseCodes.add(HttpServletResponse.SC_ACCEPTED);
+ validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ public Object read(InputStream inputStream, Map metadata) throws IOException,
ClassNotFoundException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Read input stream with metadata=" + metadata);
+ }
+
+ try
+ {
+ Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ String resMessage =
(String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+ if (resCode != null && validResponseCodes.contains(resCode) == false)
+ throw new WSException("Invalid HTTP server response [" + resCode +
"] - " + resMessage);
+
+ MimeHeaders mimeHeaders = getMimeHeaders(metadata);
+ SOAPMessage soapMsg = new
MessageFactoryImpl().createMessageInternal(mimeHeaders, inputStream, true);
+ return soapMsg;
+ }
+ catch (SOAPException e)
+ {
+ log.error("Cannot unmarshall SOAPMessage", e);
+ throw new IOException(e.toString());
+ }
+ }
+
+ /**
+ * Set the class loader to use for unmarhsalling. This may
+ * be needed when need to have access to class definitions that
+ * are not part of this unmarshaller's parent classloader (especially
+ * when doing remote classloading).
+ *
+ * @param classloader
+ */
+ public void setClassLoader(ClassLoader classloader)
+ {
+ //NO OP
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return new SOAPMessageUnMarshaller();
+ }
+
+ private MimeHeaders getMimeHeaders(Map metadata)
+ {
+ log.debug("getMimeHeaders from: " + metadata);
+
+ MimeHeaders headers = new MimeHeaders();
+ Iterator i = metadata.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String)i.next();
+ Object value = metadata.get(key);
+ if (key != null && value instanceof List)
+ {
+ for (Object listValue : (List)value)
+ {
+ headers.addHeader(key, listValue.toString());
+ }
+ }
+ }
+ return headers;
+ }
+}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -58,10 +58,10 @@
import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.common.utils.JavaUtils;
import org.jboss.ws.core.CommonClient;
-import org.jboss.ws.core.binding.UnboundHeader;
import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.extras.xop.XOPContext;
/** Provides support for the dynamic invocation of a service endpoint.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/HTTPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/HTTPBindingJAXWS.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/HTTPBindingJAXWS.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -35,8 +35,8 @@
import org.jboss.ws.common.umdm.OperationMetaData;
import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.binding.EndpointInvocation;
-import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.soap.UnboundHeader;
/**
* The HTTPBinding interface is an abstraction for the XML/HTTP binding.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/MessageBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/MessageBinding.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/MessageBinding.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -38,10 +38,10 @@
import org.jboss.ws.common.umdm.ParameterMetaData;
import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.binding.EndpointInvocation;
-import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.UnboundHeader;
/** A binding for unprocessed SOAP Messages
*
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/PayloadBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/PayloadBinding.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/PayloadBinding.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -40,13 +40,13 @@
import org.jboss.ws.common.umdm.ParameterMetaData;
import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.binding.EndpointInvocation;
-import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.UnboundHeader;
/** A BindingProvider for a JAXWS payload
*
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -70,8 +70,6 @@
import org.jboss.ws.common.metadata.jsr181.HandlerChainsMetaData;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.common.metadata.wsdl.WSDLWriter;
-import org.jboss.ws.common.metadata.wsdl.WSDLWriter.ResolvedWriter;
import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.common.umdm.EndpointMetaData;
import org.jboss.ws.common.umdm.FaultMetaData;
@@ -98,6 +96,8 @@
import org.jboss.ws.extras.addressing.metadata.AddressingOpMetaExt;
import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
import org.jboss.ws.tools.jaxws.WSDLGenerator;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
+import org.jboss.ws.tools.wsdl.WSDLWriterResolver;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -849,17 +849,16 @@
wsdlTmpFile.deleteOnExit();
Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile,
Constants.DEFAULT_XML_CHARSET);
- wsdlDefinitions.write(writer, Constants.DEFAULT_XML_CHARSET, new
WSDLWriter.WriterResolver()
+ new WSDLWriter(wsdlDefinitions).write(writer, Constants.DEFAULT_XML_CHARSET,
new WSDLWriterResolver()
{
- public ResolvedWriter resolve(String suggestedFile) throws IOException
+ public WSDLWriterResolver resolve(String suggestedFile) throws
IOException
{
File newTmpFile = File.createTempFile(suggestedFile, ".wsdl",
tmpdir);
newTmpFile.deleteOnExit();
- WSDLWriter.ResolvedWriter resolvedWriter = new
WSDLWriter.ResolvedWriter();
- resolvedWriter.actualFile = newTmpFile.getName();
- resolvedWriter.charset = Constants.DEFAULT_XML_CHARSET;
- resolvedWriter.writer = IOUtils.getCharsetFileWriter(newTmpFile,
Constants.DEFAULT_XML_CHARSET);
- return resolvedWriter;
+ actualFile = newTmpFile.getName();
+ charset = Constants.DEFAULT_XML_CHARSET;
+ writer = IOUtils.getCharsetFileWriter(newTmpFile,
Constants.DEFAULT_XML_CHARSET);
+ return this;
}
});
writer.close();
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -51,7 +51,7 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxws.core.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextPropertyHelper.java
(from rev 1571,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/MessageContextPropertyHelper.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/MessageContextPropertyHelper.java 2006-12-06
10:47:51 UTC (rev 1571)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextPropertyHelper.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,41 @@
+/*
+ * 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.core.server;
+
+/**
+ * Interface to be implemented by property helpers to assist the retrieval
+ * of objects added to the property context.
+ *
+ * If an instance of MessageContextPropertyHelper is added to the
+ * CommonMessageContext a call to get for the same property will return
+ * the result of callig get on the helper instead of returning the helper
+ * itself.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since Oct 22, 2006
+ */
+public interface MessageContextPropertyHelper
+{
+
+ public Object get();
+
+}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -34,7 +34,7 @@
import org.jboss.ws.common.WSException;
import org.jboss.ws.common.umdm.ServerEndpointMetaData;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -64,7 +64,6 @@
import org.jboss.ws.common.umdm.EndpointMetaData.Type;
import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.MessageContextPropertyHelper;
import org.jboss.ws.core.ThreadLocalAssociation;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -37,7 +37,6 @@
import javax.wsdl.Definition;
import javax.wsdl.Import;
import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
@@ -50,6 +49,7 @@
import org.jboss.ws.common.umdm.UnifiedMetaData;
import org.jboss.ws.common.utils.DOMUtils;
import org.jboss.ws.common.utils.IOUtils;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -102,7 +102,7 @@
{
Writer fWriter = IOUtils.getCharsetFileWriter(targetFile,
Constants.DEFAULT_XML_CHARSET);
WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- wsdlDefinitions.write(fWriter, Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdlDefinitions).write(fWriter,
Constants.DEFAULT_XML_CHARSET);
URL wsdlPublishURL = targetFile.toURL();
log.info("WSDL published to: " + wsdlPublishURL);
@@ -167,7 +167,7 @@
targetFile.getParentFile().mkdirs();
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
+ javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
FileWriter fw = new FileWriter(targetFile);
wsdlWriter.writeWSDL(subdef, fw);
fw.close();
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -44,8 +44,8 @@
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.security.SSLSocketBuilder;
import org.jboss.remoting.transport.http.HTTPMetadataConstants;
-import org.jboss.ws.core.binding.soap.SOAPMessageMarshaller;
-import org.jboss.ws.core.binding.soap.SOAPMessageUnMarshaller;
+import org.jboss.ws.core.SOAPMessageMarshaller;
+import org.jboss.ws.core.SOAPMessageUnMarshaller;
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.extras.xop.XOPContext;
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/UnboundHeader.java
(from rev 1571,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/UnboundHeader.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/UnboundHeader.java 2006-12-06
10:47:51 UTC (rev 1571)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/UnboundHeader.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,100 @@
+/*
+ * 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.core.soap;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+
+import org.jboss.ws.common.umdm.OperationMetaData;
+import org.jboss.ws.common.umdm.ParameterMetaData;
+
+/**
+ * Represents an unbound SOAPHeaderElement
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Jan-2005
+ */
+public class UnboundHeader
+{
+ private QName xmlName;
+ private QName xmlType;
+ private Class javaType;
+ private ParameterMode mode;
+ private Object headerValue;
+
+ public UnboundHeader(QName xmlName, QName xmlType, Class javaType, ParameterMode
mode)
+ {
+ this.xmlName = xmlName;
+ this.xmlType = xmlType;
+ this.javaType = javaType;
+ this.mode = mode;
+ }
+
+ public QName getXmlName()
+ {
+ return xmlName;
+ }
+
+ public QName getXmlType()
+ {
+ return xmlType;
+ }
+
+ public Class getJavaType()
+ {
+ return javaType;
+ }
+
+ public ParameterMode getMode()
+ {
+ return mode;
+ }
+
+ public Object getHeaderValue()
+ {
+ return headerValue;
+ }
+
+ public void setHeaderValue(Object headerValue)
+ {
+ this.headerValue = headerValue;
+ }
+
+ public ParameterMetaData toParameterMetaData(OperationMetaData opMetaData)
+ {
+ ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName,
xmlType, javaType.getName());
+ paramMetaData.setInHeader(true);
+ return paramMetaData;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nUnboundHeader:");
+ buffer.append("\n xmlName=" + getXmlName());
+ buffer.append("\n xmlType=" + getXmlType());
+ buffer.append("\n javaType=" + getJavaType().getName());
+ buffer.append("\n mode=" + getMode());
+ return buffer.toString();
+ }
+}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -185,7 +185,7 @@
* would already have been written.
*
* @see
org.jboss.ws.core.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object,
boolean)
- * @see org.jboss.ws.core.binding.soap.SOAPMessageMarshaller#write(Object,
java.io.OutputStream)
+ * @see org.jboss.ws.core.SOAPMessageMarshaller#write(Object, java.io.OutputStream)
*/
public static void eagerlyCreateAttachments()
{
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -33,7 +33,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.common.WSException;
import org.jboss.ws.common.utils.ObjectNameFactory;
-import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.server.AbstractServiceEndpointInvoker;
import org.jboss.ws.core.server.ServiceEndpointInfo;
import org.jboss.ws.core.server.ServiceEndpointInvoker;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -41,10 +41,10 @@
import org.jboss.ws.common.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.common.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.common.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-import org.jboss.ws.common.metadata.wsdl.WSDL11DefinitionFactory;
import org.jboss.ws.core.jaxrpc.ServiceReferenceable;
import org.jboss.ws.core.metadata.builder.jaxrpc.JAXRPCClientDeployment;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.tools.wsdl.WSDL11DefinitionFactory;
/**
* Binds a JAXRPC Service object in the client's ENC for every service-ref element in
the
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2006-12-06
11:19:33 UTC (rev 1572)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -42,6 +42,7 @@
import org.jboss.ws.common.utils.DOMWriter;
import org.jboss.ws.tools.Configuration.OperationConfig;
import org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
import org.w3c.dom.Element;
/**
@@ -339,7 +340,7 @@
// Debug the generated wsdl
StringWriter sw = new StringWriter();
- wsdlDefinitions.write(sw, Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdlDefinitions).write(sw, Constants.DEFAULT_XML_CHARSET);
log.debug("Generated WSDL:\n" + sw.toString());
// Debug the generated mapping file
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-12-06
11:19:33 UTC (rev 1572)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -46,7 +46,6 @@
import org.jboss.ws.common.jaxrpc.LiteralTypeMapping;
import org.jboss.ws.common.metadata.wsdl.NCName;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLException;
import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceFault;
@@ -60,6 +59,7 @@
import org.jboss.ws.common.metadata.wsdl.xsd.SchemaUtils;
import org.jboss.ws.common.utils.JavaUtils;
import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -68,6 +68,7 @@
import org.jboss.ws.tools.client.ServiceCreator;
import org.jboss.ws.tools.interfaces.WSDotXMLCreatorIntf;
import org.jboss.ws.tools.mapping.MappingFileGenerator;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
/**
* Helper class used by the command line tool "jbossws"
@@ -125,7 +126,7 @@
String wsdlPath = outDir + "/wsdl/" + j2wc.serviceName +
".wsdl";
//Generate the WSDL
Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath),
Constants.DEFAULT_XML_CHARSET);
- wsdl.write(fw, Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET);
fw.close();
//Generate the Mapping File
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
(from rev 1572,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11DefinitionFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11DefinitionFactory.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,96 @@
+/*
+* 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;
+
+// $Id$
+
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.utils.JBossWSEntityResolver;
+import org.xml.sax.EntityResolver;
+
+import com.ibm.wsdl.xml.WSDLReaderImpl;
+
+/**
+ * A factory that creates a WSDL-1.1 <code>Definition</code> from an URL.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-April-2004
+ */
+public class WSDL11DefinitionFactory
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class);
+
+ // This feature is set by default in wsdl4j, it means the object structore 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 WSDLReader that is used by this factory
+ private WSDLReader wsdlReader;
+
+ // Hide constructor
+ private WSDL11DefinitionFactory() throws WSDLException
+ {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ wsdlReader = wsdlFactory.newWSDLReader();
+ wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
+ }
+
+ /** Create a new instance of a wsdl factory */
+ public static WSDL11DefinitionFactory newInstance() throws WSDLException
+ {
+ return new WSDL11DefinitionFactory();
+ }
+
+ /** Set a feature on the underlying reader */
+ public void setFeature(String name, boolean value) throws IllegalArgumentException
+ {
+ wsdlReader.setFeature(name, value);
+ }
+
+ /**
+ * Read the wsdl document from the given URL
+ */
+ public Definition parse(URL wsdlLocation) throws WSDLException
+ {
+ if (wsdlLocation == null)
+ throw new IllegalArgumentException("URL cannot be null");
+
+ log.trace("parse: " + wsdlLocation.toExternalForm());
+
+ EntityResolver entityResolver = new JBossWSEntityResolver();
+
+ // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
+ ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
+
+ Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver,
wsdlLocation));
+ return wsdlDefinition;
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
(from rev 1572,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Reader.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Reader.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,1219 @@
+/*
+ * 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;
+
+// $Id$
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+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.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.common.jaxrpc.Style;
+import org.jboss.ws.common.metadata.wsdl.NCName;
+import org.jboss.ws.common.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingMessageReference;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLMIMEPart;
+import org.jboss.ws.common.metadata.wsdl.WSDLProperty;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCPart;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem;
+import org.jboss.ws.common.metadata.wsdl.WSDLSOAPHeader;
+import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.common.metadata.wsdl.XSModelTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
+import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.common.metadata.wsdl.xsd.SchemaUtils;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.DOMWriter;
+import org.jboss.ws.tools.JavaToXSD;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Anil.Saldhana(a)jboss.org
+ * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
+ * @since 10-Oct-2004
+ */
+public class WSDL11Reader
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDL11Reader.class);
+
+ private static QName SOAP12_BINDING = new QName(Constants.NS_SOAP12,
"binding");
+ private static QName SOAP12_BODY = new QName(Constants.NS_SOAP12, "body");
+ private static QName SOAP12_OPERATION = new QName(Constants.NS_SOAP12,
"operation");
+ private static QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12,
"address");
+
+ private WSDLDefinitions destWsdl;
+
+ // Maps wsdl message parts to their corresponding element names
+ private Map<String, QName> messagePartToElementMap = new HashMap<String,
QName>();
+
+ // Map of <ns,URL> for schemalocation keyed by namespace
+ private Map<String, URL> schemaLocationsMap = new HashMap<String, URL>();
+
+ private LinkedHashMap<QName, Binding> allBindings;
+ private LinkedHashMap<QName, Binding> portTypeBindings;
+
+ // Temporary files used by this reader.
+ private List<File> tempFiles = new ArrayList<File>();
+
+ /**
+ * Takes a WSDL11 Definition element and converts into
+ * our object graph that has been developed for WSDL20
+ *
+ * @param srcWsdl The src WSDL11 definition
+ * @param wsdlLoc The source location, if null we cannot process imports or includes
+ */
+ public WSDLDefinitions processDefinition(Definition srcWsdl, URL wsdlLoc) throws
IOException
+ {
+ log.trace("processDefinition: " + wsdlLoc);
+
+ destWsdl = new WSDLDefinitions();
+ destWsdl.setWsdlTypes(new XSModelTypes());
+ destWsdl.setWsdlOneOneDefinition(srcWsdl);
+ destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
+
+ processNamespaces(srcWsdl);
+ processTypes(srcWsdl, wsdlLoc);
+ processServices(srcWsdl);
+
+ if (getAllDefinedBindings(srcWsdl).size() != destWsdl.getBindings().length)
+ processUnreachableBindings(srcWsdl);
+
+ cleanupTemporaryFiles();
+
+ return destWsdl;
+ }
+
+ private void cleanupTemporaryFiles()
+ {
+ for (File current : tempFiles)
+ {
+ current.delete();
+ }
+ }
+
+ // process all bindings not within service separetly
+ private void processUnreachableBindings(Definition srcWsdl)
+ {
+ log.trace("processUnreachableBindings");
+
+ Iterator it = getAllDefinedBindings(srcWsdl).values().iterator();
+ while (it.hasNext())
+ {
+ Binding srcBinding = (Binding)it.next();
+ QName srcQName = srcBinding.getQName();
+
+ WSDLBinding destBinding = destWsdl.getBinding(new NCName(srcQName));
+ if (destBinding == null)
+ {
+ processBinding(srcWsdl, srcBinding);
+ }
+ }
+ }
+
+ private void processNamespaces(Definition srcWsdl)
+ {
+ String targetNS = srcWsdl.getTargetNamespace();
+ destWsdl.setTargetNamespace(targetNS);
+
+ // Copy wsdl namespaces
+ Map nsMap = srcWsdl.getNamespaces();
+ Iterator iter = nsMap.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)iter.next();
+ String prefix = (String)entry.getKey();
+ String nsURI = (String)entry.getValue();
+ destWsdl.registerNamespaceURI(nsURI, prefix);
+ }
+ }
+
+ private void processTypes(Definition srcWsdl, URL wsdlLoc) throws IOException
+ {
+ log.trace("BEGIN processTypes: " + wsdlLoc);
+
+ WSDLTypes destTypes = destWsdl.getWsdlTypes();
+
+ Types srcTypes = srcWsdl.getTypes();
+ if (srcTypes != null && srcTypes.getExtensibilityElements().size() > 0)
+ {
+ List extElements = srcTypes.getExtensibilityElements();
+ int len = extElements.size();
+
+ for (int i = 0; i < len; i++)
+ {
+ ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
+
+ Element domElement;
+ if (extElement instanceof Schema)
+ {
+ domElement = ((Schema)extElement).getElement();
+ }
+ else if (extElement instanceof UnknownExtensibilityElement)
+ {
+ domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ }
+ else
+ {
+ throw new WSException("Unsupported extensibility element: " +
extElement);
+ }
+
+ Element domElementClone = (Element)domElement.cloneNode(true);
+ copyParentNamespaceDeclarations(domElementClone, domElement);
+
+ String localname = domElementClone.getLocalName();
+ try
+ {
+ if ("import".equals(localname))
+ {
+ processSchemaImport(destTypes, wsdlLoc, domElementClone);
+ }
+ else if ("schema".equals(localname))
+ {
+ processSchemaInclude(destTypes, wsdlLoc, domElementClone);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsuported schema element:
" + localname);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot extract schema definition", e);
+ }
+ }
+
+ if (len > 0)
+ {
+ JavaToXSD jxsd = new JavaToXSD();
+ JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap);
+ WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel);
+ }
+ }
+ else
+ {
+ log.trace("Empty wsdl types element, processing imports");
+ Iterator it = srcWsdl.getImports().values().iterator();
+ while (it.hasNext())
+ {
+ List<Import> srcImports = (List<Import>)it.next();
+ for (Import srcImport : srcImports)
+ {
+ Definition impDefinition = srcImport.getDefinition();
+ String impLoc = impDefinition.getDocumentBaseURI();
+ processTypes(impDefinition, new URL(impLoc));
+ }
+ }
+ }
+
+ log.trace("END processTypes: " + wsdlLoc + "\n" + destTypes);
+ }
+
+ private void copyParentNamespaceDeclarations(Element destElement, Element srcElement)
+ {
+ Node parent = srcElement.getParentNode();
+ while (parent != null)
+ {
+ if (parent.hasAttributes())
+ {
+ NamedNodeMap attributes = parent.getAttributes();
+ for (int i = 0; i < attributes.getLength(); i++)
+ {
+ Attr attr = (Attr)attributes.item(i);
+ String name = attr.getName();
+ String value = attr.getValue();
+ if (name.startsWith("xmlns:") &&
destElement.hasAttribute(name) == false)
+ destElement.setAttribute(name, value);
+ }
+ }
+ parent = parent.getParentNode();
+ }
+ }
+
+ private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl)
throws IOException
+ {
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process import, parent location
not set");
+
+ log.trace("processSchemaImport: " + wsdlLoc);
+
+ String location = getOptionalAttribute(importEl, "schemaLocation");
+ if (location == null)
+ throw new IllegalArgumentException("schemaLocation is null for
xsd:import");
+
+ URL locationURL = getLocationURL(wsdlLoc, location);
+ Element rootElement = DOMUtils.parse(locationURL.openStream());
+ URL newloc = processSchemaInclude(types, locationURL, rootElement);
+ if (newloc != null)
+ importEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ }
+
+ private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl)
throws IOException
+ {
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process iclude, parent location
not set");
+
+ File tmpFile = null;
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process include, parent location
not set");
+
+ log.trace("processSchemaInclude: " + wsdlLoc);
+
+ String schemaPrefix = schemaEl.getPrefix();
+
+ String importTag = (schemaPrefix == null) ? "import" : schemaPrefix +
":import";
+ Element importElement =
schemaEl.getOwnerDocument().createElementNS(Constants.NS_SCHEMA_XSD, importTag);
+ importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC);
+ schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl));
+
+ // Handle schema includes
+ Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "include"));
+ while (it.hasNext())
+ {
+ Element includeEl = (Element)it.next();
+ String location = getOptionalAttribute(includeEl, "schemaLocation");
+ if (location == null)
+ throw new IllegalArgumentException("schemaLocation is null for
xsd:include");
+
+ URL locationURL = getLocationURL(wsdlLoc, location);
+ Element rootElement = DOMUtils.parse(locationURL.openStream());
+ URL newloc = processSchemaInclude(types, locationURL, rootElement);
+ if (newloc != null)
+ includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ }
+
+ String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
+ if (targetNS != null)
+ {
+ log.trace("processSchemaInclude: [targetNS=" + targetNS +
",parentURL=" + wsdlLoc + "]");
+
+ tmpFile = SchemaUtils.getSchemaTempFile(targetNS);
+ tempFiles.add(tmpFile);
+
+ FileWriter fwrite = new FileWriter(tmpFile);
+ new DOMWriter(fwrite).setPrettyprint(true).print(schemaEl);
+ fwrite.close();
+
+ schemaLocationsMap.put(targetNS, tmpFile.toURL());
+ }
+
+ // schema elements that have no target namespace are skipped
+ //
+ // <xsd:schema>
+ // <xsd:import
namespace="http://org.jboss.webservice/example/types"
schemaLocation="Hello.xsd"/>
+ // <xsd:import
namespace="http://org.jboss.webservice/example/types/arrays/org/jboss/test/webservice/admindevel"
schemaLocation="subdir/HelloArr.xsd"/>
+ // </xsd:schema>
+ if (targetNS == null)
+ {
+ log.trace("Schema element without target namespace in: " + wsdlLoc);
+ }
+
+ handleSchemaImports(schemaEl, wsdlLoc);
+
+ return tmpFile != null ? tmpFile.toURL() : null;
+ }
+
+ private void handleSchemaImports(Element schemaEl, URL wsdlLoc) throws
MalformedURLException
+ {
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process import, parent location
not set");
+
+ Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "import"));
+ while (it.hasNext())
+ {
+ Element includeEl = (Element)it.next();
+ String schemaLocation = getOptionalAttribute(includeEl,
"schemaLocation");
+ String namespace = getOptionalAttribute(includeEl, "namespace");
+
+ log.trace("handleSchemaImport: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
+
+ // Skip, let the entity resolver resolve these
+ if (namespace != null && schemaLocation != null)
+ {
+ URL currLoc = getLocationURL(wsdlLoc, schemaLocation);
+ schemaLocationsMap.put(namespace, currLoc);
+ }
+ else
+ {
+ log.trace("Skip schema import: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
+ }
+ }
+ }
+
+ private URL getLocationURL(URL parentURL, String location) throws
MalformedURLException
+ {
+ log.trace("getLocationURL: [location=" + location + ",parent="
+ parentURL + "]");
+
+ URL locationURL = null;
+ try
+ {
+ locationURL = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore malformed URL
+ }
+
+ if (locationURL == null)
+ {
+ String parentProtocol = parentURL.getProtocol();
+ if (parentProtocol.equals("file") &&
!location.startsWith("/"))
+ {
+ String path = parentURL.toExternalForm();
+ path = path.substring(0, path.lastIndexOf("/"));
+ locationURL = new URL(path + "/" + location);
+ }
+ else if (parentProtocol.startsWith("http") &&
location.startsWith("/"))
+ {
+ String path = parentProtocol + "://" + parentURL.getHost() +
":" + parentURL.getPort();
+ locationURL = new URL(path + location);
+ }
+ else if (parentProtocol.equals("jar") &&
!location.startsWith("/"))
+ {
+ String path = parentURL.toExternalForm();
+ path = path.substring(0, path.lastIndexOf("/"));
+ locationURL = new URL(path + "/" + location);
+ }
+ else
+ {
+ throw new WSException("Unsupported schemaLocation: " + location);
+ }
+ }
+
+ log.trace("Modified schemaLocation: " + locationURL);
+ return locationURL;
+ }
+
+ private void processPortType(Definition srcWsdl, PortType srcPortType)
+ {
+ log.trace("processPortType: " + srcPortType.getQName());
+
+ QName qname = srcPortType.getQName();
+ NCName ncName = new NCName(qname);
+ if (destWsdl.getInterface(ncName) == null)
+ {
+ WSDLInterface destInterface = new WSDLInterface(destWsdl);
+ destInterface.setName(ncName);
+ destInterface.setQName(qname);
+
+ // eventing extensions
+ QName eventSourceProp =
(QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSE_EVENTSOURCE);
+ if (eventSourceProp != null &&
eventSourceProp.getLocalPart().equals(Boolean.TRUE.toString()))
+ {
+ destInterface.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_EVENTSOURCE, eventSourceProp.getLocalPart()));
+ }
+
+ destWsdl.addInterface(destInterface);
+
+ processPortTypeOperations(srcWsdl, destInterface, srcPortType);
+ }
+ }
+
+ private void processPortTypeOperations(Definition srcWsdl, WSDLInterface
destInterface, PortType srcPortType)
+ {
+ Iterator itOperations = srcPortType.getOperations().iterator();
+ while (itOperations.hasNext())
+ {
+ Operation srcOperation = (Operation)itOperations.next();
+
+ WSDLInterfaceOperation destOperation = new
WSDLInterfaceOperation(destInterface);
+ destOperation.setName(new NCName(srcOperation.getName()));
+ destOperation.setStyle(getOperationStyle(srcWsdl, srcPortType, srcOperation));
+
+ processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
+ processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
+ processOperationFaults(srcOperation, destOperation, destInterface);
+
+ destInterface.addOperation(destOperation);
+ }
+ }
+
+ private void processOperationInput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
+ {
+ Input srcInput = srcOperation.getInput();
+ if (srcInput != null)
+ {
+ Message srcMessage = srcInput.getMessage();
+ log.trace("processOperationInput: " + srcMessage.getQName());
+
+ QName wsaAction =
(QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+ if (wsaAction != null)
+ destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN,
wsaAction.getLocalPart()));
+
+ List<String> paramOrder = (List<String>)
srcOperation.getParameterOrdering();
+ if (paramOrder != null)
+ {
+ for (String name : paramOrder)
+ {
+ if (srcMessage.getPart(name) != null)
+ destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name));
+ }
+ }
+
+ WSDLInterfaceOperationInput rpcInput = new
WSDLInterfaceOperationInput(destOperation);
+ for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(paramOrder))
+ {
+ if (Constants.URI_STYLE_IRI == destOperation.getStyle())
+ {
+ WSDLInterfaceOperationInput destInput = new
WSDLInterfaceOperationInput(destOperation);
+ QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
+ destInput.setElement(elementName);
+
+ //Lets remember the Message name
+ destInput.setMessageName(srcMessage.getQName());
+ destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN,
srcMessage.getQName().getLocalPart()));
+
+ destInput.setPartName(srcPart.getName());
+
+ destOperation.addInput(destInput);
+ }
+ else
+ {
+ // If we don't have a type then we aren't a valid RPC parameter
+ // This could happen on a header element, in which case the
+ // binding will pick it up
+ QName xmlType = srcPart.getTypeName();
+ if (xmlType != null)
+ rpcInput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
+ else
+ messagePartToElementName(srcWsdl, srcPortType, srcOperation,
srcMessage, srcPart);
+ }
+ }
+ if (Constants.URI_STYLE_RPC == destOperation.getStyle())
+ {
+ // This is really a place holder, but also the actual value used in
+ // WSDL 2.0 RPC bindings
+ rpcInput.setElement(destOperation.getQName());
+ rpcInput.setMessageName(srcMessage.getQName());
+ destOperation.addInput(rpcInput);
+ }
+ }
+ }
+
+ private void processOperationOutput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
+ {
+ Output srcOutput = srcOperation.getOutput();
+ if (srcOutput == null)
+ {
+ destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
+ return;
+ }
+
+ Message srcMessage = srcOutput.getMessage();
+ log.trace("processOperationOutput: " + srcMessage.getQName());
+
+ destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
+ QName wsaAction = (QName)
srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+ if (wsaAction != null)
+ destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT,
wsaAction.getLocalPart()));
+
+ List<String> paramOrder = (List<String>)
srcOperation.getParameterOrdering();
+ if (paramOrder != null)
+ {
+ for (String name : paramOrder)
+ {
+ if (srcMessage.getPart(name) != null)
+ {
+ WSDLRPCSignatureItem item = destOperation.getRpcSignatureitem(name);
+ if (item != null)
+ item.setDirection(Direction.INOUT);
+ else
+ destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name,
Direction.OUT));
+ }
+ }
+ }
+
+ WSDLInterfaceOperationOutput rpcOutput = new
WSDLInterfaceOperationOutput(destOperation);
+ for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(null))
+ {
+ if (Constants.URI_STYLE_IRI == destOperation.getStyle())
+ {
+ WSDLInterfaceOperationOutput destOutput = new
WSDLInterfaceOperationOutput(destOperation);
+
+ QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
+ destOutput.setElement(elementName);
+
+ // Lets remember the Message name
+ destOutput.setMessageName(srcMessage.getQName());
+ destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT, srcMessage.getQName()
+ .getLocalPart()));
+
+ // Remember the original part name
+ destOutput.setPartName(srcPart.getName());
+
+ destOperation.addOutput(destOutput);
+ }
+ else
+ {
+ // If we don't have a type then we aren't a valid RPC parameter
+ // This could happen on a header element, in which case the
+ // binding will pick it up
+ QName xmlType = srcPart.getTypeName();
+ if (xmlType != null)
+ rpcOutput.addChildPart(new WSDLRPCPart(srcPart.getName(),
destWsdl.registerQName(xmlType)));
+ else
+ messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage,
srcPart);
+ }
+ }
+
+ if (Constants.URI_STYLE_RPC == destOperation.getStyle())
+ {
+ // This is really a place holder, but also the actual value used in
+ // WSDL 2.0 RPC bindings
+ QName name = destOperation.getQName();
+ rpcOutput.setElement(new QName(name.getNamespaceURI(), name.getLocalPart() +
"Response"));
+ rpcOutput.setMessageName(srcMessage.getQName());
+ destOperation.addOutput(rpcOutput);
+ }
+ }
+
+ private void processOperationFaults(Operation srcOperation, WSDLInterfaceOperation
destOperation, WSDLInterface destInterface)
+ {
+
+ Map faults = srcOperation.getFaults();
+ Iterator itFaults = faults.values().iterator();
+ while (itFaults.hasNext())
+ {
+ Fault srcFault = (Fault)itFaults.next();
+ processOperationFault(destOperation, destInterface, srcFault);
+ }
+ }
+
+ private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface
destInterface, Fault srcFault)
+ {
+ String faultName = srcFault.getName();
+ log.trace("processOperationFault: " + faultName);
+
+ WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface);
+ NCName ncName = new NCName(faultName);
+ destFault.setName(ncName);
+
+ Message message = srcFault.getMessage();
+ QName messageName = message.getQName();
+
+ Map partsMap = message.getParts();
+ if (partsMap.size() != 1)
+ throw new WSException("Unsupported number of fault parts in message "
+ messageName);
+
+ Part part = (Part)partsMap.values().iterator().next();
+ QName xmlName = part.getElementName();
+
+ if (xmlName != null)
+ {
+ destFault.setElement(xmlName);
+ }
+ else
+ {
+ destFault.setElement(messageName);
+ log.warn("Unsupported fault message part in message: " +
messageName);
+ }
+
+ WSDLInterfaceFault prevFault = destInterface.getFault(ncName);
+ if (prevFault != null && prevFault.getName().equals(ncName) == false)
+ throw new WSException("Fault name must be unique: " + faultName);
+
+ // Add the fault to the interface
+ destInterface.addFault(destFault);
+
+ // Add the fault refererence to the operation
+ WSDLInterfaceOperationOutfault opOutFault = new
WSDLInterfaceOperationOutfault(destOperation);
+ opOutFault.setRef(new QName(destWsdl.getTargetNamespace(), faultName));
+ destOperation.addOutfault(opOutFault);
+ }
+
+ /** Translate the message part name into an XML element name.
+ */
+ private QName messagePartToElementName(Definition srcWsdl, PortType srcPortType,
Operation srcOperation, Message srcMessage, Part srcPart)
+ {
+ // <part name="param" element="tns:SomeType" />
+ QName xmlName = srcPart.getElementName();
+
+ // <part name="param" type="xsd:string" />
+ if (xmlName == null)
+ xmlName = new QName(srcPart.getName());
+
+ xmlName = destWsdl.registerQName(xmlName);
+ String key = srcMessage.getQName() + "->" + srcPart.getName();
+ messagePartToElementMap.put(key, xmlName);
+
+ return xmlName;
+ }
+
+ private BindingOperation getBindingOperation(Definition srcWsdl, PortType srcPortType,
Operation srcOperation)
+ {
+ Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
+
+ if (srcBinding == null)
+ throw new WSException("Cannot find binding for: " +
srcPortType.getQName());
+
+ String srcOperationName = srcOperation.getName();
+ BindingOperation srcBindingOperation =
srcBinding.getBindingOperation(srcOperationName, null, null);
+ if (srcBindingOperation == null)
+ throw new WSException("Cannot find binding operation for: " +
srcOperationName);
+ return srcBindingOperation;
+ }
+
+ private String getOperationStyle(Definition srcWsdl, PortType srcPortType, Operation
srcOperation)
+ {
+ Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
+ BindingOperation srcBindingOperation = getBindingOperation(srcWsdl, srcPortType,
srcOperation);
+
+ String operationStyle = null;
+ List<ExtensibilityElement> extList =
srcBindingOperation.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPOperation)
+ {
+ SOAPOperation soapOp = (SOAPOperation)extElement;
+ operationStyle = soapOp.getStyle();
+ }
+ else if (SOAP12_OPERATION.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ operationStyle = getOptionalAttribute(domElement, "style");
+ }
+ }
+
+ if (operationStyle == null)
+ {
+ for (ExtensibilityElement extElement : (List<ExtensibilityElement>)
srcBinding.getExtensibilityElements())
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBinding)
+ {
+ SOAPBinding soapBinding = (SOAPBinding) extElement;
+ operationStyle = soapBinding.getStyle();
+ }
+ else if (SOAP12_BINDING.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)
extElement).getElement();
+ operationStyle = getOptionalAttribute(domElement, "style");
+ }
+ }
+ }
+
+ return ("rpc".equals(operationStyle)) ? Constants.URI_STYLE_RPC :
Constants.URI_STYLE_IRI;
+ }
+
+ private void processBinding(Definition srcWsdl, Binding srcBinding)
+ {
+ QName srcBindingQName = srcBinding.getQName();
+ log.trace("processBinding: " + srcBindingQName);
+
+ NCName ncName = new NCName(srcBindingQName);
+ if (destWsdl.getBinding(ncName) == null)
+ {
+ PortType srcPortType = srcBinding.getPortType();
+ if (srcPortType == null)
+ throw new WSException("Cannot find port type for binding: " +
ncName);
+
+ processPortType(srcWsdl, srcPortType);
+
+ WSDLBinding destBinding = new WSDLBinding(destWsdl);
+ destBinding.setQName(srcBindingQName);
+ destBinding.setName(ncName);
+ destBinding.setInterfaceName(srcPortType.getQName());
+
+ String bindingStyle = Style.getDefaultStyle().toString();
+ List<ExtensibilityElement> extList =
srcBinding.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBinding)
+ {
+ destBinding.setType(Constants.NS_SOAP11);
+ SOAPBinding soapBinding = (SOAPBinding)extElement;
+ bindingStyle = soapBinding.getStyle();
+ }
+ else if (SOAP12_BINDING.equals(elementType))
+ {
+ destBinding.setType(Constants.NS_SOAP12);
+ Element domElement =
((UnknownExtensibilityElement)extElement).getElement();
+ bindingStyle = getOptionalAttribute(domElement, "style");
+ }
+ }
+ destWsdl.addBinding(destBinding);
+ processBindingOperations(destBinding, srcBinding, bindingStyle);
+ }
+ }
+
+ private Map<QName, Binding> getPortTypeBindings(Definition srcWsdl)
+ {
+ getAllDefinedBindings(srcWsdl);
+ return portTypeBindings;
+ }
+
+ private Map<QName, Binding> getAllDefinedBindings(Definition srcWsdl)
+ {
+ if (allBindings != null)
+ return allBindings;
+
+ allBindings = new LinkedHashMap<QName, Binding>();
+ portTypeBindings = new LinkedHashMap<QName, Binding>();
+ Map srcBindings = srcWsdl.getBindings();
+ Iterator itBinding = srcBindings.values().iterator();
+ while (itBinding.hasNext())
+ {
+ Binding srcBinding = (Binding)itBinding.next();
+ allBindings.put(srcBinding.getQName(), srcBinding);
+ portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
+ }
+
+ // Bindings not available when pulled in through <wsdl:import>
+ //
http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&...
+ Iterator itService = srcWsdl.getServices().values().iterator();
+ while (itService.hasNext())
+ {
+ Service srcService = (Service)itService.next();
+ Iterator itPort = srcService.getPorts().values().iterator();
+ while (itPort.hasNext())
+ {
+ Port srcPort = (Port)itPort.next();
+ Binding srcBinding = srcPort.getBinding();
+ allBindings.put(srcBinding.getQName(), srcBinding);
+ portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
+ }
+ }
+
+ return allBindings;
+ }
+
+ private void processBindingOperations(WSDLBinding destBinding, Binding srcBinding,
String bindingStyle)
+ {
+ Iterator it = srcBinding.getBindingOperations().iterator();
+ while (it.hasNext())
+ {
+ BindingOperation srcBindingOperation = (BindingOperation)it.next();
+ processBindingOperation(destBinding, bindingStyle, srcBindingOperation);
+ }
+ }
+
+ private void processBindingOperation(WSDLBinding destBinding, String bindingStyle,
BindingOperation srcBindingOperation)
+ {
+ String srcBindingName = srcBindingOperation.getName();
+ log.trace("processBindingOperation: " + srcBindingName);
+
+ WSDLInterface destInterface = destBinding.getInterface();
+ String namespaceURI = destInterface.getQName().getNamespaceURI();
+
+ WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding);
+ QName refQName = new QName(namespaceURI, srcBindingName);
+ destBindingOperation.setRef(refQName);
+ destBinding.addOperation(destBindingOperation);
+
+ String opName = srcBindingName;
+ WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(new
NCName(opName));
+
+ // Process soap:operation@soapAction, soap:operation@style
+ List<ExtensibilityElement> extList =
srcBindingOperation.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPOperation)
+ {
+ SOAPOperation soapOp = (SOAPOperation)extElement;
+ destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
+ }
+ else if (SOAP12_OPERATION.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ destBindingOperation.setSOAPAction(getOptionalAttribute(domElement,
"soapAction"));
+ }
+ }
+
+ BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
+ if (srcBindingInput != null)
+ {
+ processBindingInput(destBindingOperation, destIntfOperation,
srcBindingOperation, srcBindingInput);
+ }
+
+ BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
+ if (srcBindingOutput != null)
+ {
+ processBindingOutput(destBindingOperation, destIntfOperation,
srcBindingOperation, srcBindingOutput);
+ }
+ }
+
+ interface ReferenceCallback
+ {
+ void removeReference(QName element);
+ void removeRPCPart(String partName);
+ QName getXmlType(String partName);
+ }
+
+ private void processBindingInput(WSDLBindingOperation destBindingOperation, final
WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation,
BindingInput srcBindingInput)
+ {
+ log.trace("processBindingInput");
+
+ QName soap11Body = new QName(Constants.NS_SOAP11, "body");
+ List<ExtensibilityElement> extList =
srcBindingInput.getExtensibilityElements();
+ WSDLBindingOperationInput input = new
WSDLBindingOperationInput(destBindingOperation);
+ destBindingOperation.addInput(input);
+
+ ReferenceCallback cb = new ReferenceCallback()
+ {
+ public QName getXmlType(String partName)
+ {
+ return
srcBindingOperation.getOperation().getInput().getMessage().getPart(partName).getTypeName();
+ }
+
+ public void removeReference(QName element)
+ {
+ WSDLInterfaceOperationInput destIntfInput =
destIntfOperation.getInput(element);
+ if (destIntfInput == null)
+ destIntfOperation.removeInput(element);
+ }
+
+ public void removeRPCPart(String partName)
+ {
+ WSDLInterfaceOperationInput operationInput =
destIntfOperation.getInput(destIntfOperation.getQName());
+ operationInput.removeChildPart(partName);
+ }
+ };
+
+ processBindingReference(destBindingOperation, destIntfOperation, soap11Body,
extList, input, cb);
+ }
+
+ private void processBindingOutput(WSDLBindingOperation destBindingOperation, final
WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation,
BindingOutput srcBindingOutput)
+ {
+ log.trace("processBindingInput");
+
+ QName soap11Body = new QName(Constants.NS_SOAP11, "body");
+ List<ExtensibilityElement> extList =
srcBindingOutput.getExtensibilityElements();
+ WSDLBindingOperationOutput output = new
WSDLBindingOperationOutput(destBindingOperation);
+ destBindingOperation.addOutput(output);
+
+ ReferenceCallback cb = new ReferenceCallback()
+ {
+ public QName getXmlType(String partName)
+ {
+ return
srcBindingOperation.getOperation().getOutput().getMessage().getPart(partName).getTypeName();
+ }
+
+ public void removeReference(QName element)
+ {
+ WSDLInterfaceOperationOutput destIntfOutput =
destIntfOperation.getOutput(element);
+ if (destIntfOutput == null)
+ destIntfOperation.removeInput(element);
+ }
+
+ public void removeRPCPart(String partName)
+ {
+ QName name = destIntfOperation.getQName();
+ WSDLInterfaceOperationOutput operationOutput =
destIntfOperation.getOutput(new QName(name.getNamespaceURI(), name.getLocalPart() +
"Response"));
+ operationOutput.removeChildPart(partName);
+ }
+ };
+
+ processBindingReference(destBindingOperation, destIntfOperation, soap11Body,
extList, output, cb);
+ }
+
+
+ private void processBindingReference(WSDLBindingOperation destBindingOperation,
WSDLInterfaceOperation destIntfOperation,
+ QName soap11Body, List<ExtensibilityElement> extList,
WSDLBindingMessageReference reference, ReferenceCallback callback)
+ {
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
+ {
+ processEncodingStyle(extElement, destBindingOperation);
+ }
+ else if (extElement instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader)extElement;
+ QName messageQName = header.getMessage();
+ String partName = header.getPart();
+
+ String key = messageQName + "->" + partName;
+ QName elementName = (QName)messagePartToElementMap.get(key);
+ if (elementName == null)
+ throw new WSException("Could not determine element name from header:
" + partName);
+
+ reference.addSoapHeader(new WSDLSOAPHeader(elementName, partName));
+ if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
+ {
+ callback.removeReference(elementName);
+ }
+ else
+ {
+ // Just in case
+ callback.removeRPCPart(partName);
+ }
+ }
+ else if (extElement instanceof MIMEMultipartRelated)
+ {
+ MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
+ Iterator i = related.getMIMEParts().iterator();
+ while (i.hasNext())
+ {
+ MIMEPart part = (MIMEPart)i.next();
+ Iterator j = part.getExtensibilityElements().iterator();
+ String name = null;
+ String types = null;
+
+ while (j.hasNext())
+ {
+ ExtensibilityElement inner = (ExtensibilityElement)j.next();
+ if (inner instanceof MIMEContent)
+ {
+ MIMEContent content = (MIMEContent)inner;
+ name = content.getPart();
+ if (types == null)
+ {
+ types = content.getType();
+ }
+ else
+ {
+ types += "," + content.getType();
+ }
+ }
+ }
+
+ // Found content types in this part
+ if (name != null)
+ {
+ QName xmlType = callback.getXmlType(name);
+ reference.addMimePart(new WSDLMIMEPart(name, xmlType, types));
+ if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
+ {
+ // A mime part must be defined as <part type="">
+ callback.removeReference(new QName(name));
+ }
+ else
+ {
+ callback.removeRPCPart(name);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ private void processEncodingStyle(ExtensibilityElement extElement,
WSDLBindingOperation destBindingOperation)
+ {
+ log.trace("processEncodingStyle");
+
+ String encStyle = null;
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBody)
+ {
+ SOAPBody body = (SOAPBody)extElement;
+ List encStyleList = body.getEncodingStyles();
+ if (encStyleList != null)
+ {
+ if (encStyleList.size() > 1)
+ log.warn("Multiple encoding styles not supported: " +
encStyleList);
+
+ if (encStyleList.size() > 0)
+ {
+ encStyle = (String)encStyleList.get(0);
+ }
+ }
+ }
+ else if (SOAP12_BODY.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ encStyle = getOptionalAttribute(domElement, "encodingStyle");
+ }
+
+ if (encStyle != null)
+ {
+ String setStyle = destBindingOperation.getEncodingStyle();
+ if (encStyle.equals(setStyle) == false)
+ log.warn("Encoding style '" + encStyle + "' not
supported for: " + destBindingOperation.getRef());
+
+ destBindingOperation.setEncodingStyle(encStyle);
+ }
+ }
+
+ private void processServices(Definition srcWsdl)
+ {
+ log.trace("BEGIN processServices: " + srcWsdl.getDocumentBaseURI());
+
+ // Each definition needs a clear binding cache
+ allBindings = null;
+
+ if (srcWsdl.getServices().size() > 0)
+ {
+ Iterator it = srcWsdl.getServices().values().iterator();
+ while (it.hasNext())
+ {
+ Service srcService = (Service)it.next();
+ QName qname = srcService.getQName();
+ WSDLService destService = new WSDLService(destWsdl);
+ destService.setName(new NCName(qname));
+ destService.setQName(qname);
+ destWsdl.addService(destService);
+ processPorts(srcWsdl, destService, srcService);
+ }
+ }
+ else
+ {
+ log.trace("Empty wsdl services, processing imports");
+ Iterator it = srcWsdl.getImports().values().iterator();
+ while (it.hasNext())
+ {
+ List<Import> srcImports = (List<Import>)it.next();
+ for (Import srcImport : srcImports)
+ {
+ Definition importDefinition = srcImport.getDefinition();
+ processServices(importDefinition);
+ }
+ }
+
+ // The binding cache must be clear after imports, so that undefined bindings can
be located
+ allBindings = null;
+ }
+
+ log.trace("END processServices: " + srcWsdl.getDocumentBaseURI());
+ }
+
+ private void processPorts(Definition srcWsdl, WSDLService destService, Service
srcService)
+ {
+ Iterator it = srcService.getPorts().values().iterator();
+ while (it.hasNext())
+ {
+ Port srcPort = (Port)it.next();
+ processPort(srcWsdl, destService, srcPort);
+ }
+ }
+
+ private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort)
+ {
+ log.trace("processPort: " + srcPort.getName());
+
+ Binding srcBinding = srcPort.getBinding();
+
+ WSDLEndpoint destEndpoint = new WSDLEndpoint(destService);
+ destEndpoint.setName(new NCName(srcPort.getName()));
+ destEndpoint.setBinding(srcBinding.getQName());
+ destEndpoint.setQName(new QName(srcWsdl.getTargetNamespace(), srcPort.getName()));
+ destEndpoint.setAddress(getSOAPAddress(srcPort));
+ destService.addEndpoint(destEndpoint);
+
+ processBinding(srcWsdl, srcBinding);
+ }
+
+ /** Get the endpoint address from the ports extensible element
+ */
+ private String getSOAPAddress(Port srcPort)
+ {
+ String soapAddress = "dummy";
+
+ Iterator it = srcPort.getExtensibilityElements().iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement extElement = (ExtensibilityElement)it.next();
+ QName elementType = extElement.getElementType();
+
+ if (extElement instanceof SOAPAddress)
+ {
+ SOAPAddress addr = (SOAPAddress)extElement;
+ soapAddress = addr.getLocationURI();
+ break;
+ }
+ else if (SOAP12_ADDRESS.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ soapAddress = getOptionalAttribute(domElement, "location");
+ break;
+ }
+ else if ("address".equals(elementType.getLocalPart()))
+ {
+ log.warn("Unprocessed extension element: " + elementType);
+ }
+ }
+
+ if (soapAddress == null)
+ throw new WSException("Cannot obtain SOAP address");
+
+ return soapAddress;
+ }
+
+ private String getOptionalAttribute(Element domElement, String attrName)
+ {
+ String attrValue = domElement.getAttribute(attrName);
+ return (attrValue.length() > 0 ? attrValue : null);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
(from rev 1572,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Writer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDL11Writer.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,538 @@
+/*
+* 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 java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.common.metadata.wsdl.NCName;
+import org.jboss.ws.common.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingMessageReference;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.common.metadata.wsdl.WSDLImport;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceMessageReference;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCPart;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem;
+import org.jboss.ws.common.metadata.wsdl.WSDLSOAPHeader;
+import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * A WSDL Writer that writes a WSDL 1.1 file. It works off
+ * of the WSDL20 Object Graph.
+ * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
+ */
+public class WSDL11Writer extends WSDLWriter
+{
+ //Used Internally
+ private String wsdlStyle = Constants.RPC_LITERAL;
+
+ // Used to prevent duplicates
+ private HashSet<String> writtenFaultMessages = new HashSet<String>();
+
+ /** Use WSDLDefinitions.writeWSDL instead. */
+ public WSDL11Writer(WSDLDefinitions wsdl)
+ {
+ super(wsdl);
+ }
+
+ public void write(Writer writer) throws IOException
+ {
+ write(writer, null);
+ }
+
+
+ public void write(Writer writer, String charset) throws IOException
+ {
+ write(writer, charset, null);
+ }
+
+ public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws
IOException
+ {
+ // Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader)
+ if (wsdl.getWsdlOneOneDefinition() != null)
+ {
+ Definition wsdlDefinition = wsdl.getWsdlOneOneDefinition();
+ try
+ {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
+ wsdlWriter.writeWSDL(wsdlDefinition, writer);
+ }
+ catch (WSDLException e)
+ {
+ this.logException(e);
+ throw new IOException(e.toString());
+ }
+ }
+ else
+ {
+ StringBuilder buffer = new StringBuilder();
+
+ //Detect the WSDL Style early
+ wsdlStyle = utils.getWSDLStyle(wsdl);
+
+ StringBuilder importBuffer = new StringBuilder();
+ for (WSDLImport wsdlImport : wsdl.getImports())
+ {
+ if (resolver == null)
+ continue;
+
+ WSDLWriterResolver resolved = resolver.resolve(wsdlImport.getLocation());
+ if (resolved == null)
+ continue;
+
+ String namespace = wsdlImport.getNamespace();
+ importBuffer.append("<import namespace='" + namespace +
"' location='" + resolved.actualFile + "'/>");
+ if (resolved != null)
+ {
+ StringBuilder builder = new StringBuilder();
+
+ appendDefinitions(builder, namespace);
+ appendBody(builder, namespace);
+ writeBuilder(builder, resolved.writer, resolved.charset);
+ resolved.writer.close();
+ }
+ }
+
+ appendDefinitions(buffer, wsdl.getTargetNamespace());
+ if (importBuffer.length() > 0)
+ buffer.append(importBuffer);
+
+ appendBody(buffer, wsdl.getTargetNamespace());
+ writeBuilder(buffer, writer, charset);
+ }
+ }
+
+ private void writeBuilder(StringBuilder builder, Writer writer, String charset) throws
IOException
+ {
+ Element element = DOMUtils.parse(builder.toString());
+
+ if (charset != null)
+ writer.write("<?xml version=\"1.0\" encoding=\"" +
charset + "\"?>\n");
+ new DOMWriter(writer).setPrettyprint(true).print(element);
+ }
+
+ protected void appendBody(StringBuilder builder, String namespace)
+ {
+ writtenFaultMessages.clear();
+
+ appendTypes(builder, namespace);
+ appendMessages(builder, namespace);
+ appendInterfaces(builder, namespace);
+ appendBindings(builder, namespace);
+ appendServices(builder, namespace);
+ builder.append("</definitions>");
+ }
+
+ protected void appendMessages(StringBuilder buffer, String namespace)
+ {
+ WSDLInterface[] interfaces = wsdl.getInterfaces();
+ int len = interfaces != null ? interfaces.length : 0;
+ for (int i = 0; i < len; i++)
+ {
+ WSDLInterface intf = interfaces[i];
+ if (! namespace.equals(intf.getQName().getNamespaceURI()))
+ continue;
+
+ WSDLInterfaceOperation[] operations = intf.getSortedOperations();
+ int lenOps = operations.length;
+ for (int j = 0; j < lenOps; j++)
+ {
+ appendMessage(buffer, operations[j]);
+ appendMessagesForExceptions(buffer, operations[j]);
+ }
+ }
+ }
+
+ private void appendMessage(StringBuilder buffer, WSDLInterfaceOperation operation)
+ {
+ String opname = operation.getName().toString();
+ //Determine the style of the wsdl
+ if (Constants.URI_STYLE_RPC.equals(operation.getStyle()) == false)
+ wsdlStyle = Constants.DOCUMENT_LITERAL; //Not RPC/Literal
+
+ String interfaceName = operation.getWsdlInterface().getName().toString();
+ buffer.append("<message name='" + interfaceName + "_" +
opname + "' >");
+ for (WSDLInterfaceOperationInput input : operation.getInputs())
+ appendMessageParts(buffer, input);
+ buffer.append("</message>");
+
+ if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
+ {
+ buffer.append("<message name='" + interfaceName + "_"
+ opname + "Response' >");
+ WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
+ for (WSDLInterfaceOperationOutput output : outputs)
+ appendMessageParts(buffer, output);
+ buffer.append("</message>");
+ }
+ }
+
+ private void appendMessagesForExceptions(StringBuilder buffer, WSDLInterfaceOperation
operation)
+ {
+ //Get the outfaults
+ WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
+ int len = faults != null ? faults.length : 0;
+
+ for (int i = 0; i < len; i++)
+ {
+ WSDLInterfaceOperationOutfault fault = faults[i];
+ String exceptionName = fault.getRef().getLocalPart();
+ if (writtenFaultMessages.contains(exceptionName))
+ continue;
+
+ WSDLInterfaceFault interfaceFault = operation.getWsdlInterface().getFault(new
NCName(exceptionName));
+ QName xmlName = interfaceFault.getElement();
+
+ buffer.append("<message name='" + exceptionName + "'
>");
+ String prefix = wsdl.getPrefix(xmlName.getNamespaceURI());
+ String xmlNameStr = prefix + ":" + xmlName.getLocalPart();
+ buffer.append("<part name='" + exceptionName + "'
element='" + xmlNameStr + "' />");
+ buffer.append("</message>");
+
+ writtenFaultMessages.add(exceptionName);
+ }
+ }
+
+ private String getReferenceString(QName name)
+ {
+ String namespaceURI = name.getNamespaceURI();
+ String prefix = wsdl.getPrefix(namespaceURI);
+ if (prefix == null)
+ throw new WSException("Prefix not bound for namespace: " +
namespaceURI);
+
+ return prefix + ":" + name.getLocalPart();
+ }
+
+ private void appendMessageParts(StringBuilder buffer, WSDLInterfaceMessageReference
reference)
+ {
+ if (wsdlStyle.equals(Constants.RPC_LITERAL))
+ {
+ for (WSDLRPCPart part : reference.getChildParts())
+ {
+ buffer.append("<part name='" +
part.getName()).append('\'');
+ buffer.append(" type='" + getReferenceString(part.getType()) +
"'/>");
+ }
+ }
+ else
+ {
+ QName element = reference.getElement();
+ // Null represents empty message
+ if (element != null)
+ {
+ buffer.append("<part name='" + reference.getPartName() +
'\'');
+ buffer.append(" element='" + getReferenceString(element) +
"'/>");
+ }
+ }
+
+ WSDLBindingMessageReference bindingReference = getBindingReference(reference);
+ if (bindingReference == null)
+ return;
+
+ for (WSDLSOAPHeader header : bindingReference.getSoapHeaders())
+ {
+ if (header.isIncludeInSignature());
+ {
+ QName element = header.getElement();
+ buffer.append("<part name='" + header.getPartName() +
'\'');
+ buffer.append(" element='" + getReferenceString(element) +
"'/>");
+ }
+ }
+ }
+
+ private WSDLBindingMessageReference getBindingReference(WSDLInterfaceMessageReference
reference)
+ {
+ WSDLInterfaceOperation operation = reference.getWsdlOperation();
+ WSDLInterface wsdlInterface = operation.getWsdlInterface();
+ WSDLBinding binding =
wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getQName());
+ WSDLBindingOperation bindingOperation =
binding.getOperationByRef(operation.getQName());
+ WSDLBindingMessageReference[] bindingReferences;
+
+ if (reference instanceof WSDLInterfaceOperationInput)
+ bindingReferences = bindingOperation.getInputs();
+ else
+ bindingReferences = bindingOperation.getOutputs();
+
+ if (bindingReferences.length > 1)
+ throw new IllegalArgumentException("WSDl 1.1 only supports In-Only, and
In-Out MEPS, more than reference input found");
+
+ if (bindingReferences.length == 1)
+ return bindingReferences[0];
+
+ return null;
+ }
+
+ protected void appendInterfaces(StringBuilder buffer, String namespace)
+ {
+ WSDLInterface[] intfs = wsdl.getInterfaces();
+ for (int i = 0; i < intfs.length; i++)
+ {
+ WSDLInterface intf = intfs[i];
+ if (!namespace.equals(intf.getQName().getNamespaceURI()))
+ continue;
+
+ buffer.append("<portType name='" + intf.getName() +
"'>");
+ appendPortOperations(buffer, intf);
+ buffer.append("</portType>");
+ }
+ }
+
+ private String getParameterOrder(WSDLInterfaceOperation operation)
+ {
+ StringBuilder builder = new StringBuilder();
+ for (WSDLRPCSignatureItem item : operation.getRpcSignatureItems())
+ {
+ if (item.getDirection() != Direction.RETURN)
+ {
+ if (builder.length() > 0)
+ builder.append(' ');
+ builder.append(item.getName());
+ }
+ }
+
+ return builder.toString();
+ }
+
+ protected void appendPortOperations(StringBuilder buffer, WSDLInterface intf)
+ {
+ String prefix = wsdl.getPrefix(intf.getQName().getNamespaceURI());
+ WSDLInterfaceOperation[] operations = intf.getSortedOperations();
+ for (int i = 0; i < operations.length; i++)
+ {
+ WSDLInterfaceOperation operation = operations[i];
+ buffer.append("<operation name='" +
operation.getName().toString() + "'");
+
+ String parameterOrder = getParameterOrder(operation);
+ if (parameterOrder.length() > 0)
+ buffer.append("
parameterOrder='").append(parameterOrder).append("'");
+ buffer.append(">");
+
+ String opname = operation.getName().toString();
+ String interfaceName = operation.getWsdlInterface().getName().toString();
+ String msgEl = prefix + ":" + interfaceName + "_" + opname;
+
+ buffer.append("<input message='" + msgEl +
"'>").append("</input>");
+
+ if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
+ {
+ buffer.append("<output message='" + msgEl +
"Response'>");
+ buffer.append("</output>");
+ }
+
+ //Append the Faults
+ for (WSDLInterfaceOperationOutfault fault : operation.getOutfaults())
+ {
+ QName element = fault.getRef();
+ buffer.append("<fault message='" +
utils.getFormattedString(element));
+ buffer.append("' name='" + element.getLocalPart() +
"'/>");
+ }
+
+ buffer.append("</operation>");
+ }
+ }
+
+ protected void appendBindings(StringBuilder buffer, String namespace)
+ {
+ WSDLBinding[] bindings = wsdl.getBindings();
+ for (int i = 0; i < bindings.length; i++)
+ {
+ WSDLBinding binding = bindings[i];
+ if (!namespace.equals(binding.getQName().getNamespaceURI()))
+ continue;
+ buffer.append("<binding name='" + binding.getName() +
"' type='" + getQNameRef(binding.getInterfaceName()) +
"'>");
+ //TODO:Need to derive the WSDLStyle from the Style attribute of
InterfaceOperation
+ if (wsdlStyle == null)
+ throw new IllegalArgumentException("WSDL Style is null (should be rpc or
document");
+ String style = "rpc";
+ if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
+ style = "document";
+ buffer.append("<" + soapPrefix + ":binding
transport='http://schemas.xmlsoap.org/soap/http' style='" + style +
"'/>");
+ appendBindingOperations(buffer, binding);
+ buffer.append("</binding>");
+ }
+ }
+
+ protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
+ {
+ WSDLBindingOperation[] operations = binding.getOperations();
+ Arrays.sort(operations);
+
+ for (int i = 0; i < operations.length; i++)
+ {
+ WSDLBindingOperation operation = operations[i];
+ String interfaceName =
operation.getWsdlBinding().getInterfaceName().getLocalPart();
+
+ WSDLInterface wsdlInterface = wsdl.getInterface(new NCName(interfaceName));
+ if (wsdlInterface == null)
+ throw new WSException("WSDL Interface should not be null");
+ WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
+
+ buffer.append("<operation name='" +
interfaceOperation.getName() + "'>");
+ String soapAction = (operation.getSOAPAction() != null ?
operation.getSOAPAction() : "");
+ buffer.append("<" + soapPrefix + ":operation
soapAction=\"" + soapAction + "\"/>");
+
+ WSDLBindingOperationInput[] inputs = operation.getInputs();
+ if (inputs.length != 1)
+ throw new WSException("WSDl 1.1 only supports In-Only, and In-Out
MEPS.");
+
+ buffer.append("<input>");
+ appendSOAPBinding(buffer, wsdlInterface, operation, inputs);
+ buffer.append("</input>");
+
+ if (!
Constants.WSDL20_PATTERN_IN_ONLY.equals(getBindingOperationPattern(operation)))
+ {
+ buffer.append("<output>");
+ WSDLBindingOperationOutput[] outputs = operation.getOutputs();
+ appendSOAPBinding(buffer, wsdlInterface, operation, outputs);
+ buffer.append("</output>");
+ }
+
+ //Append faults
+ WSDLInterfaceOperationOutfault[] faults = interfaceOperation.getOutfaults();
+ if (faults != null)
+ {
+ for (WSDLInterfaceOperationOutfault fault : faults)
+ {
+ String n = "name='" + fault.getRef().getLocalPart() +
"'";
+ buffer.append("<fault " + n + ">");
+ buffer.append("<" + soapPrefix + ":fault " + n +
" use='literal' />");
+ buffer.append("</fault>");
+ }
+ buffer.append("</operation>");
+ }
+ }
+ }
+
+ private void appendSOAPBinding(StringBuilder buffer, WSDLInterface wsdlInterface,
WSDLBindingOperation operation, WSDLBindingMessageReference[] inputs)
+ {
+ String tns = wsdl.getTargetNamespace();
+ WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
+ WSDLInterfaceMessageReference reference = (inputs instanceof
WSDLBindingOperationInput[]) ? interfaceOperation.getInputs()[0]
+ : interfaceOperation.getOutputs()[0];
+
+ StringBuilder bodyParts = new StringBuilder();
+ if (Constants.DOCUMENT_LITERAL == wsdlStyle)
+ {
+ bodyParts.append(reference.getPartName());
+ }
+ else
+ {
+ for (WSDLRPCPart part : reference.getChildParts())
+ {
+ if (bodyParts.length() > 0)
+ bodyParts.append(" ");
+ bodyParts.append(part.getName());
+ }
+ }
+
+ StringBuilder soapHeader = new StringBuilder();
+ for (WSDLSOAPHeader header : inputs[0].getSoapHeaders())
+ {
+ if (header.isIncludeInSignature())
+ {
+ String messageName = wsdlInterface.getName() + "_" +
operation.getRef().getLocalPart();
+ if (reference instanceof WSDLInterfaceOperationOutput)
+ messageName += "Response";
+ soapHeader.append("<").append(soapPrefix).append(":header
use='literal' message='tns:").append(messageName);
+ soapHeader.append("'
part='").append(header.getElement().getLocalPart()).append("'/>");
+ }
+ }
+
+ buffer.append("<" + soapPrefix + ":body
use='literal'");
+ if (wsdlStyle != Constants.DOCUMENT_LITERAL)
+ buffer.append(" namespace='" + tns + "'");
+ if (soapHeader.length() > 0)
+ {
+ buffer.append("
parts='").append(bodyParts).append("'/>");
+ buffer.append(soapHeader);
+ }
+ else
+ {
+ buffer.append("/>");
+ }
+ }
+
+ private String getBindingOperationPattern(WSDLBindingOperation operation)
+ {
+ WSDLBinding binding = operation.getWsdlBinding();
+ String pattern = binding.getInterface().getOperation(new
NCName(operation.getRef().getLocalPart())).getPattern();
+
+ return pattern;
+ }
+
+ protected void appendServices(StringBuilder buffer, String namespace)
+ {
+ WSDLService[] services = wsdl.getServices();
+ int len = services.length;
+ for (int i = 0; i < len; i++)
+ {
+
+ WSDLService service = services[i];
+ if (!namespace.equals(service.getQName().getNamespaceURI()))
+ continue;
+ buffer.append("<service name='" + service.getName() +
"'>");
+ WSDLEndpoint[] endpoints = service.getEndpoints();
+ int lenend = endpoints.length;
+ for (int j = 0; j < lenend; j++)
+ {
+ WSDLEndpoint endpoint = endpoints[j];
+ appendServicePort(buffer, endpoint);
+ }
+
+ buffer.append("</service>");
+ }
+ }
+
+ protected void appendServicePort(StringBuilder buffer, WSDLEndpoint endpoint)
+ {
+ String name = endpoint.getName().toString();
+ QName endpointBinding = endpoint.getBinding();
+ String prefix = endpointBinding.getPrefix();
+ prefix = wsdl.getPrefix(endpointBinding.getNamespaceURI());
+ String ebname = prefix + ":" + endpointBinding.getLocalPart();
+ buffer.append("<port name='" + name + "'
binding='" + ebname + "'>");
+ buffer.append("<" + soapPrefix + ":address location='" +
endpoint.getAddress() + "'/>");
+ buffer.append("</port>");
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
(from rev 1572,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitionsFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLDefinitionsFactory.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,196 @@
+/*
+* 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;
+
+// $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.common.Constants;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLException;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.JBossWSEntityResolver;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.EntityResolver;
+
+import com.ibm.wsdl.xml.WSDLReaderImpl;
+
+/**
+ * A factory that creates a <code>WSDLDefinitions</code> object from an URL.
+ *
+ * This implementations deals with different WSDL versions so that clients of this
+ * factory do need to know about WSDL version specifics. The Java object view of the
+ * WSDL document (WSDLDefinitions) is modeled on WSDL-2.0
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-Oct-2004
+ */
+public class WSDLDefinitionsFactory
+{
+ // 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";
+
+ // The WSDL reader features
+ private Map features = new HashMap();
+
+ // Hide constructor
+ private 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));
+ }
+
+ /**
+ * 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");
+
+ 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);
+
+ // 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());
+ }
+
+ // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
+ ((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())
+ {
+ 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;
+ }
+
+ /** Get the WSDL document.
+ */
+ private Document getDocument(URL wsdlLocation) throws WSDLException
+ {
+ try
+ {
+ InputStream wsdlInputStream = wsdlLocation.openStream();
+ try
+ {
+ DocumentBuilder builder = DOMUtils.getDocumentBuilder();
+ return builder.parse(wsdlInputStream);
+ }
+ finally
+ {
+ wsdlInputStream.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;
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java
(from rev 1572,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLLocatorImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLLocatorImpl.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,159 @@
+/*
+ * 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;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.wsdl.xml.WSDLLocator;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.WSException;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+/* A WSDLLocator that can handle wsdl imports
+ */
+class WSDLLocatorImpl implements WSDLLocator
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
+
+ private EntityResolver entityResolver;
+ private URL wsdlURL;
+ private String latestImportURI;
+
+ public WSDLLocatorImpl(EntityResolver entityResolver, URL wsdlFile)
+ {
+ if (wsdlFile == null)
+ throw new IllegalArgumentException("WSDL file argument cannot be
null");
+
+ this.entityResolver = entityResolver;
+ this.wsdlURL = wsdlFile;
+ }
+
+ public InputSource getBaseInputSource()
+ {
+ log.trace("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
+ try
+ {
+ InputStream is = wsdlURL.openStream();
+ if (is == null)
+ throw new IllegalArgumentException("Cannot obtain wsdl from [" +
wsdlURL + "]");
+
+ return new InputSource(is);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Cannot access wsdl from [" + wsdlURL +
"], " + e.getMessage());
+ }
+ }
+
+ public String getBaseURI()
+ {
+ return wsdlURL.toExternalForm();
+ }
+
+ public InputSource getImportInputSource(String parent, String resource)
+ {
+ log.trace("getImportInputSource [parent=" + parent +
",resource=" + resource + "]");
+
+ URL parentURL = null;
+ try
+ {
+ parentURL = new URL(parent);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Not a valid URL: " + parent);
+ return null;
+ }
+
+ String wsdlImport = null;
+ String external = parentURL.toExternalForm();
+
+ // An external URL
+ if (resource.startsWith("http://") ||
resource.startsWith("https://"))
+ {
+ wsdlImport = resource;
+ }
+
+ // Absolute path
+ else if (resource.startsWith("/"))
+ {
+ String beforePath = external.substring(0,
external.indexOf(parentURL.getPath()));
+ wsdlImport = beforePath + resource;
+ }
+
+ // A relative path
+ else
+ {
+ String parentDir = external.substring(0, external.lastIndexOf("/"));
+
+ // remove references to current dir
+ while (resource.startsWith("./"))
+ resource = resource.substring(2);
+
+ // remove references to parentdir
+ while (resource.startsWith("../"))
+ {
+ parentDir = parentDir.substring(0, parentDir.lastIndexOf("/"));
+ resource = resource.substring(3);
+ }
+
+ wsdlImport = parentDir + "/" + resource;
+ }
+
+ try
+ {
+ log.trace("Trying to resolve: " + wsdlImport);
+ InputSource inputSource = entityResolver.resolveEntity(wsdlImport, wsdlImport);
+ if (inputSource != null)
+ {
+ latestImportURI = wsdlImport;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot resolve imported resource:
" + wsdlImport);
+ }
+
+ return inputSource;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot access imported wsdl [" + wsdlImport +
"], " + e.getMessage());
+ }
+ }
+
+ public String getLatestImportURI()
+ {
+ return latestImportURI;
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java
(from rev 1572,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLWriter.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/metadata/wsdl/WSDLWriter.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -0,0 +1,228 @@
+/*
+ * 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;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.common.metadata.wsdl.DOMTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.common.metadata.wsdl.XSModelTypes;
+import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * A helper that writes out a WSDL definition
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Anil.Saldhana(a)jboss.org
+ * @since 10-Oct-2004
+ */
+public class WSDLWriter
+{
+ // provide logging
+ protected static final Logger log = Logger.getLogger(WSDLWriter.class);
+
+ protected WSDLDefinitions wsdl;
+ protected WSDLUtils utils = WSDLUtils.getInstance();
+
+ // The soap prefix
+ protected String soapPrefix = "soap";
+
+ /**
+ * Include or import WSDL Types
+ */
+ protected boolean includeSchemaInWSDL = true;
+
+ /** Use WSDLDefinitions.writeWSDL instead. */
+ public WSDLWriter(WSDLDefinitions wsdl)
+ {
+ if (wsdl == null)
+ throw new IllegalArgumentException("WSDL definitions is NULL");
+
+ this.wsdl = wsdl;
+ }
+
+ /** Write the wsdl definition to the given writer, clients should not care about the
wsdl version. */
+ public void write(Writer writer, String charset) throws IOException
+ {
+ write(writer, charset, null);
+ }
+
+ public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws
IOException
+ {
+ String wsdlNamespace = wsdl.getWsdlNamespace();
+ if (Constants.NS_WSDL11.equals(wsdlNamespace))
+ {
+ WSDL11Writer wsdl11Writer = new WSDL11Writer(wsdl);
+ wsdl11Writer.write(writer, charset, resolver);
+ }
+ else
+ {
+ throw new WSException("Unsupported wsdl version: " + wsdlNamespace);
+ }
+ }
+
+ public void write(Writer writer) throws IOException
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(Constants.XML_HEADER);
+
+ appendDefinitions(buffer, wsdl.getTargetNamespace());
+ appendTypes(buffer, wsdl.getTargetNamespace());
+ appendInterfaces(buffer, wsdl.getTargetNamespace());
+ appendBindings(buffer, wsdl.getTargetNamespace());
+ appendServices(buffer, wsdl.getTargetNamespace());
+
+ buffer.append("</definitions>");
+
+ Element element = DOMUtils.parse(buffer.toString());
+ new DOMWriter(writer).setPrettyprint(true).print(element);
+ }
+
+ protected void appendDefinitions(StringBuilder buffer, String namespace)
+ {
+ buffer.append("<definitions");
+ //Append service name as done by wscompile, if there is just one
+ WSDLService[] services = wsdl.getServices();
+ if (services != null && services.length == 1)
+ {
+ WSDLService ser = services[0];
+ buffer.append(" name='" + ser.getName() + "'");
+ }
+ buffer.append(" targetNamespace='" + namespace + "'");
+ buffer.append(" xmlns='" + wsdl.getWsdlNamespace() +
"'");
+
+ Iterator it = wsdl.getRegisteredNamespaceURIs();
+ while (it.hasNext())
+ {
+ String namespaceURI = (String)it.next();
+ String prefix = wsdl.getPrefix(namespaceURI);
+ if (prefix.length() > 0)
+ {
+ buffer.append(" xmlns:" + prefix + "='" +
namespaceURI + "'");
+ if (Constants.PREFIX_SOAP11.equals(prefix) ||
Constants.PREFIX_SOAP12.equals(prefix))
+ soapPrefix = prefix;
+ }
+ }
+ buffer.append(">");
+ }
+
+ protected void appendTypes(StringBuilder buffer, String namespace)
+ {
+ WSDLTypes wsdlTypes = wsdl.getWsdlTypes();
+ // If the type section is bound to a particular namespace, verify it mataches,
otherwise skip
+ if (wsdlTypes.getNamespace() != null &&
!wsdlTypes.getNamespace().equals(namespace))
+ return;
+
+ if (wsdlTypes instanceof XSModelTypes)
+ {
+ buffer.append("<types>");
+ JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdlTypes);
+ String schema = xsM.serialize();
+ buffer.append(schema);
+ buffer.append("</types>");
+ }
+ else if (wsdlTypes instanceof DOMTypes)
+ {
+ synchronized (wsdlTypes)
+ {
+ buffer.append(DOMWriter.printNode(((DOMTypes)wsdlTypes).getElement(),
true));
+ }
+ }
+ }
+
+ protected void appendInterfaces(StringBuilder buffer, String namespace)
+ {
+ }
+
+ protected void appendBindings(StringBuilder buffer, String namespace)
+ {
+ }
+
+ protected void appendServices(StringBuilder buffer, String namespace)
+ {
+ }
+
+ /** Get a prefixed name of form prefix:localPart */
+ protected String getQNameRef(QName qname)
+ {
+ String retStr = qname.getLocalPart();
+
+ String prefix = qname.getPrefix();
+ String nsURI = qname.getNamespaceURI();
+ if (prefix.length() == 0 && nsURI.length() > 0)
+ {
+ qname = wsdl.registerQName(qname);
+ prefix = qname.getPrefix();
+ }
+
+ if (prefix.length() > 0)
+ retStr = prefix + ":" + retStr;
+
+ return retStr;
+ }
+
+ public WSDLDefinitions getWsdl()
+ {
+ return wsdl;
+ }
+
+ public void setWsdl(WSDLDefinitions wsdl)
+ {
+ this.wsdl = wsdl;
+ }
+
+ public boolean isIncludeTypesInWSDL()
+ {
+ return includeSchemaInWSDL;
+ }
+
+ public void logException(Exception e)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace(e);
+ }
+ }
+
+ public void logMessage(String msg)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace(msg);
+ }
+ }
+}
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -44,12 +44,12 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.binding.EndpointInvocation;
-import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.CallImpl;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.UnboundHeader;
/**
* Test the SOAPBindingProvider
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -46,7 +46,7 @@
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.CallImpl;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -25,9 +25,9 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Tests WSDL11Reader ability to parse WSDL Files
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -25,9 +25,9 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the XSModel, and how it handles multiple schemas
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -31,7 +31,7 @@
import org.jboss.net.protocol.URLStreamHandlerFactory;
import org.jboss.test.ws.JBossWSTest;
-import org.jboss.ws.common.metadata.wsdl.WSDL11DefinitionFactory;
+import org.jboss.ws.tools.wsdl.WSDL11DefinitionFactory;
/**
* Test a wsdl import functionality.
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -29,7 +29,6 @@
import org.jboss.ws.common.Constants;
import org.jboss.ws.common.metadata.wsdl.NCName;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperation;
@@ -40,6 +39,7 @@
import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
import org.jboss.ws.extras.eventing.EventingConstants;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the unmarshalling of wsdl-1.1 into the unified wsdl structure
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -26,9 +26,9 @@
import org.apache.xerces.xs.XSTypeDefinition;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* The WSDL may contain or import XSD schema definitions.
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -25,7 +25,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Cannot handle xsd:import of xml schema
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -28,9 +28,9 @@
import org.jboss.ws.common.config.ServerConfig;
import org.jboss.ws.common.config.ServerConfigFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
*
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -26,7 +26,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* XML entity usage in wsdl contained schema
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -35,8 +35,8 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JAXRPC <service-ref>
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -34,8 +34,8 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JAXRPC <service-ref>
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -35,8 +35,8 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JAXRPC <service-ref>
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -44,7 +44,6 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.core.jaxrpc.ServiceExt;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
import org.jboss.ws.core.jaxrpc.StubExt;
@@ -59,6 +58,7 @@
import org.jboss.ws.extras.eventing.element.SubscribeRequest;
import org.jboss.ws.extras.eventing.element.SubscribeResponse;
import org.jboss.ws.extras.eventing.element.UnsubscribeRequest;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* @author Heiko Braun, <heiko(a)openj.net>
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -36,7 +36,6 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.extras.addressing.AddressingClientUtil;
import org.jboss.ws.extras.eventing.EventSourceEndpoint;
@@ -47,6 +46,7 @@
import org.jboss.ws.extras.eventing.element.FilterType;
import org.jboss.ws.extras.eventing.element.SubscribeRequest;
import org.jboss.ws.extras.eventing.element.SubscribeResponse;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Eventing test case support.
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -35,7 +35,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test JAXWS WebServiceContext
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -43,7 +43,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test JAXWS Endpoint deployment
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -30,9 +30,9 @@
import org.jboss.ws.common.config.ServerConfig;
import org.jboss.ws.common.config.ServerConfigFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
*
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -33,7 +33,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Investigate "Is Not A Servlet" error with multiple servlets in the web.xml
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -33,7 +33,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* EJB3 jmx name is incorrectly derrived
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -30,7 +30,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
// $Id$
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -48,7 +48,7 @@
import org.jboss.test.ws.jaxws.jsr181.soapbinding.SubmitBareRequest;
import org.jboss.test.ws.jaxws.jsr181.soapbinding.SubmitBareResponse;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -37,7 +37,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test a Provider<SOAPMessage>
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -37,7 +37,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test a Provider<SOAPMessage>
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -35,7 +35,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JSR-181 annotation: javax.jws.WebService
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -34,8 +34,8 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JSR-181 annotation: javax.jws.WebService
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -25,7 +25,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import javax.xml.namespace.QName;
import java.net.MalformedURLException;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -33,7 +33,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JAXWS annotation: javax.xml.ws.WebServiceref
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -34,7 +34,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JAXWS annotation: javax.xml.ws.WebServiceref
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -35,7 +35,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test the JAXWS annotation: javax.xml.ws.WebServiceref
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -32,10 +32,10 @@
import org.jboss.test.ws.tools.validation.WSDL11Validator;
import org.jboss.test.ws.tools.validation.WSDLValidator;
import org.jboss.ws.common.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.common.metadata.wsdl.WSDL20Writer;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.WSDLToJava;
import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
+import org.jboss.ws.tools.wsdl.WSDL20Writer;
/**
* Test jbossws WSDL11 -> Java
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -32,11 +32,11 @@
import org.jboss.test.ws.tools.validation.WSDL11Validator;
import org.jboss.test.ws.tools.validation.WSDLValidator;
import org.jboss.ws.common.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.common.metadata.wsdl.WSDL20Writer;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.tools.WSDLToJava;
import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
+import org.jboss.ws.tools.wsdl.WSDL20Writer;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Test jbossws WSDL11 -> Java -> WSDL20
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -43,7 +43,6 @@
import org.jboss.ws.common.jaxrpc.Style;
import org.jboss.ws.common.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.common.utils.DOMUtils;
import org.jboss.ws.common.utils.DOMWriter;
@@ -54,6 +53,7 @@
import org.jboss.ws.tools.client.ServiceCreator;
import org.jboss.ws.tools.exceptions.JBossWSToolsException;
import org.jboss.ws.tools.mapping.MappingFileGenerator;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -33,7 +33,6 @@
import org.jboss.ws.common.jaxrpc.LiteralTypeMapping;
import org.jboss.ws.common.jaxrpc.Style;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.common.utils.DOMUtils;
import org.jboss.ws.common.utils.IOUtils;
import org.jboss.ws.tools.JavaToWSDL;
@@ -41,6 +40,7 @@
import org.jboss.ws.tools.WSToolsConstants;
import org.jboss.ws.tools.exceptions.JBossWSToolsException;
import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java 2006-12-06
11:19:33 UTC (rev 1572)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java 2006-12-06
14:11:26 UTC (rev 1573)
@@ -26,8 +26,8 @@
import junit.framework.TestCase;
import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.tools.exceptions.JBossWSToolsException;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
* Testcase to test the WSDL Validator