Working on XsdSchema
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class DomWsdl11Definition implements Wsdl11Definition, BeanNameAware, InitializingBean {
|
||||
|
||||
private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
|
||||
public static final String WSDL_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/";
|
||||
|
||||
public static final String WSDL_NAMESPACE_PREFIX = "wsdl";
|
||||
|
||||
public static final String TARGET_NAMESPACE_PREFIX = "tns";
|
||||
|
||||
private Document document;
|
||||
|
||||
private String targetNamespace;
|
||||
|
||||
private String beanName;
|
||||
|
||||
private String name;
|
||||
|
||||
static {
|
||||
documentBuilderFactory.setNamespaceAware(true);
|
||||
}
|
||||
|
||||
public void setTargetNamespace(String targetNamespace) {
|
||||
Assert.notNull(targetNamespace, "'targetNamespace' must not be null");
|
||||
this.targetNamespace = targetNamespace;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
Assert.notNull(name, "'name' must not be null");
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Source getSource() {
|
||||
return new DOMSource(document);
|
||||
}
|
||||
|
||||
public void setBeanName(String name) {
|
||||
this.beanName = name;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(targetNamespace, "'targetNamespace' is required");
|
||||
if (!StringUtils.hasLength(name)) {
|
||||
this.name = beanName;
|
||||
}
|
||||
DocumentBuilder documentBuilder = createDocumentBuilder();
|
||||
document = documentBuilder.newDocument();
|
||||
Element definitions = createDefinitions(document);
|
||||
document.appendChild(definitions);
|
||||
}
|
||||
|
||||
public Element createDefinitions(Document document) {
|
||||
Element definitions = createWsdlElement(document, "definitions");
|
||||
if (StringUtils.hasLength(name)) {
|
||||
definitions.setAttribute("name", name);
|
||||
}
|
||||
declareNamespaces(definitions);
|
||||
definitions.setAttribute("targetNamespace", targetNamespace);
|
||||
addImports(document, definitions);
|
||||
addTypes(document, definitions);
|
||||
addMessages(document, definitions);
|
||||
addPortTypes(document, definitions);
|
||||
addBindings(document, definitions);
|
||||
addServices(document, definitions);
|
||||
|
||||
return definitions;
|
||||
}
|
||||
|
||||
protected void declareNamespaces(Element definitions) {
|
||||
declareNamespace(definitions, WSDL_NAMESPACE_PREFIX, WSDL_NAMESPACE_URI);
|
||||
declareNamespace(definitions, TARGET_NAMESPACE_PREFIX, targetNamespace);
|
||||
}
|
||||
|
||||
protected void addImports(Document document, Element definitions) {
|
||||
}
|
||||
|
||||
|
||||
protected void addTypes(Document document, Element definitions) {
|
||||
}
|
||||
|
||||
protected void addMessages(Document document, Element definitions) {
|
||||
}
|
||||
|
||||
protected void addPortTypes(Document document, Element definitions) {
|
||||
}
|
||||
|
||||
protected void addBindings(Document document, Element definitions) {
|
||||
}
|
||||
|
||||
protected void addServices(Document document, Element definitions) {
|
||||
}
|
||||
|
||||
protected DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
|
||||
return documentBuilderFactory.newDocumentBuilder();
|
||||
}
|
||||
|
||||
protected void declareNamespace(Element element, String namespacePrefix, String namespaceUri) {
|
||||
Assert.hasLength(namespacePrefix, "No prefix given");
|
||||
Assert.hasLength(namespaceUri, "No namespace given");
|
||||
element.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" + namespacePrefix, namespaceUri);
|
||||
}
|
||||
|
||||
protected Element createWsdlElement(Document document, String localName) {
|
||||
return createElement(document, WSDL_NAMESPACE_PREFIX, WSDL_NAMESPACE_URI, localName);
|
||||
}
|
||||
|
||||
protected Element createElement(Document document, String namespacePrefix, String namespaceUri, String localName) {
|
||||
Assert.hasLength(namespacePrefix, "No prefix given");
|
||||
Assert.hasLength(namespaceUri, "No namespace given");
|
||||
Assert.hasLength(localName, "No localName given");
|
||||
return document.createElementNS(namespaceUri, namespacePrefix + ":" + localName);
|
||||
}
|
||||
|
||||
protected List getWsdlChildElements(Element element, String localName) {
|
||||
return getChildElements(element, WSDL_NAMESPACE_URI, localName);
|
||||
}
|
||||
|
||||
protected Element getWsdlChildElement(Element element, String localName) {
|
||||
return getChildElement(element, WSDL_NAMESPACE_URI, localName);
|
||||
}
|
||||
|
||||
protected List getChildElements(Element element, String namespaceUri, String localName) {
|
||||
Assert.hasLength(namespaceUri, "No namespace given");
|
||||
Assert.hasLength(localName, "No localName given");
|
||||
NodeList nodeList = element.getChildNodes();
|
||||
List result = new ArrayList();
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
Node node = nodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE && namespaceUri.equals(node.getNamespaceURI()) &&
|
||||
localName.equals(node.getLocalName())) {
|
||||
result.add(node);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected Element getChildElement(Element element, String namespaceUri, String localName) {
|
||||
Assert.hasLength(namespaceUri, "No namespace given");
|
||||
Assert.hasLength(localName, "No localName given");
|
||||
NodeList nodeList = element.getChildNodes();
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
Node node = nodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE && namespaceUri.equals(node.getNamespaceURI()) &&
|
||||
localName.equals(node.getLocalName())) {
|
||||
return (Element) node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.sax.SaxUtils;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class XsdSchemaWsdl11Definition extends DomWsdl11Definition {
|
||||
|
||||
public static final String XSD_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema";
|
||||
|
||||
public static final String XSD_NAMESPACE_PREFIX = "xsd";
|
||||
|
||||
private Resource[] schemaResources;
|
||||
|
||||
private Element[] schemas;
|
||||
|
||||
// keys are String namespaces; values are List of Elements
|
||||
private Map namespaces = new LinkedHashMap();
|
||||
|
||||
public void setSchemas(Resource[] schemas) {
|
||||
this.schemaResources = schemas;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notEmpty(schemaResources, "'schemas' is required");
|
||||
DocumentBuilder documentBuilder = createDocumentBuilder();
|
||||
schemas = new Element[schemaResources.length];
|
||||
for (int i = 0; i < schemaResources.length; i++) {
|
||||
schemas[i] = parseSchema(documentBuilder, schemaResources[i]);
|
||||
}
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
protected void addTypes(Document document, Element definitions) {
|
||||
Element types = createWsdlElement(document, "types");
|
||||
definitions.appendChild(types);
|
||||
for (int i = 0; i < schemas.length; i++) {
|
||||
Element importedSchema = (Element) document.importNode(schemas[i], true);
|
||||
types.appendChild(importedSchema);
|
||||
}
|
||||
}
|
||||
/*
|
||||
protected void declareNamespaces(Element definitions) {
|
||||
super.declareNamespaces(definitions);
|
||||
declareNamespace(definitions, XSD_NAMESPACE_PREFIX, XSD_NAMESPACE_URI);
|
||||
int i = 0;
|
||||
for (Iterator iterator = namespaces.keySet().iterator(); iterator.hasNext();) {
|
||||
String namespace = (String) iterator.next();
|
||||
declareNamespace(definitions, "s" + i, namespace);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
protected void addTypes(Document document, Element definitions) {
|
||||
Element types = createWsdlElement(document, "types");
|
||||
definitions.appendChild(types);
|
||||
for (Iterator iterator = namespaces.keySet().iterator(); iterator.hasNext();) {
|
||||
String namespace = (String) iterator.next();
|
||||
List schemaElements = (List) namespaces.get(namespace);
|
||||
addSchema(document, types, namespace, schemaElements);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSchema(Document document, Element types, String targetNamespace, List schemaElements) {
|
||||
Element schema = createElement(document, XSD_NAMESPACE_PREFIX, XSD_NAMESPACE_URI, "schema");
|
||||
types.appendChild(schema);
|
||||
schema.setAttribute("elementFormDefault", "qualified");
|
||||
schema.setAttribute("targetNamespace", targetNamespace);
|
||||
for (Iterator iterator = schemaElements.iterator(); iterator.hasNext();) {
|
||||
Element toBeImported = (Element) iterator.next();
|
||||
NodeList children = toBeImported.getChildNodes();
|
||||
for (int i = 0; i < children.getLength();i++) {
|
||||
Node importedNode = document.importNode(children.item(i), true);
|
||||
schema.appendChild(importedNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
protected void addTypes(Document document, Element definitions) {
|
||||
Element types = createWsdlElement(document, "types");
|
||||
definitions.appendChild(types);
|
||||
for (int i = 0; i < schemas.length; i++) {
|
||||
addSchema(document, types, schemas[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSchema(Document document, Element types, Resource xsdSchema) {
|
||||
try {
|
||||
DocumentBuilder documentBuilder = createDocumentBuilder();
|
||||
Element schema = parseSchema(documentBuilder, xsdSchema, null);
|
||||
Element importedSchema = (Element) document.importNode(schema, true);
|
||||
types.appendChild(importedSchema);
|
||||
}
|
||||
catch (ParserConfigurationException ex) {
|
||||
throw new WsdlDefinitionException("Could not create DocumentBuilder", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Element parseSchema(DocumentBuilder documentBuilder,
|
||||
Resource schemaResource,
|
||||
String expectedTargetNamespace) {
|
||||
try {
|
||||
Document schemaDocument = documentBuilder.parse(SaxUtils.createInputSource(schemaResource));
|
||||
Element schema = schemaDocument.getDocumentElement();
|
||||
checkSchemaElement(schemaResource, expectedTargetNamespace, schema);
|
||||
inlineIncludes(documentBuilder, schemaResource, schema);
|
||||
return schema;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new WsdlDefinitionException("Could parse schema " + schemaResource, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSchemaElement(Resource schemaResource, String expectedTargetNamespace, Element schema) {
|
||||
Assert.isTrue("schema".equals(schema.getLocalName()),
|
||||
schemaResource + " does not have 'schema' as root element local name");
|
||||
Assert.isTrue(XSD_NAMESPACE_URI.equals(schema.getNamespaceURI()),
|
||||
schemaResource + " does not have '" + XSD_NAMESPACE_URI + "' as root element namespace");
|
||||
if (StringUtils.hasText(expectedTargetNamespace)) {
|
||||
String targetNamespace = schema.getAttribute("targetNamespace");
|
||||
Assert.isTrue(!StringUtils.hasText(targetNamespace) ||
|
||||
expectedTargetNamespace.equals(targetNamespace), schemaResource +
|
||||
" has invalid targetNamespace [" + targetNamespace + "]. Expected [" + expectedTargetNamespace +
|
||||
"]");
|
||||
}
|
||||
// check for elementFormDefault
|
||||
}
|
||||
|
||||
private void inlineIncludes(DocumentBuilder documentBuilder, Resource schemaResource, Element schema)
|
||||
throws IOException {
|
||||
List includes = getChildElements(schema, XSD_NAMESPACE_URI, "include");
|
||||
for (Iterator iterator = includes.iterator(); iterator.hasNext();) {
|
||||
Element include = (Element) iterator.next();
|
||||
String schemaLocation = include.getAttribute("schemaLocation");
|
||||
Assert.hasText(schemaLocation, schemaResource + " <include/> has no schemaLocation attribute");
|
||||
Resource includedResource = schemaResource.createRelative(schemaLocation);
|
||||
Assert.isTrue(includedResource.exists(), includedResource + " does not exist");
|
||||
String targetNamespace = schema.getAttribute("targetNamespace");
|
||||
Element includedSchemaElement = parseSchema(documentBuilder, includedResource, targetNamespace);
|
||||
NodeList children = includedSchemaElement.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
Node importedChild = schema.getOwnerDocument().importNode(children.item(i), true);
|
||||
schema.appendChild(importedChild);
|
||||
}
|
||||
schema.removeChild(include);
|
||||
}
|
||||
}
|
||||
|
||||
private void findImports(Resource schemaResource, Element schema) throws IOException {
|
||||
List imports = getChildElements(schema, XSD_NAMESPACE_URI, "import");
|
||||
for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
|
||||
Element importEl = (Element) iterator.next();
|
||||
String schemaLocation = importEl.getAttribute("schemaLocation");
|
||||
Assert.hasText(schemaLocation, schemaResource + " <include/> has no schemaLocation attribute");
|
||||
Resource includedResource = schemaResource.createRelative(schemaLocation);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Element findNamespaces(DocumentBuilder documentBuilder,
|
||||
Resource schemaResource,
|
||||
Map namespaces,
|
||||
String namespace) throws IOException, SAXException {
|
||||
Document schemaDocument = documentBuilder.parse(SaxUtils.createInputSource(schemaResource));
|
||||
Element schema = schemaDocument.getDocumentElement();
|
||||
if (!StringUtils.hasText(namespace)) {
|
||||
namespace = schema.getAttribute("targetNamespace");
|
||||
}
|
||||
List elements = (List) namespaces.get(namespace);
|
||||
if (elements == null) {
|
||||
elements = new LinkedList<Element>();
|
||||
namespaces.put(namespace, elements);
|
||||
}
|
||||
NodeList children = schema.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
if (Node.ELEMENT_NODE == children.item(i).getNodeType() &&
|
||||
XSD_NAMESPACE_URI.equals(children.item(i).getNamespaceURI())) {
|
||||
Element element = (Element) children.item(i);
|
||||
if ("include".equals(element.getLocalName())) {
|
||||
String schemaLocation = element.getAttribute("schemaLocation");
|
||||
Assert.hasText(schemaLocation, schemaResource + " <include/> has no schemaLocation attribute");
|
||||
Resource includedResource = schemaResource.createRelative(schemaLocation);
|
||||
Assert.isTrue(includedResource.exists(),
|
||||
includedResource + " (included from " + schemaResource + ") does not exist");
|
||||
Element includedSchema = findNamespaces(documentBuilder, includedResource, namespaces, namespace);
|
||||
NodeList nodeList = includedSchema.getChildNodes();
|
||||
for (int j = 0; j < nodeList.getLength(); j++) {
|
||||
Node importedNode = schema.getOwnerDocument().importNode(nodeList.item(j), true);
|
||||
schema.appendChild(importedNode);
|
||||
}
|
||||
schema.removeChild(element);
|
||||
}
|
||||
else if ("import".equals(element.getLocalName())) {
|
||||
String schemaLocation = element.getAttribute("schemaLocation");
|
||||
Assert.hasText(schemaLocation, schemaResource + " <import/> has no schemaLocation attribute");
|
||||
String importNamespace = element.getAttribute("namespace");
|
||||
Assert.hasText(importNamespace, schemaResource + " <import/> has no namespace attribute");
|
||||
Resource importedResource = schemaResource.createRelative(schemaLocation);
|
||||
Assert.isTrue(importedResource.exists(),
|
||||
importedResource + " (imported from " + schemaResource + ") does not exist");
|
||||
findNamespaces(documentBuilder, importedResource, namespaces, importNamespace);
|
||||
element.removeAttribute("schemaLocation");
|
||||
elements.add(schema);
|
||||
}
|
||||
}
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
private Element parseSchema(DocumentBuilder documentBuilder,
|
||||
Resource schemaResource) throws IOException, SAXException {
|
||||
Document schemaDocument = documentBuilder.parse(SaxUtils.createInputSource(schemaResource));
|
||||
Element schema = schemaDocument.getDocumentElement();
|
||||
inlineIncludes(documentBuilder, schemaResource, schema);
|
||||
return schema;
|
||||
}
|
||||
|
||||
private void inlineIncludes(DocumentBuilder documentBuilder, Resource schemaResource, Element schema)
|
||||
throws IOException, SAXException {
|
||||
List includes = getChildElements(schema, XSD_NAMESPACE_URI, "include");
|
||||
for (Iterator iterator = includes.iterator(); iterator.hasNext();) {
|
||||
Element include = (Element) iterator.next();
|
||||
String schemaLocation = include.getAttribute("schemaLocation");
|
||||
Assert.hasText(schemaLocation, schemaResource + " <include/> has no schemaLocation attribute");
|
||||
Resource includedResource = schemaResource.createRelative(schemaLocation);
|
||||
Assert.isTrue(includedResource.exists(), includedResource + " does not exist");
|
||||
String targetNamespace = schema.getAttribute("targetNamespace");
|
||||
Element includedSchemaElement = parseSchema(documentBuilder, includedResource);
|
||||
NodeList children = includedSchemaElement.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
Node importedChild = schema.getOwnerDocument().importNode(children.item(i), true);
|
||||
schema.appendChild(importedChild);
|
||||
}
|
||||
NamedNodeMap attributes = includedSchemaElement.getAttributes();
|
||||
for (int i = 0; i < attributes.getLength(); i++) {
|
||||
Attr attribute = (Attr) attributes.item(i);
|
||||
if ("http://www.w3.org/2000/xmlns/".equals(attribute.getNamespaceURI()) &&
|
||||
"xmlns".equals(attribute.getPrefix())) {
|
||||
Attr importedAttr = (Attr) schema.getOwnerDocument().importNode(attribute, true);
|
||||
schema.setAttributeNode(importedAttr);
|
||||
}
|
||||
}
|
||||
schema.removeChild(include);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.provider;
|
||||
|
||||
import javax.wsdl.Binding;
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface BindingProvider {
|
||||
|
||||
void addBinding(Definition definition) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.provider;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.wsdl.Binding;
|
||||
import javax.wsdl.BindingFault;
|
||||
import javax.wsdl.BindingInput;
|
||||
import javax.wsdl.BindingOperation;
|
||||
import javax.wsdl.BindingOutput;
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Fault;
|
||||
import javax.wsdl.Input;
|
||||
import javax.wsdl.Operation;
|
||||
import javax.wsdl.OperationType;
|
||||
import javax.wsdl.Output;
|
||||
import javax.wsdl.PortType;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class DefaultBindingProvider implements BindingProvider {
|
||||
|
||||
/** The suffix used to create a binding name from a port type name. */
|
||||
public static final String DEFAULT_BINDING_SUFFIX = "Binding";
|
||||
|
||||
private String bindingSuffix = DEFAULT_BINDING_SUFFIX;
|
||||
|
||||
public String getBindingSuffix() {
|
||||
return bindingSuffix;
|
||||
}
|
||||
|
||||
public void setBindingSuffix(String bindingSuffix) {
|
||||
this.bindingSuffix = bindingSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Binding} for each {@link PortType} in the definition, and calls {@link
|
||||
* #populateBinding(javax.wsdl.Definition,javax.wsdl.Binding)} with it. Creates a {@link BindingOperation} for each
|
||||
* {@link Operation} in the port type, a {@link BindingInput} for each {@link Input} in the operation, etc.
|
||||
* <p/>
|
||||
* Calls the various <code>populate</code> methods with the created WSDL4J objects.
|
||||
*
|
||||
* @param definition the WSDL4J <code>Definition</code>
|
||||
* @throws WSDLException in case of errors
|
||||
* @see #populateBinding(javax.wsdl.Definition,javax.wsdl.Binding)
|
||||
* @see #populateBindingOperation(javax.wsdl.Definition,javax.wsdl.BindingOperation)
|
||||
* @see #populateBindingInput(javax.wsdl.Definition,javax.wsdl.BindingInput,javax.wsdl.Input)
|
||||
* @see #populateBindingOutput(javax.wsdl.Definition,javax.wsdl.BindingOutput,javax.wsdl.Output)
|
||||
* @see #populateBindingFault(javax.wsdl.Definition,javax.wsdl.BindingFault,javax.wsdl.Fault)
|
||||
*/
|
||||
public void addBinding(Definition definition) throws WSDLException {
|
||||
for (Iterator iterator = definition.getPortTypes().values().iterator(); iterator.hasNext();) {
|
||||
PortType portType = (PortType) iterator.next();
|
||||
Binding binding = definition.createBinding();
|
||||
binding.setPortType(portType);
|
||||
populateBinding(definition, binding);
|
||||
createBindingOperations(definition, binding, portType);
|
||||
binding.setUndefined(false);
|
||||
definition.addBinding(binding);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link Binding} has been created, but before any sub-elements are added. Subclasses can override
|
||||
* this method to define the binding name, or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the binding name to the port type name with the {@link #getBindingSuffix() suffix}
|
||||
* appended to it.
|
||||
*
|
||||
* @param definition the WSDL4J <code>Definition</code>
|
||||
* @param binding the WSDL4J <code>Binding</code>
|
||||
*/
|
||||
protected void populateBinding(Definition definition, Binding binding) throws WSDLException {
|
||||
QName portTypeName = binding.getPortType().getQName();
|
||||
if (portTypeName != null) {
|
||||
binding.setQName(
|
||||
new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + getBindingSuffix()));
|
||||
}
|
||||
}
|
||||
|
||||
private void createBindingOperations(Definition definition, Binding binding, PortType portType)
|
||||
throws WSDLException {
|
||||
for (Iterator operationIterator = portType.getOperations().iterator(); operationIterator.hasNext();) {
|
||||
Operation operation = (Operation) operationIterator.next();
|
||||
BindingOperation bindingOperation = definition.createBindingOperation();
|
||||
bindingOperation.setOperation(operation);
|
||||
populateBindingOperation(definition, bindingOperation);
|
||||
if (operation.getStyle() == null || operation.getStyle().equals(OperationType.REQUEST_RESPONSE)) {
|
||||
createBindingInput(definition, operation, bindingOperation);
|
||||
createBindingOutput(definition, operation, bindingOperation);
|
||||
}
|
||||
else if (operation.getStyle().equals(OperationType.ONE_WAY)) {
|
||||
createBindingInput(definition, operation, bindingOperation);
|
||||
}
|
||||
else if (operation.getStyle().equals(OperationType.NOTIFICATION)) {
|
||||
createBindingOutput(definition, operation, bindingOperation);
|
||||
}
|
||||
else if (operation.getStyle().equals(OperationType.SOLICIT_RESPONSE)) {
|
||||
createBindingOutput(definition, operation, bindingOperation);
|
||||
createBindingInput(definition, operation, bindingOperation);
|
||||
}
|
||||
for (Iterator faultIterator = operation.getFaults().values().iterator(); faultIterator.hasNext();) {
|
||||
Fault fault = (Fault) faultIterator.next();
|
||||
BindingFault bindingFault = definition.createBindingFault();
|
||||
populateBindingFault(definition, bindingFault, fault);
|
||||
bindingOperation.addBindingFault(bindingFault);
|
||||
}
|
||||
binding.addBindingOperation(bindingOperation);
|
||||
}
|
||||
}
|
||||
|
||||
private void createBindingInput(Definition definition, Operation operation, BindingOperation bindingOperation)
|
||||
throws WSDLException {
|
||||
BindingInput bindingInput = definition.createBindingInput();
|
||||
populateBindingInput(definition, bindingInput, operation.getInput());
|
||||
bindingOperation.setBindingInput(bindingInput);
|
||||
}
|
||||
|
||||
private void createBindingOutput(Definition definition, Operation operation, BindingOperation bindingOperation)
|
||||
throws WSDLException {
|
||||
BindingOutput bindingOutput = definition.createBindingOutput();
|
||||
populateBindingOutput(definition, bindingOutput, operation.getOutput());
|
||||
bindingOperation.setBindingOutput(bindingOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingOperation} has been created, but before any sub-elements are added. Subclasses can
|
||||
* implement this method to define the binding name, or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the name of the binding operation to the name of the operation.
|
||||
*
|
||||
* @param definition the WSDL4J <code>Definition</code>
|
||||
* @param bindingOperation the WSDL4J <code>BindingOperation</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingOperation(Definition definition, BindingOperation bindingOperation)
|
||||
throws WSDLException {
|
||||
bindingOperation.setName(bindingOperation.getOperation().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingInput} has been created. Subclasses can implement this method to define the name,
|
||||
* or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation set the name of the binding input to the name of the input.
|
||||
*
|
||||
* @param bindingInput the WSDL4J <code>BindingInput</code>
|
||||
* @param input the corresponding WSDL4J <code>Input</code> @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingInput(Definition definition, BindingInput bindingInput, Input input)
|
||||
throws WSDLException {
|
||||
bindingInput.setName(input.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingOutput} has been created. Subclasses can implement this method to define the name,
|
||||
* or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the name of the binding output to the name of the output.
|
||||
*
|
||||
* @param bindingOutput the WSDL4J <code>BindingOutput</code>
|
||||
* @param output the corresponding WSDL4J <code>Output</code> @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingOutput(Definition definition, BindingOutput bindingOutput, Output output)
|
||||
throws WSDLException {
|
||||
bindingOutput.setName(output.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingFault} has been created. Subclasses can implement this method to define the name,
|
||||
* or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation set the name of the binding fault to the name of the fault.
|
||||
*
|
||||
* @param bindingFault the WSDL4J <code>BindingFault</code>
|
||||
* @param fault the corresponding WSDL4J <code>Fault</code> @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingFault(Definition definition, BindingFault bindingFault, Fault fault)
|
||||
throws WSDLException {
|
||||
bindingFault.setName(fault.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.provider;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.wsdl.Binding;
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Port;
|
||||
import javax.wsdl.Service;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class DefaultServiceProvider implements ServiceProvider {
|
||||
|
||||
private QName serviceName;
|
||||
|
||||
/**
|
||||
* Returns the service name.
|
||||
*/
|
||||
public QName getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the service name.
|
||||
*/
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = QNameUtils.parseQNameString(serviceName);
|
||||
}
|
||||
|
||||
public void addService(Definition definition) throws WSDLException {
|
||||
Service service = definition.createService();
|
||||
populateService(service);
|
||||
createPorts(definition, service);
|
||||
definition.addService(service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link javax.wsdl.Service} has been created, but before any sub-elements are added. Subclasses
|
||||
* can implement this method to define the service name, or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the name to the {@link #setServiceName(String) serviceName} property.
|
||||
*
|
||||
* @param service the WSDL4J <code>Service</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateService(Service service) throws WSDLException {
|
||||
service.setQName(getServiceName());
|
||||
}
|
||||
|
||||
private void createPorts(Definition definition, Service service) throws WSDLException {
|
||||
for (Iterator iterator = definition.getBindings().values().iterator(); iterator.hasNext();) {
|
||||
Binding binding = (Binding) iterator.next();
|
||||
Port port = definition.createPort();
|
||||
port.setBinding(binding);
|
||||
populatePort(port, binding);
|
||||
service.addPort(port);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link Port} has been created, but before any sub-elements are added. Subclasses can implement
|
||||
* this method to define the port name, or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the port name to the binding name.
|
||||
*
|
||||
* @param port the WSDL4J <code>Port</code>
|
||||
* @param binding the corresponding WSDL4J <code>Binding</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populatePort(Port port, Binding binding) throws WSDLException {
|
||||
port.setName(binding.getQName().getLocalPart());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.provider;
|
||||
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface ServiceProvider {
|
||||
|
||||
void addService(Definition definition) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.soap;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.wsdl.wsdl11.DomWsdl11Definition;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public abstract class AbstractSoapWsdl11Definition extends DomWsdl11Definition {
|
||||
|
||||
/** The default transport URI, which indicates an HTTP transport. */
|
||||
public static final String DEFAULT_TRANSPORT_URI = "http://schemas.xmlsoap.org/soap/http";
|
||||
|
||||
private String transportUri = DEFAULT_TRANSPORT_URI;
|
||||
|
||||
private Properties soapActions = new Properties();
|
||||
|
||||
private String serviceName;
|
||||
|
||||
private String locationUri;
|
||||
|
||||
/**
|
||||
* Sets the value used for the binding transport attribute value. Defaults to {@link #DEFAULT_TRANSPORT_URI}.
|
||||
*
|
||||
* @param transportUri the binding transport value
|
||||
*/
|
||||
public void setTransportUri(String transportUri) {
|
||||
Assert.notNull(transportUri, "'transportUri' must not be null");
|
||||
this.transportUri = transportUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the SOAP Actions for this binding. Keys are {@link javax.wsdl.BindingOperation#getName() binding operation
|
||||
* names}; values are {@link javax.wsdl.extensions.soap.SOAPOperation#getSoapActionURI() SOAP Action URIs}.
|
||||
*
|
||||
* @param soapActions the soap
|
||||
* @return the soap actions
|
||||
*/
|
||||
public void setSoapActions(Properties soapActions) {
|
||||
Assert.notNull(soapActions, "'soapActions' must not be null");
|
||||
this.soapActions = soapActions;
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
public void setLocationUri(String locationUri) {
|
||||
this.locationUri = locationUri;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(serviceName, "'serviceName' is required");
|
||||
Assert.notNull(locationUri, "'locationUri' is required");
|
||||
}
|
||||
|
||||
protected void declareNamespaces(Element definitions) {
|
||||
super.declareNamespaces(definitions);
|
||||
declareNamespace(definitions, getSoapNamespacePrefix(), getSoapNamespaceUri());
|
||||
}
|
||||
|
||||
protected void addBindings(Document document, Element definitions) {
|
||||
List portTypes = getWsdlChildElements(definitions, "portType");
|
||||
for (Iterator iterator = portTypes.iterator(); iterator.hasNext();) {
|
||||
Element portType = (Element) iterator.next();
|
||||
addSoapBinding(document, definitions, portType);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSoapBinding(Document document, Element definitions, Element portType) {
|
||||
Element binding = createWsdlElement(document, "binding");
|
||||
definitions.appendChild(binding);
|
||||
String portTypeName = portType.getAttribute("name");
|
||||
Assert.hasText(portTypeName, "<portType/> lacks required name attribute");
|
||||
binding.setAttribute("name", portTypeName + getBindingSuffix());
|
||||
binding.setAttribute("type", TARGET_NAMESPACE_PREFIX + ":" + portTypeName);
|
||||
Element soapBinding = createSoapElement(document, "binding");
|
||||
binding.appendChild(soapBinding);
|
||||
soapBinding.setAttribute("style", "document");
|
||||
soapBinding.setAttribute("transport", transportUri);
|
||||
|
||||
List operations = getWsdlChildElements(portType, "operation");
|
||||
for (Iterator iterator = operations.iterator(); iterator.hasNext();) {
|
||||
Element operation = (Element) iterator.next();
|
||||
addSoapOperation(document, binding, operation);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSoapOperation(Document document, Element binding, Element operation) {
|
||||
Element bindingOperation = createWsdlElement(document, "operation");
|
||||
binding.appendChild(bindingOperation);
|
||||
String operationName = operation.getAttribute("name");
|
||||
Assert.hasText(operationName, "<operation/> lacks required name attribute");
|
||||
bindingOperation.setAttribute("name", operationName);
|
||||
Element soapOperation = createSoapElement(document, "operation");
|
||||
bindingOperation.appendChild(soapOperation);
|
||||
String soapAction = soapActions.getProperty(operationName, "");
|
||||
soapOperation.setAttribute("soapAction", soapAction);
|
||||
|
||||
Element input = getWsdlChildElement(operation, "input");
|
||||
if (input != null) {
|
||||
createBindingInputOutput(document, input, bindingOperation, "input");
|
||||
}
|
||||
Element output = getWsdlChildElement(operation, "output");
|
||||
if (output != null) {
|
||||
createBindingInputOutput(document, output, bindingOperation, "output");
|
||||
}
|
||||
List faults = getWsdlChildElements(operation, "fault");
|
||||
for (Iterator iterator = faults.iterator(); iterator.hasNext();) {
|
||||
Element fault = (Element) iterator.next();
|
||||
createBindingFault(document, bindingOperation, fault);
|
||||
}
|
||||
}
|
||||
|
||||
private void createBindingInputOutput(Document document,
|
||||
Element inputOutput,
|
||||
Element bindingOperation,
|
||||
String localName) {
|
||||
Element bindingInputOutput = createWsdlElement(document, localName);
|
||||
bindingOperation.appendChild(bindingInputOutput);
|
||||
String inputOutputName = inputOutput.getAttribute("name");
|
||||
if (StringUtils.hasLength(inputOutputName)) {
|
||||
bindingInputOutput.setAttribute("name", inputOutputName);
|
||||
}
|
||||
Element soapBody = createSoapElement(document, "body");
|
||||
bindingInputOutput.appendChild(soapBody);
|
||||
soapBody.setAttribute("use", "literal");
|
||||
}
|
||||
|
||||
private void createBindingFault(Document document, Element bindingOperation, Element fault) {
|
||||
Element bindingFault = createWsdlElement(document, "fault");
|
||||
bindingOperation.appendChild(bindingFault);
|
||||
String faultName = fault.getAttribute("name");
|
||||
Assert.hasText(faultName, "<fault/> lacks required name attribute");
|
||||
bindingFault.setAttribute("name", faultName);
|
||||
Element soapBody = createSoapElement(document, "body");
|
||||
bindingFault.appendChild(soapBody);
|
||||
soapBody.setAttribute("use", "literal");
|
||||
}
|
||||
|
||||
protected void addServices(Document document, Element definitions) {
|
||||
List bindings = getWsdlChildElements(definitions, "binding");
|
||||
if (!bindings.isEmpty()) {
|
||||
Element service = getWsdlChildElement(definitions, "service");
|
||||
if (service == null) {
|
||||
service = createWsdlElement(document, "service");
|
||||
}
|
||||
definitions.appendChild(service);
|
||||
service.setAttribute("name", serviceName);
|
||||
for (Iterator iterator = bindings.iterator(); iterator.hasNext();) {
|
||||
Element binding = (Element) iterator.next();
|
||||
Element soapBinding = getChildElement(binding, getSoapNamespaceUri(), "binding");
|
||||
if (soapBinding != null) {
|
||||
addSoapPort(document, service, binding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addSoapPort(Document document, Element service, Element binding) {
|
||||
Element port = createWsdlElement(document, "port");
|
||||
service.appendChild(port);
|
||||
String bindingName = binding.getAttribute("name");
|
||||
Assert.hasText(serviceName, "<binding/> lacks required name attribute");
|
||||
port.setAttribute("name", bindingName);
|
||||
port.setAttribute("binding", TARGET_NAMESPACE_PREFIX + ":" + bindingName);
|
||||
Element soapAddress = createElement(document, getSoapNamespacePrefix(), getSoapNamespacePrefix(), "address");
|
||||
port.appendChild(soapAddress);
|
||||
soapAddress.setAttribute("location", locationUri);
|
||||
}
|
||||
|
||||
protected Element createSoapElement(Document document, String localName) {
|
||||
return createElement(document, getSoapNamespacePrefix(), getSoapNamespaceUri(), localName);
|
||||
}
|
||||
|
||||
protected abstract String getSoapNamespaceUri();
|
||||
|
||||
protected abstract String getSoapNamespacePrefix();
|
||||
|
||||
protected abstract String getBindingSuffix();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.soap;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class Soap11Wsdl11Definition extends AbstractSoapWsdl11Definition {
|
||||
|
||||
public static final String SOAP_11_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/soap/";
|
||||
|
||||
public static final String SOAP_11_NAMESPACE_PREFIX = "soap";
|
||||
|
||||
protected String getSoapNamespaceUri() {
|
||||
return SOAP_11_NAMESPACE_URI;
|
||||
}
|
||||
|
||||
protected String getSoapNamespacePrefix() {
|
||||
return SOAP_11_NAMESPACE_PREFIX;
|
||||
}
|
||||
|
||||
protected String getBindingSuffix() {
|
||||
return "Soap11";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.soap;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class Soap12Wsdl11Definition extends AbstractSoapWsdl11Definition {
|
||||
|
||||
public static final String SOAP_12_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/soap12/";
|
||||
|
||||
public static final String SOAP_12_NAMESPACE_PREFIX = "soap12";
|
||||
|
||||
protected String getSoapNamespaceUri() {
|
||||
return SOAP_12_NAMESPACE_URI;
|
||||
}
|
||||
|
||||
protected String getSoapNamespacePrefix() {
|
||||
return SOAP_12_NAMESPACE_PREFIX;
|
||||
}
|
||||
|
||||
protected String getBindingSuffix() {
|
||||
return "Soap12";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.soap;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import org.springframework.ws.wsdl.wsdl11.DomWsdl11Definition;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class SoapWsdl11Definition extends DomWsdl11Definition {
|
||||
|
||||
private Soap11Wsdl11Definition soap11BindingDefinition = new Soap11Wsdl11Definition();
|
||||
|
||||
private Soap12Wsdl11Definition soap12BindingDefinition = new Soap12Wsdl11Definition();
|
||||
|
||||
private boolean createSoap11Binding = true;
|
||||
|
||||
private boolean createSoap12Binding = false;
|
||||
|
||||
public void setCreateSoap11Binding(boolean createSoap11Binding) {
|
||||
this.createSoap11Binding = createSoap11Binding;
|
||||
}
|
||||
|
||||
public void setCreateSoap12Binding(boolean createSoap12Binding) {
|
||||
this.createSoap12Binding = createSoap12Binding;
|
||||
}
|
||||
|
||||
public void setTargetNamespace(String targetNamespace) {
|
||||
super.setTargetNamespace(targetNamespace);
|
||||
soap11BindingDefinition.setTargetNamespace(targetNamespace);
|
||||
soap12BindingDefinition.setTargetNamespace(targetNamespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value used for the binding transport attribute value. Defaults to the HTTP transport.
|
||||
*
|
||||
* @param transportUri the binding transport value
|
||||
*/
|
||||
public void setTransportUri(String transportUri) {
|
||||
Assert.notNull(transportUri, "'transportUri' must not be null");
|
||||
soap11BindingDefinition.setTransportUri(transportUri);
|
||||
soap12BindingDefinition.setTransportUri(transportUri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the SOAP Actions for this binding. Keys are {@link javax.wsdl.BindingOperation#getName() binding operation
|
||||
* names}; values are {@link javax.wsdl.extensions.soap.SOAPOperation#getSoapActionURI() SOAP Action URIs}.
|
||||
*
|
||||
* @param soapActions the soap
|
||||
* @return the soap actions
|
||||
*/
|
||||
public void setSoapActions(Properties soapActions) {
|
||||
Assert.notNull(soapActions, "'soapActions' must not be null");
|
||||
soap11BindingDefinition.setSoapActions(soapActions);
|
||||
soap12BindingDefinition.setSoapActions(soapActions);
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) {
|
||||
Assert.notNull(serviceName, "'serviceName' must not be null");
|
||||
soap11BindingDefinition.setServiceName(serviceName);
|
||||
soap12BindingDefinition.setServiceName(serviceName);
|
||||
}
|
||||
|
||||
public void setLocationUri(String locationUri) {
|
||||
Assert.notNull(locationUri, "'locationUri' must not be null");
|
||||
soap11BindingDefinition.setLocationUri(locationUri);
|
||||
soap12BindingDefinition.setLocationUri(locationUri);
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
soap11BindingDefinition.afterPropertiesSet();
|
||||
soap12BindingDefinition.afterPropertiesSet();
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
protected void declareNamespaces(Element definitions) {
|
||||
super.declareNamespaces(definitions);
|
||||
if (createSoap11Binding) {
|
||||
soap11BindingDefinition.declareNamespaces(definitions);
|
||||
}
|
||||
if (createSoap12Binding) {
|
||||
soap12BindingDefinition.declareNamespaces(definitions);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addBindings(Document document, Element definitions) {
|
||||
if (createSoap11Binding) {
|
||||
soap11BindingDefinition.addBindings(document, definitions);
|
||||
}
|
||||
if (createSoap12Binding) {
|
||||
soap12BindingDefinition.addBindings(document, definitions);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addServices(Document document, Element definitions) {
|
||||
if (createSoap11Binding) {
|
||||
soap11BindingDefinition.addServices(document, definitions);
|
||||
}
|
||||
if (createSoap12Binding) {
|
||||
soap12BindingDefinition.addServices(document, definitions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Binding;
|
||||
import javax.wsdl.BindingFault;
|
||||
import javax.wsdl.BindingInput;
|
||||
import javax.wsdl.BindingOperation;
|
||||
import javax.wsdl.BindingOutput;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface BindingVisitor {
|
||||
|
||||
void startBinding(Binding binding) throws WSDLException;
|
||||
|
||||
void startBindingOperation(BindingOperation operation) throws WSDLException;
|
||||
|
||||
void bindingInput(BindingInput input) throws WSDLException;
|
||||
|
||||
void bindingOutput(BindingOutput output) throws WSDLException;
|
||||
|
||||
void bindingFault(BindingFault fault) throws WSDLException;
|
||||
|
||||
void endBindingOperation(BindingOperation operation) throws WSDLException;
|
||||
|
||||
void endBinding(Binding binding) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Binding;
|
||||
import javax.wsdl.BindingFault;
|
||||
import javax.wsdl.BindingInput;
|
||||
import javax.wsdl.BindingOperation;
|
||||
import javax.wsdl.BindingOutput;
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Fault;
|
||||
import javax.wsdl.Input;
|
||||
import javax.wsdl.Operation;
|
||||
import javax.wsdl.Output;
|
||||
import javax.wsdl.PortType;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* Abstract base class for <code>Wsdl11DefinitionBuilder</code> implementations that use WSDL4J and contain a concrete
|
||||
* part. Creates a <code>binding</code> that matches any present <code>portType</code>. Lets subclasses populate these
|
||||
* through template methods.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class DefaultBindingVisitor implements PortTypeVisitor, DefinitionVisitor {
|
||||
|
||||
/** The suffix used to create a binding name from a port type name. */
|
||||
public static final String DEFAULT_BINDING_SUFFIX = "Binding";
|
||||
|
||||
private Binding binding;
|
||||
|
||||
private BindingOperation bindingOperation;
|
||||
|
||||
private Definition definition;
|
||||
|
||||
private String bindingSuffix = DEFAULT_BINDING_SUFFIX;
|
||||
|
||||
public String getBindingSuffix() {
|
||||
return bindingSuffix;
|
||||
}
|
||||
|
||||
public void setBindingSuffix(String bindingSuffix) {
|
||||
this.bindingSuffix = bindingSuffix;
|
||||
}
|
||||
|
||||
public void startDefinition(Definition definition) throws WSDLException {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public void startPortType(PortType portType) throws WSDLException {
|
||||
binding = definition.createBinding();
|
||||
binding.setPortType(portType);
|
||||
populateBinding(binding, portType);
|
||||
binding.setUndefined(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link Binding} has been created, but before any sub-elements are added. Subclasses can
|
||||
* implement this method to define the binding name, or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the binding name to the port type name with the suffix {@link Binding} appended to
|
||||
* it.
|
||||
*
|
||||
* @param binding the WSDL4J <code>Binding</code>
|
||||
* @param portType the corresponding <code>PortType</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBinding(Binding binding, PortType portType) throws WSDLException {
|
||||
QName portTypeName = portType.getQName();
|
||||
if (portTypeName != null) {
|
||||
binding.setQName(new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() +
|
||||
getBindingSuffix()));
|
||||
}
|
||||
}
|
||||
|
||||
public void endPortType(PortType portType) throws WSDLException {
|
||||
definition.addBinding(binding);
|
||||
}
|
||||
|
||||
public void startOperation(Operation operation) throws WSDLException {
|
||||
bindingOperation = definition.createBindingOperation();
|
||||
bindingOperation.setOperation(operation);
|
||||
populateBindingOperation(bindingOperation, operation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingOperation} has been created, but before any sub-elements are added. Subclasses can
|
||||
* implement this method to define the binding name, or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the name of the binding operation to the name of the operation.
|
||||
*
|
||||
* @param bindingOperation the WSDL4J <code>BindingOperation</code>
|
||||
* @param operation the corresponding WSDL4J <code>Operation</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingOperation(BindingOperation bindingOperation, Operation operation)
|
||||
throws WSDLException {
|
||||
bindingOperation.setName(operation.getName());
|
||||
}
|
||||
|
||||
public void input(Input input) throws WSDLException {
|
||||
BindingInput bindingInput = definition.createBindingInput();
|
||||
populateBindingInput(bindingInput, bindingOperation.getOperation().getInput());
|
||||
bindingOperation.setBindingInput(bindingInput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingInput} has been created. Subclasses can implement this method to define the name,
|
||||
* or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation set the name of the binding input to the name of the input.
|
||||
*
|
||||
* @param bindingInput the WSDL4J <code>BindingInput</code>
|
||||
* @param input the corresponding WSDL4J <code>Input</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingInput(BindingInput bindingInput, Input input) throws WSDLException {
|
||||
bindingInput.setName(input.getName());
|
||||
}
|
||||
|
||||
public void output(Output output) throws WSDLException {
|
||||
BindingOutput bindingOutput = definition.createBindingOutput();
|
||||
populateBindingOutput(bindingOutput, bindingOperation.getOperation().getOutput());
|
||||
bindingOperation.setBindingOutput(bindingOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingOutput} has been created. Subclasses can implement this method to define the name,
|
||||
* or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation set the name of the binding output to the name of the output.
|
||||
*
|
||||
* @param bindingOutput the WSDL4J <code>BindingOutput</code>
|
||||
* @param output the corresponding WSDL4J <code>Output</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingOutput(BindingOutput bindingOutput, Output output) throws WSDLException {
|
||||
bindingOutput.setName(output.getName());
|
||||
}
|
||||
|
||||
public void fault(Fault fault) throws WSDLException {
|
||||
BindingFault bindingFault = definition.createBindingFault();
|
||||
populateBindingFault(bindingFault, fault);
|
||||
bindingOperation.addBindingFault(bindingFault);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the {@link BindingFault} has been created. Subclasses can implement this method to define the name,
|
||||
* or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation set the name of the binding fault to the name of the fault.
|
||||
*
|
||||
* @param bindingFault the WSDL4J <code>BindingFault</code>
|
||||
* @param fault the corresponding WSDL4J <code>Fault</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateBindingFault(BindingFault bindingFault, Fault fault) throws WSDLException {
|
||||
bindingFault.setName(fault.getName());
|
||||
}
|
||||
|
||||
public void endOperation(Operation operation) throws WSDLException {
|
||||
binding.addBindingOperation(bindingOperation);
|
||||
bindingOperation = null;
|
||||
}
|
||||
|
||||
public void endDefinition(Definition definition) throws WSDLException {
|
||||
this.definition = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Binding;
|
||||
import javax.wsdl.BindingFault;
|
||||
import javax.wsdl.BindingInput;
|
||||
import javax.wsdl.BindingOperation;
|
||||
import javax.wsdl.BindingOutput;
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Fault;
|
||||
import javax.wsdl.Input;
|
||||
import javax.wsdl.Operation;
|
||||
import javax.wsdl.Output;
|
||||
import javax.wsdl.Port;
|
||||
import javax.wsdl.PortType;
|
||||
import javax.wsdl.Service;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class DefaultServiceVisitor implements PortTypeVisitor, BindingVisitor, DefinitionVisitor {
|
||||
|
||||
private Definition definition;
|
||||
|
||||
/** The suffix used to create a binding name from a port type name. */
|
||||
private static final String PORT_SUFFIX = "Port";
|
||||
|
||||
/** The suffix used to create a service name from a port type name. */
|
||||
private static final String SERVICE_SUFFIX = "Service";
|
||||
|
||||
private Service service;
|
||||
|
||||
public void startDefinition(Definition definition) throws WSDLException {
|
||||
this.definition = definition;
|
||||
this.service = this.definition.createService();
|
||||
}
|
||||
|
||||
public void startPortType(PortType portType) throws WSDLException {
|
||||
}
|
||||
|
||||
public void startOperation(Operation operation) throws WSDLException {
|
||||
}
|
||||
|
||||
public void input(Input input) throws WSDLException {
|
||||
}
|
||||
|
||||
public void output(Output output) throws WSDLException {
|
||||
}
|
||||
|
||||
public void fault(Fault fault) throws WSDLException {
|
||||
}
|
||||
|
||||
public void endOperation(Operation operation) throws WSDLException {
|
||||
}
|
||||
|
||||
public void endPortType(PortType portType) throws WSDLException {
|
||||
QName portTypeName = portType.getQName();
|
||||
QName serviceName = new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + SERVICE_SUFFIX);
|
||||
service.setQName(serviceName);
|
||||
}
|
||||
|
||||
public void startBinding(Binding binding) throws WSDLException {
|
||||
Port port = definition.createPort();
|
||||
port.setBinding(binding);
|
||||
populatePort(port, binding);
|
||||
service.addPort(port);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called after the {@link Port} has been created, but before any sub-elements are added. Subclasses can implement
|
||||
* this method to define the port name, or add extensions to it.
|
||||
* <p/>
|
||||
* Default implementation sets the port name to the port type name with the suffix {@link Port} appended to it.
|
||||
*
|
||||
* @param port the WSDL4J <code>Port</code>
|
||||
* @param binding the corresponding WSDL4J <code>Binding</code>
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populatePort(Port port, Binding binding) throws WSDLException {
|
||||
if (binding.getPortType() != null && binding.getPortType().getQName() != null) {
|
||||
port.setName(binding.getPortType().getQName().getLocalPart() + PORT_SUFFIX);
|
||||
}
|
||||
}
|
||||
|
||||
public void startBindingOperation(BindingOperation operation) throws WSDLException {
|
||||
}
|
||||
|
||||
public void bindingInput(BindingInput input) throws WSDLException {
|
||||
}
|
||||
|
||||
public void bindingOutput(BindingOutput output) throws WSDLException {
|
||||
}
|
||||
|
||||
public void bindingFault(BindingFault fault) throws WSDLException {
|
||||
}
|
||||
|
||||
public void endBindingOperation(BindingOperation operation) throws WSDLException {
|
||||
}
|
||||
|
||||
public void endBinding(Binding binding) throws WSDLException {
|
||||
}
|
||||
|
||||
public void endDefinition(Definition definition) throws WSDLException {
|
||||
this.definition.addService(service);
|
||||
this.definition = null;
|
||||
this.service = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface DefinitionVisitor {
|
||||
|
||||
void startDefinition(Definition definition) throws WSDLException;
|
||||
|
||||
void endDefinition(Definition definition) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Import;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface ImportVisitor {
|
||||
|
||||
void startImport(Import anImport) throws WSDLException;
|
||||
|
||||
void endImport(Import anImport) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Message;
|
||||
import javax.wsdl.Part;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface MessageVisitor {
|
||||
|
||||
void startMessage(Message message) throws WSDLException;
|
||||
|
||||
void part(Part part) throws WSDLException;
|
||||
|
||||
void endMessage(Message message) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Fault;
|
||||
import javax.wsdl.Input;
|
||||
import javax.wsdl.Operation;
|
||||
import javax.wsdl.Output;
|
||||
import javax.wsdl.PortType;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface PortTypeVisitor {
|
||||
|
||||
void startPortType(PortType portType) throws WSDLException;
|
||||
|
||||
void startOperation(Operation operation) throws WSDLException;
|
||||
|
||||
void input(Input input) throws WSDLException;
|
||||
|
||||
void output(Output output) throws WSDLException;
|
||||
|
||||
void fault(Fault fault) throws WSDLException;
|
||||
|
||||
void endOperation(Operation operation) throws WSDLException;
|
||||
|
||||
void endPortType(PortType portType) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Service;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.wsdl.Port;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface ServiceVisitor {
|
||||
|
||||
void startService(Service service) throws WSDLException;
|
||||
|
||||
void startPort(Port port) throws WSDLException;
|
||||
|
||||
void endPort(Port port) throws WSDLException;
|
||||
|
||||
void endService(Service service) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import javax.wsdl.Types;
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface TypesVisitor extends DefinitionVisitor {
|
||||
|
||||
void startTypes(Types types) throws WSDLException;
|
||||
|
||||
void endTypes(Types types) throws WSDLException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public interface WsdlVisitor {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright 2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.ws.commons.schema.XmlSchema;
|
||||
import org.apache.ws.commons.schema.XmlSchemaCollection;
|
||||
import org.apache.ws.commons.schema.XmlSchemaObjectTable;
|
||||
import org.apache.ws.commons.schema.XmlSchemaObject;
|
||||
import org.apache.ws.commons.schema.XmlSchemaSimpleType;
|
||||
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
|
||||
import org.apache.ws.commons.schema.XmlSchemaComplexType;
|
||||
import org.apache.ws.commons.schema.XmlSchemaSequence;
|
||||
import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
|
||||
import org.apache.ws.commons.schema.XmlSchemaElement;
|
||||
import org.apache.ws.commons.schema.XmlSchemaExternal;
|
||||
import org.apache.ws.commons.schema.XmlSchemaInclude;
|
||||
import org.apache.ws.commons.schema.XmlSchemaImport;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.xml.sax.SaxUtils;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class CommonXsdTest extends TestCase {
|
||||
|
||||
public void testIt() throws Exception {
|
||||
XmlSchemaCollection collection = new XmlSchemaCollection();
|
||||
Resource r = new ClassPathResource("A.xsd", getClass());
|
||||
XmlSchema schema = collection.read(SaxUtils.createInputSource(r), null);
|
||||
handleSchema(schema);
|
||||
schema.write(System.out);
|
||||
r = new ClassPathResource("D.xsd", getClass());
|
||||
schema = collection.read(SaxUtils.createInputSource(r), null);
|
||||
handleSchema(schema);
|
||||
schema.write(System.out);
|
||||
}
|
||||
|
||||
private void handleSchema(XmlSchema schema) {
|
||||
if ("http://www.w3.org/2001/XMLSchema".equals(schema.getTargetNamespace())) {
|
||||
return;
|
||||
}
|
||||
XmlSchemaObjectCollection includes = schema.getIncludes();
|
||||
for (int i = 0; i < includes.getCount(); i++) {
|
||||
XmlSchemaExternal external = (XmlSchemaExternal) includes.getItem(i);
|
||||
if (external instanceof XmlSchemaInclude) {
|
||||
XmlSchema includedSchema = external.getSchema();
|
||||
handleSchema(includedSchema);
|
||||
XmlSchemaObjectCollection includesItems = includedSchema.getItems();
|
||||
for (int j = 0; j < includesItems.getCount(); j++) {
|
||||
schema.getItems().add(includesItems.getItem(j));
|
||||
}
|
||||
// includes.remove(external);
|
||||
schema.getItems().remove(external);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpSchemaObject(XmlSchemaObject obj) {
|
||||
System.out.println(obj);
|
||||
if (obj instanceof XmlSchemaSimpleType) {
|
||||
XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) obj;
|
||||
XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) simpleType.getContent();
|
||||
System.out.println("simple type with base name " + restriction.getBaseTypeName());
|
||||
} else if (obj instanceof XmlSchemaComplexType) {
|
||||
XmlSchemaComplexType complexType = (XmlSchemaComplexType) obj;
|
||||
XmlSchemaSequence seq = (XmlSchemaSequence) complexType.getParticle();
|
||||
System.out.println("complex type containing sequence");
|
||||
XmlSchemaObjectCollection seqCol = seq.getItems();
|
||||
for (int j = 0; j < seqCol.getCount(); j++) {
|
||||
XmlSchemaElement element = (XmlSchemaElement) seqCol.getItem(j);
|
||||
dumpSchemaObject(element.getSchemaType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright ${YEAR} the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11;
|
||||
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import org.springframework.ws.wsdl.wsdl11.XsdSchemaWsdl11Definition;
|
||||
import org.springframework.xml.xsd.XsdSchema;
|
||||
import org.springframework.xml.xsd.SimpleXsdSchema;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
public class XsdSchemaWsdl11DefinitionTest extends TestCase {
|
||||
|
||||
private XsdSchemaWsdl11Definition definition;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
definition = new XsdSchemaWsdl11Definition();
|
||||
}
|
||||
|
||||
public void testDefinition() throws Exception {
|
||||
ClassPathResource resource = new ClassPathResource("A.xsd", getClass());
|
||||
definition.setSchemas(new Resource[] {resource});
|
||||
definition.setTargetNamespace("http://springframework.org/spring-ws");
|
||||
definition.afterPropertiesSet();
|
||||
Transformer tr = TransformerFactory.newInstance().newTransformer();
|
||||
tr.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
tr.transform(definition.getSource(), new StreamResult(System.out));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright ${YEAR} the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.soap;
|
||||
|
||||
import java.util.Properties;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class SoapWsdl11DefinitionTest extends TestCase {
|
||||
|
||||
private SoapWsdl11Definition definition;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
definition = new MySoapWsdl11Definition();
|
||||
}
|
||||
|
||||
public void testIt() throws Exception {
|
||||
definition.setBeanName("wsdlDefinition");
|
||||
definition.setTargetNamespace("http://springframework.org/spring-ws");
|
||||
definition.setServiceName("Service");
|
||||
definition.setLocationUri("http://localhost");
|
||||
definition.setCreateSoap11Binding(true);
|
||||
definition.setCreateSoap12Binding(true);
|
||||
Properties soapActions = new Properties();
|
||||
soapActions.setProperty("Operation", "http://springframework.org/spring-ws/Action");
|
||||
definition.setSoapActions(soapActions);
|
||||
definition.afterPropertiesSet();
|
||||
Transformer tr = TransformerFactory.newInstance().newTransformer();
|
||||
tr.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
tr.transform(definition.getSource(), new StreamResult(System.out));
|
||||
}
|
||||
|
||||
private static class MySoapWsdl11Definition extends SoapWsdl11Definition {
|
||||
|
||||
protected void addPortTypes(Document document, Element definitions) {
|
||||
Element portType = createWsdlElement(document, "portType");
|
||||
definitions.appendChild(portType);
|
||||
portType.setAttribute("name", "PortType");
|
||||
Element operation = createWsdlElement(document, "operation");
|
||||
portType.appendChild(operation);
|
||||
operation.setAttribute("name", "Operation");
|
||||
Element input = createWsdlElement(document, "input");
|
||||
operation.appendChild(input);
|
||||
// input.setAttribute("name", "Input");
|
||||
Element output = createWsdlElement(document, "output");
|
||||
operation.appendChild(output);
|
||||
// output.setAttribute("name", "Output");
|
||||
Element fault = createWsdlElement(document, "fault");
|
||||
operation.appendChild(fault);
|
||||
fault.setAttribute("name", "Fault");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright ${YEAR} the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.wsdl.wsdl11.visitor;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Fault;
|
||||
import javax.wsdl.Operation;
|
||||
import javax.wsdl.PortType;
|
||||
import javax.wsdl.factory.WSDLFactory;
|
||||
import javax.wsdl.xml.WSDLReader;
|
||||
import javax.wsdl.xml.WSDLWriter;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.xml.sax.SaxUtils;
|
||||
|
||||
import org.custommonkey.xmlunit.XMLTestCase;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class DefaultBindingVisitorTest extends XMLTestCase {
|
||||
|
||||
private DefaultBindingVisitor visitor;
|
||||
|
||||
private Definition definition;
|
||||
|
||||
private Definition expected;
|
||||
|
||||
private WSDLFactory factory;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
factory = WSDLFactory.newInstance();
|
||||
definition = factory.newDefinition();
|
||||
visitor = new DefaultBindingVisitor();
|
||||
WSDLReader reader = factory.newWSDLReader();
|
||||
definition = reader.readWSDL(null,
|
||||
SaxUtils.createInputSource(new ClassPathResource("defaultBindingVisitorTest-input.wsdl", getClass())));
|
||||
expected = reader.readWSDL(null,
|
||||
SaxUtils.createInputSource(new ClassPathResource("defaultBindingVisitorTest-expected.wsdl", getClass())));
|
||||
}
|
||||
|
||||
public void testDefaultBindingVisitor() throws Exception {
|
||||
visitor.startDefinition(definition);
|
||||
PortType portType = definition.getPortType(new QName("http://springframework.org/spring-ws", "PortType"));
|
||||
visitor.startPortType(portType);
|
||||
for (Iterator operationIter = portType.getOperations().iterator(); operationIter.hasNext();) {
|
||||
Operation operation = (Operation) operationIter.next();
|
||||
visitor.startOperation(operation);
|
||||
if (operation.getInput() != null) {
|
||||
visitor.input(operation.getInput());
|
||||
}
|
||||
if (operation.getOutput() != null) {
|
||||
visitor.output(operation.getOutput());
|
||||
}
|
||||
for (Iterator faultIter = operation.getFaults().values().iterator(); faultIter.hasNext();) {
|
||||
Fault fault = (Fault) faultIter.next();
|
||||
visitor.fault(fault);
|
||||
}
|
||||
visitor.endOperation(operation);
|
||||
}
|
||||
visitor.endPortType(portType);
|
||||
visitor.endDefinition(definition);
|
||||
|
||||
WSDLWriter writer = factory.newWSDLWriter();
|
||||
Document resultDocument = writer.getDocument(definition);
|
||||
Document expectedDocument = writer.getDocument(expected);
|
||||
assertXMLEqual("Invalid WSDL generated", expectedDocument, resultDocument);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:1"
|
||||
xmlns:tns="urn:1" elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified">
|
||||
<xsd:include schemaLocation="B.xsd"/>
|
||||
<xsd:simpleType name="A">
|
||||
<xsd:restriction base="tns:B"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,16 @@
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="urn:2" xmlns:tns="urn:1"
|
||||
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:1">
|
||||
<xsd:import namespace="urn:2" schemaLocation="D.xsd"/>
|
||||
<xsd:simpleType name="A">
|
||||
<xsd:restriction base="tns:B"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="B">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="c" type="tns:C"/>
|
||||
<xsd:element name="d" type="ns0:D"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:simpleType name="C">
|
||||
<xsd:restriction base="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:1"
|
||||
xmlns="urn:1"
|
||||
xmlns:imported="urn:2" elementFormDefault="qualified">
|
||||
<xsd:include schemaLocation="C.xsd"/>
|
||||
<xsd:import schemaLocation="D.xsd" namespace="urn:2"/>
|
||||
<xsd:complexType name="B">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="C" name="c"/>
|
||||
<xsd:element type="imported:D" name="d"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
<xsd:simpleType name="C">
|
||||
<xsd:restriction base="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:2"
|
||||
xmlns="urn:2" elementFormDefault="qualified">
|
||||
<xsd:include schemaLocation="C.xsd"/>
|
||||
<xsd:simpleType name="D">
|
||||
<xsd:restriction base="C"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.springframework.org/spring-ws/single/schema"
|
||||
xmlns="http://www.springframework.org/spring-ws/single/schema" elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified">
|
||||
|
||||
<xsd:simpleType name="customType">
|
||||
<xsd:restriction base="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:element name="GetOrderRequest">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="child" type="xsd:string"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="GetOrderResponse">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="child" type="xsd:string"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="GetOrderFault">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="child" type="xsd:string"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://springframework.org/spring-ws"
|
||||
name="wsdlDefinition"
|
||||
targetNamespace="http://springframework.org/spring-ws">
|
||||
<wsdl:portType name="PortType">
|
||||
<wsdl:operation name="Operation">
|
||||
<wsdl:input/>
|
||||
<wsdl:output/>
|
||||
<wsdl:fault name="Fault"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
</wsdl:definitions>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://springframework.org/spring-ws"
|
||||
targetNamespace="http://springframework.org/spring-ws">
|
||||
<wsdl:types>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified"
|
||||
targetNamespace="http://springframework.org/spring-ws">
|
||||
|
||||
<element name="Element" type="string"/>
|
||||
|
||||
</schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="Message">
|
||||
<wsdl:part element="tns:string" name="Message"/>
|
||||
</wsdl:message>
|
||||
<wsdl:portType name="PortType">
|
||||
<wsdl:operation name="OneWay">
|
||||
<wsdl:input message="tns:Message"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="RequestResponse">
|
||||
<wsdl:input message="tns:Message"/>
|
||||
<wsdl:output message="tns:Message"/>
|
||||
<wsdl:fault name="Fault" message="tns:Message"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding name="PortTypeBinding" type="tns:PortType">
|
||||
<wsdl:operation name="OneWay">
|
||||
<wsdl:input/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="RequestResponse">
|
||||
<wsdl:input/>
|
||||
<wsdl:output/>
|
||||
<wsdl:fault name="Fault"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
</wsdl:definitions>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://springframework.org/spring-ws"
|
||||
targetNamespace="http://springframework.org/spring-ws">
|
||||
<wsdl:types>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified"
|
||||
targetNamespace="http://springframework.org/spring-ws">
|
||||
|
||||
<element name="Element" type="string"/>
|
||||
|
||||
</schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="Message">
|
||||
<wsdl:part element="tns:string" name="Message"/>
|
||||
</wsdl:message>
|
||||
<wsdl:portType name="PortType">
|
||||
<wsdl:operation name="OneWay">
|
||||
<wsdl:input message="tns:Message"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="RequestResponse">
|
||||
<wsdl:input message="tns:Message"/>
|
||||
<wsdl:output message="tns:Message"/>
|
||||
<wsdl:fault name="Fault" message="tns:Message"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
</wsdl:definitions>
|
||||
Reference in New Issue
Block a user