This commit is contained in:
Arjen Poutsma
2007-10-29 01:51:40 +00:00
parent 433dd146df
commit 17196ebdb7
41 changed files with 908 additions and 1522 deletions

View File

@@ -33,8 +33,6 @@ import javax.wsdl.Service;
import javax.wsdl.WSDLException;
import javax.xml.namespace.QName;
import org.springframework.ws.wsdl.wsdl11.Wsdl4jDefinitionException;
/**
* 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>, and a service containing
@@ -73,19 +71,14 @@ public abstract class AbstractBindingWsdl4jDefinitionBuilder extends AbstractWsd
* @see #populateBindingFault(javax.wsdl.BindingFault,javax.wsdl.Fault)
*/
public void buildBindings(Definition definition) throws WSDLException {
try {
for (Iterator iterator = definition.getPortTypes().values().iterator(); iterator.hasNext();) {
PortType portType = (PortType) iterator.next();
Binding binding = definition.createBinding();
binding.setPortType(portType);
populateBinding(binding, portType);
createBindingOperations(definition, binding, portType);
binding.setUndefined(false);
definition.addBinding(binding);
}
}
catch (WSDLException ex) {
throw new Wsdl4jDefinitionException(ex);
for (Iterator iterator = definition.getPortTypes().values().iterator(); iterator.hasNext();) {
PortType portType = (PortType) iterator.next();
Binding binding = definition.createBinding();
binding.setPortType(portType);
populateBinding(binding, portType);
createBindingOperations(definition, binding, portType);
binding.setUndefined(false);
definition.addBinding(binding);
}
}

View File

@@ -18,6 +18,7 @@ package org.springframework.ws.wsdl.wsdl11.builder;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import javax.wsdl.Definition;
import javax.wsdl.Fault;
import javax.wsdl.Input;
@@ -42,10 +43,8 @@ import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition;
import org.springframework.xml.namespace.QNameUtils;
import org.springframework.xml.sax.SaxUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
@@ -83,14 +82,6 @@ import org.xml.sax.SAXException;
public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jDefinitionBuilder
implements InitializingBean {
/** The schema qualified name. */
private static final QName SCHEMA_NAME =
QNameUtils.createQName("http://www.w3.org/2001/XMLSchema", "schema", "xsd");
/** The schema import qualified name. */
private static final QName IMPORT_NAME =
QNameUtils.createQName("http://www.w3.org/2001/XMLSchema", "import", "xsd");
/** The default suffix used to detect request elements in the schema. */
public static final String DEFAULT_REQUEST_SUFFIX = "Request";
@@ -109,12 +100,12 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
/** The suffix used to create a service name from a port type name. */
public static final String SERVICE_SUFFIX = "Service";
private Resource schema;
private Resource schemaResource;
private XsdSchemaHelper schemaHelper;
private String schemaLocation;
private Element schemaElement;
private String targetNamespace;
private String portTypeName;
@@ -129,13 +120,7 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
private String faultSuffix = DEFAULT_FAULT_SUFFIX;
private String schemaTargetNamespace;
private static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
static {
documentBuilderFactory.setNamespaceAware(true);
}
private boolean followIncludeImport = false;
/**
* Sets the suffix used to detect request elements in the schema.
@@ -193,10 +178,10 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
}
/** Sets the XSD schema to use for generating the WSDL. */
public void setSchema(Resource schema) {
Assert.notNull(schema, "schema must not be empty or null");
Assert.isTrue(schema.exists(), "schema \"" + schema + "\" does not exit");
this.schema = schema;
public void setSchema(Resource schemaResource) {
Assert.notNull(schemaResource, "'schema' must not be null");
Assert.isTrue(schemaResource.exists(), "schema \"" + schemaResource + "\" does not exit");
this.schemaResource = schemaResource;
}
/**
@@ -208,39 +193,29 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
this.schemaLocation = schemaLocation;
}
/**
* Indicates whether schema <code>&lt;xsd:include/&gt;</code> and <code>&lt;xsd:import/&gt;</code> should be
* followed.
*/
public void setFollowIncludeImport(boolean followIncludeImport) {
this.followIncludeImport = followIncludeImport;
}
public final void afterPropertiesSet() throws IOException, ParserConfigurationException, SAXException {
Assert.notNull(schema, "schema is required");
Assert.notNull(portTypeName, "portTypeName is required");
parseSchema();
}
private void parseSchema() throws ParserConfigurationException, SAXException, IOException {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document schemaDocument = documentBuilder.parse(SaxUtils.createInputSource(schema));
schemaElement = schemaDocument.getDocumentElement();
Assert.isTrue(SCHEMA_NAME.getLocalPart().equals(schemaElement.getLocalName()),
"schema document root element has invalid local name : [" + schemaElement.getLocalName() +
"] instead of [schema]");
Assert.isTrue(SCHEMA_NAME.getNamespaceURI().equals(schemaElement.getNamespaceURI()),
"schema document root element has invalid namespace uri: [" + schemaElement.getNamespaceURI() +
"] instead of [" + SCHEMA_NAME.getNamespaceURI() + "]");
schemaTargetNamespace = getSchemaTargetNamespace();
Assert.hasLength(schemaTargetNamespace, "schema document has no targetNamespace");
Assert.notNull(schemaResource, "'schema' is required");
Assert.notNull(portTypeName, "'portTypeName' is required");
schemaHelper = new XsdSchemaHelper(schemaResource);
if (!StringUtils.hasLength(targetNamespace)) {
targetNamespace = schemaTargetNamespace;
targetNamespace = schemaHelper.getTargetNamespace();
}
}
private String getSchemaTargetNamespace() {
return schemaElement.getAttribute("targetNamespace");
}
/** Adds the target namespace and schema namespace to the definition. */
protected void populateDefinition(Definition definition) throws WSDLException {
super.populateDefinition(definition);
definition.setTargetNamespace(targetNamespace);
definition.addNamespace(schemaPrefix, getSchemaTargetNamespace());
if (!targetNamespace.equals(getSchemaTargetNamespace())) {
definition.addNamespace(schemaPrefix, schemaHelper.getTargetNamespace());
if (!targetNamespace.equals(schemaHelper.getTargetNamespace())) {
definition.addNamespace(prefix, targetNamespace);
}
}
@@ -259,28 +234,28 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
*/
protected void buildTypes(Definition definition) throws WSDLException {
Types types = definition.createTypes();
Schema schema;
Schema schema = (Schema) createExtension(Types.class, XsdSchemaHelper.SCHEMA_NAME);
if (!StringUtils.hasLength(schemaLocation)) {
schema = (Schema) createExtension(Types.class, QNameUtils.getQNameForNode(schemaElement));
schema.setElement(schemaElement);
schema.setElement(schemaHelper.getSchemaElement());
}
else {
schema = (Schema) createExtension(Types.class, SCHEMA_NAME);
Document document;
try {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.newDocument();
}
catch (ParserConfigurationException ex) {
throw new WSDLException(WSDLException.PARSER_ERROR, "Could not create DocumentBuilder", ex);
}
Element importingSchemaElement =
document.createElementNS(SCHEMA_NAME.getNamespaceURI(), QNameUtils.toQualifiedName(SCHEMA_NAME));
Element importingSchemaElement = document.createElementNS(XsdSchemaHelper.SCHEMA_NAME.getNamespaceURI(),
QNameUtils.toQualifiedName(XsdSchemaHelper.SCHEMA_NAME));
schema.setElement(importingSchemaElement);
Element importElement =
document.createElementNS(IMPORT_NAME.getNamespaceURI(), QNameUtils.toQualifiedName(IMPORT_NAME));
Element importElement = document.createElementNS(XsdSchemaHelper.IMPORT_NAME.getNamespaceURI(),
QNameUtils.toQualifiedName(XsdSchemaHelper.IMPORT_NAME));
importingSchemaElement.appendChild(importElement);
importElement.setAttribute("namespace", schemaTargetNamespace);
importElement.setAttribute("namespace", schemaHelper.getTargetNamespace());
importElement.setAttribute("schemaLocation", schemaLocation);
}
types.addExtensibilityElement(schema);
@@ -298,14 +273,23 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
* @see #isFaultMessage(javax.xml.namespace.QName)
*/
protected void buildMessages(Definition definition) throws WSDLException {
NodeList elements = schemaElement.getElementsByTagNameNS(SCHEMA_NAME.getNamespaceURI(), "element");
for (int i = 0; i < elements.getLength(); i++) {
Element element = (Element) elements.item(i);
QName elementName = getSchemaElementName(element);
List elementDeclarations = schemaHelper.getElementDeclarations(followIncludeImport);
for (Iterator iterator = elementDeclarations.iterator(); iterator.hasNext();) {
QName elementName = (QName) iterator.next();
if (elementName != null &&
(isRequestMessage(elementName) || isResponseMessage(elementName) || isFaultMessage(elementName))) {
if (!StringUtils.hasLength(definition.getPrefix(elementName.getNamespaceURI()))) {
int i = 0;
while (true) {
String prefix = schemaPrefix + Integer.toString(i);
if (!StringUtils.hasLength(definition.getNamespace(prefix))) {
definition.addNamespace(prefix, elementName.getNamespaceURI());
break;
}
}
}
Message message = definition.createMessage();
populateMessage(message, element);
populateMessage(message, elementName);
Part part = definition.createPart();
populatePart(part, elementName);
message.addPart(part);
@@ -356,12 +340,12 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
* <p/>
* Default implementation sets the name of the message to the element name.
*
* @param message the WSDL4J <code>Message</code>
* @param element the element
* @param message the WSDL4J <code>Message</code>
* @param elementName the element name
* @throws WSDLException in case of errors
*/
protected void populateMessage(Message message, Element element) {
message.setQName(new QName(targetNamespace, element.getAttribute("name")));
protected void populateMessage(Message message, QName elementName) throws WSDLException {
message.setQName(new QName(targetNamespace, elementName.getLocalPart()));
}
/**
@@ -374,7 +358,7 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
* @throws WSDLException in case of errors
* @see Part#setElementName(javax.xml.namespace.QName)
*/
protected void populatePart(Part part, QName elementName) {
protected void populatePart(Part part, QName elementName) throws WSDLException {
part.setElementName(elementName);
part.setName(elementName.getLocalPart());
}
@@ -514,21 +498,4 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jD
protected void populateService(Service service) throws WSDLException {
service.setQName(new QName(targetNamespace, portTypeName + SERVICE_SUFFIX));
}
/**
* Returns the qualified name of the element. This is a combination of schema target namespace and the value of the
* "name" attribute value.
*
* @param element an element
* @return the value of the name attribute
*/
private QName getSchemaElementName(Element element) {
String attributeValue = element.getAttribute("name");
if (StringUtils.hasLength(attributeValue)) {
return new QName(getSchemaTargetNamespace(), attributeValue);
}
else {
return null;
}
}
}

View File

@@ -0,0 +1,142 @@
/*
* 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.builder;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.xml.namespace.QNameUtils;
import org.springframework.xml.sax.SaxUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
* Helper class for dealing with XSD schemas. Exposes the target namespace, and the list of qualified names declared in
* a schema.
*
* @author Arjen Poutsma
* @since 1.0.2
*/
class XsdSchemaHelper {
private static final Log logger = LogFactory.getLog(XsdSchemaHelper.class);
private static final String SCHEMA_NAMESPACE = "http://www.w3.org/2001/XMLSchema";
static final QName SCHEMA_NAME = QNameUtils.createQName(SCHEMA_NAMESPACE, "schema", "xsd");
static final QName ELEMENT_NAME = QNameUtils.createQName(SCHEMA_NAMESPACE, "element", "xsd");
static final QName INCLUDE_NAME = QNameUtils.createQName(SCHEMA_NAMESPACE, "include", "xsd");
static final QName IMPORT_NAME = QNameUtils.createQName(SCHEMA_NAMESPACE, "import", "xsd");
private final Resource schemaResource;
private final Element schemaElement;
private static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
static {
documentBuilderFactory.setNamespaceAware(true);
}
public XsdSchemaHelper(Resource schemaResource) throws ParserConfigurationException, IOException, SAXException {
Assert.notNull(schemaResource, "schema must not be empty or null");
Assert.isTrue(schemaResource.exists(), "schema \"" + schemaResource + "\" does not exit");
this.schemaResource = schemaResource;
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document schemaDocument = documentBuilder.parse(SaxUtils.createInputSource(schemaResource));
schemaElement = schemaDocument.getDocumentElement();
Assert.isTrue(SCHEMA_NAME.getLocalPart().equals(schemaElement.getLocalName()),
"schema document root element has invalid local name : [" + schemaElement.getLocalName() +
"] instead of [schema]");
Assert.isTrue(SCHEMA_NAME.getNamespaceURI().equals(schemaElement.getNamespaceURI()),
"schema document root element has invalid namespace uri: [" + schemaElement.getNamespaceURI() +
"] instead of [" + SCHEMA_NAME.getNamespaceURI() + "]");
Assert.hasLength(getTargetNamespace(), "schema [" + schemaResource + "] has no targetNamespace");
}
public String getTargetNamespace() {
return schemaElement.getAttribute("targetNamespace");
}
public Element getSchemaElement() {
return schemaElement;
}
public List getElementDeclarations(boolean followIncludeImport) {
List declarations = new ArrayList();
getElementDeclarationsInternal(declarations, followIncludeImport);
return declarations;
}
private void getElementDeclarationsInternal(List declarations, boolean followIncludeImport) {
NodeList children = schemaElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
Element childElement = (Element) children.item(i);
QName childName = QNameUtils.getQNameForNode(childElement);
if (ELEMENT_NAME.equals(childName)) {
declarations.add(getElementName(childElement));
}
else if (followIncludeImport) {
if (INCLUDE_NAME.equals(childName) || IMPORT_NAME.equals(childName)) {
String schemaLocation = childElement.getAttribute("schemaLocation");
if (StringUtils.hasLength(schemaLocation)) {
try {
Resource resource = schemaResource.createRelative(schemaLocation);
if (resource.exists()) {
XsdSchemaHelper helper = new XsdSchemaHelper(resource);
helper.getElementDeclarationsInternal(declarations, followIncludeImport);
}
else {
logger.warn("Imported/Includes schema with location " + schemaLocation +
" does not exist");
}
}
catch (Exception ex) {
logger.warn(ex);
// ignore
}
}
}
}
}
}
}
private QName getElementName(Element element) {
String attributeValue = element.getAttribute("name");
return StringUtils.hasLength(attributeValue) ? new QName(getTargetNamespace(), attributeValue) : null;
}
}

View File

@@ -34,15 +34,17 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilderTest extends XMLTestCase {
private Transformer transformer;
private DocumentBuilder documentBuilder;
protected void setUp() throws Exception {
builder = new XsdBasedSoap11Wsdl4jDefinitionBuilder();
builder.setSchema(new ClassPathResource("schema.xsd", getClass()));
builder.setPortTypeName("Airline");
builder.setTargetNamespace("http://www.springframework.org/spring-ws/wsdl/definitions");
builder.setLocationUri("http://localhost:8080/");
builder.afterPropertiesSet();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformer = transformerFactory.newTransformer();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
documentBuilder = documentBuilderFactory.newDocumentBuilder();
XMLUnit.setIgnoreWhitespace(true);
}
public void testNonExistingSchema() throws Exception {
@@ -55,30 +57,94 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilderTest extends XMLTestCase {
}
}
public void testInline() throws Exception {
builder.buildDefinition();
builder.buildImports();
builder.buildTypes();
builder.buildMessages();
builder.buildPortTypes();
builder.buildBindings();
builder.buildServices();
public void testSingle() throws Exception {
builder.setSchema(new ClassPathResource("single.xsd", getClass()));
builder.setPortTypeName("Order");
builder.setTargetNamespace("http://www.springframework.org/spring-ws/single/definitions");
builder.afterPropertiesSet();
buildAll();
Wsdl11Definition definition = builder.getDefinition();
DOMResult domResult = new DOMResult();
transformer.transform(definition.getSource(), domResult);
Document result = (Document) domResult.getNode();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document expected = documentBuilder.parse(getClass().getResourceAsStream("inline.wsdl"));
Document expected = documentBuilder.parse(getClass().getResourceAsStream("single-inline.wsdl"));
assertXMLEqual("Invalid WSDL built", expected, result);
}
public void testSingleImport() throws Exception {
builder.setSchema(new ClassPathResource("single.xsd", getClass()));
builder.setSchemaLocation("single.xsd");
builder.setPortTypeName("Order");
builder.setTargetNamespace("http://www.springframework.org/spring-ws/single/definitions");
builder.afterPropertiesSet();
buildAll();
Wsdl11Definition definition = builder.getDefinition();
DOMResult domResult = new DOMResult();
transformer.transform(definition.getSource(), domResult);
Document result = (Document) domResult.getNode();
Document expected = documentBuilder.parse(getClass().getResourceAsStream("single-import.wsdl"));
assertXMLEqual("Invalid WSDL built", expected, result);
}
public void testFollowIncluding() throws Exception {
builder.setSchema(new ClassPathResource("including.xsd", getClass()));
builder.setPortTypeName("Order");
builder.setTargetNamespace("http://www.springframework.org/spring-ws/include/definitions");
builder.setFollowIncludeImport(true);
builder.afterPropertiesSet();
buildAll();
Wsdl11Definition definition = builder.getDefinition();
DOMResult domResult = new DOMResult();
transformer.transform(definition.getSource(), domResult);
Document result = (Document) domResult.getNode();
Document expected = documentBuilder.parse(getClass().getResourceAsStream("include-inline.wsdl"));
assertXMLEqual("Invalid WSDL built", expected, result);
}
public void testFollowImport() throws Exception {
builder.setSchema(new ClassPathResource("importing.xsd", getClass()));
builder.setPortTypeName("Order");
builder.setTargetNamespace("http://www.springframework.org/spring-ws/import/definitions");
builder.setFollowIncludeImport(true);
builder.afterPropertiesSet();
buildAll();
Wsdl11Definition definition = builder.getDefinition();
DOMResult domResult = new DOMResult();
transformer.transform(definition.getSource(), domResult);
Document result = (Document) domResult.getNode();
Document expected = documentBuilder.parse(getClass().getResourceAsStream("import-inline.wsdl"));
assertXMLEqual("Invalid WSDL built", expected, result);
}
public void testAirline() throws Exception {
builder.setSchema(new ClassPathResource("airline.xsd", getClass()));
builder.setPortTypeName("Airline");
builder.setTargetNamespace("http://www.springframework.org/spring-ws/samples/airline/definitions");
builder.afterPropertiesSet();
buildAll();
Wsdl11Definition definition = builder.getDefinition();
DOMResult domResult = new DOMResult();
transformer.transform(definition.getSource(), domResult);
Document result = (Document) domResult.getNode();
Document expected = documentBuilder.parse(getClass().getResourceAsStream("airline.wsdl"));
XMLUnit.setIgnoreWhitespace(true);
assertXMLEqual("Invalid WSDL built", expected, result);
}
public void testImport() throws Exception {
builder.setSchemaLocation("schema.xsd");
builder.buildDefinition();
private void buildAll() {
builder.buildDefinition();
builder.buildImports();
builder.buildTypes();
@@ -86,17 +152,6 @@ public class XsdBasedSoap11Wsdl4jDefinitionBuilderTest extends XMLTestCase {
builder.buildPortTypes();
builder.buildBindings();
builder.buildServices();
Wsdl11Definition definition = builder.getDefinition();
DOMResult domResult = new DOMResult();
transformer.transform(definition.getSource(), domResult);
Document result = (Document) domResult.getNode();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document expected = documentBuilder.parse(getClass().getResourceAsStream("import.wsdl"));
XMLUnit.setIgnoreWhitespace(true);
assertXMLEqual("Invalid WSDL built", expected, result);
}

View File

@@ -0,0 +1,99 @@
/*
* 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.builder;
import java.util.List;
import javax.xml.namespace.QName;
import junit.framework.TestCase;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
public class XsdSchemaHelperTest extends TestCase {
public void testSingle() throws Exception {
Resource resource = new ClassPathResource("single.xsd", getClass());
XsdSchemaHelper helper = new XsdSchemaHelper(resource);
assertEquals("Invalid target namespace", "http://www.springframework.org/spring-ws/single/schema",
helper.getTargetNamespace());
List elementDeclarations = helper.getElementDeclarations(true);
assertEquals("Invalid amount of elements", 3, elementDeclarations.size());
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/single/schema", "GetOrderRequest"),
elementDeclarations.get(0));
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/single/schema", "GetOrderResponse"),
elementDeclarations.get(1));
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/single/schema", "GetOrderFault"),
elementDeclarations.get(2));
}
public void testFollowInclude() throws Exception {
Resource resource = new ClassPathResource("including.xsd", getClass());
XsdSchemaHelper helper = new XsdSchemaHelper(resource);
assertEquals("Invalid target namespace", "http://www.springframework.org/spring-ws/include/schema",
helper.getTargetNamespace());
List elementDeclarations = helper.getElementDeclarations(true);
assertEquals("Invalid amount of elements", 2, elementDeclarations.size());
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/include/schema", "GetOrderResponse"),
elementDeclarations.get(0));
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/include/schema", "GetOrderRequest"),
elementDeclarations.get(1));
}
public void testNotFollowInclude() throws Exception {
Resource resource = new ClassPathResource("including.xsd", getClass());
XsdSchemaHelper helper = new XsdSchemaHelper(resource);
assertEquals("Invalid target namespace", "http://www.springframework.org/spring-ws/include/schema",
helper.getTargetNamespace());
List elementDeclarations = helper.getElementDeclarations(false);
assertEquals("Invalid amount of elements", 1, elementDeclarations.size());
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/include/schema", "GetOrderRequest"),
elementDeclarations.get(0));
}
public void testFollowImport() throws Exception {
Resource resource = new ClassPathResource("importing.xsd", getClass());
XsdSchemaHelper helper = new XsdSchemaHelper(resource);
assertEquals("Invalid target namespace", "http://www.springframework.org/spring-ws/importing/schema",
helper.getTargetNamespace());
List elementDeclarations = helper.getElementDeclarations(true);
assertEquals("Invalid amount of elements", 2, elementDeclarations.size());
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/imported/schema", "GetOrderResponse"),
elementDeclarations.get(0));
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/importing/schema", "GetOrderRequest"),
elementDeclarations.get(1));
}
public void testNotFollowImport() throws Exception {
Resource resource = new ClassPathResource("importing.xsd", getClass());
XsdSchemaHelper helper = new XsdSchemaHelper(resource);
assertEquals("Invalid target namespace", "http://www.springframework.org/spring-ws/importing/schema",
helper.getTargetNamespace());
List elementDeclarations = helper.getElementDeclarations(false);
assertEquals("Invalid amount of elements", 1, elementDeclarations.size());
assertEquals("Invalid element declaration name",
new QName("http://www.springframework.org/spring-ws/importing/schema", "GetOrderRequest"),
elementDeclarations.get(0));
}
}

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:schema="http://www.springframework.org/spring-ws/samples/airline/schemas"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.springframework.org/spring-ws/samples/airline/definitions"
targetNamespace="http://www.springframework.org/spring-ws/samples/airline/definitions">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.springframework.org/spring-ws/samples/airline/schemas"
elementFormDefault="qualified"
targetNamespace="http://www.springframework.org/spring-ws/samples/airline/schemas">
<element name="GetFlightsRequest">
<complexType>
<all>
<element name="from" type="tns:AirportCode"/>
<element name="to" type="tns:AirportCode"/>
<element name="departureDate" type="date"/>
<element minOccurs="0" name="serviceClass" type="tns:ServiceClass"/>
</all>
</complexType>
</element>
<element name="GetFlightsResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="flight" type="tns:Flight"/>
</sequence>
</complexType>
</element>
<element name="GetFlightsFault">
<complexType>
<sequence>
<element name="errorCode" type="string"/>
</sequence>
</complexType>
</element>
<element name="BookFlightRequest">
<complexType>
<all>
<element name="flightNumber" type="tns:FlightNumber"/>
<element name="departureTime" type="dateTime"/>
<element name="passengers">
<complexType>
<choice maxOccurs="9">
<element name="passenger" type="tns:Name"/>
<element name="username" type="tns:FrequentFlyerUsername"/>
</choice>
</complexType>
</element>
</all>
</complexType>
</element>
<element name="BookFlightResponse" type="tns:Ticket"/>
<element name="GetFrequentFlyerMileageRequest"/>
<element name="GetFrequentFlyerMileageResponse" type="int"/>
<complexType name="Flight">
<sequence>
<element name="number" type="tns:FlightNumber"/>
<element name="departureTime" type="dateTime"/>
<element name="from" type="tns:Airport"/>
<element name="arrivalTime" type="dateTime"/>
<element name="to" type="tns:Airport"/>
<element name="serviceClass" type="tns:ServiceClass"/>
</sequence>
</complexType>
<simpleType name="FlightNumber">
<restriction base="string">
<pattern value="[A-Z][A-Z][0-9][0-9][0-9][0-9]"/>
</restriction>
</simpleType>
<complexType name="Name">
<sequence>
<element name="first" type="string"/>
<element name="last" type="string"/>
</sequence>
</complexType>
<simpleType name="FrequentFlyerUsername">
<restriction base="string"/>
</simpleType>
<complexType name="Airport">
<all>
<element name="code" type="tns:AirportCode"/>
<element name="name" type="string"/>
<element name="city" type="string"/>
</all>
</complexType>
<simpleType name="AirportCode">
<restriction base="string">
<pattern value="[A-Z][A-Z][A-Z]"/>
</restriction>
</simpleType>
<complexType name="Ticket">
<all>
<element name="id" type="long"/>
<element name="issueDate" type="date"/>
<element name="passengers">
<complexType>
<sequence>
<element maxOccurs="9" name="passenger" type="tns:Name"/>
</sequence>
</complexType>
</element>
<element name="flight" type="tns:Flight"/>
</all>
</complexType>
<simpleType name="ServiceClass">
<restriction base="NCName">
<enumeration value="economy"/>
<enumeration value="business"/>
<enumeration value="first"/>
</restriction>
</simpleType>
</schema>
</wsdl:types>
<wsdl:message name="GetFlightsRequest">
<wsdl:part element="schema:GetFlightsRequest" name="GetFlightsRequest"/>
</wsdl:message>
<wsdl:message name="BookFlightRequest">
<wsdl:part element="schema:BookFlightRequest" name="BookFlightRequest"/>
</wsdl:message>
<wsdl:message name="GetFlightsResponse">
<wsdl:part element="schema:GetFlightsResponse" name="GetFlightsResponse"/>
</wsdl:message>
<wsdl:message name="GetFlightsFault">
<wsdl:part element="schema:GetFlightsFault" name="GetFlightsFault"/>
</wsdl:message>
<wsdl:message name="GetFrequentFlyerMileageRequest">
<wsdl:part element="schema:GetFrequentFlyerMileageRequest" name="GetFrequentFlyerMileageRequest"/>
</wsdl:message>
<wsdl:message name="GetFrequentFlyerMileageResponse">
<wsdl:part element="schema:GetFrequentFlyerMileageResponse" name="GetFrequentFlyerMileageResponse"/>
</wsdl:message>
<wsdl:message name="BookFlightResponse">
<wsdl:part element="schema:BookFlightResponse" name="BookFlightResponse"/>
</wsdl:message>
<wsdl:portType name="Airline">
<wsdl:operation name="GetFlights">
<wsdl:input message="tns:GetFlightsRequest" name="GetFlightsRequest"/>
<wsdl:output message="tns:GetFlightsResponse" name="GetFlightsResponse"/>
<wsdl:fault message="tns:GetFlightsFault" name="GetFlightsFault"/>
</wsdl:operation>
<wsdl:operation name="BookFlight">
<wsdl:input message="tns:BookFlightRequest" name="BookFlightRequest"/>
<wsdl:output message="tns:BookFlightResponse" name="BookFlightResponse"/>
</wsdl:operation>
<wsdl:operation name="GetFrequentFlyerMileage">
<wsdl:input message="tns:GetFrequentFlyerMileageRequest" name="GetFrequentFlyerMileageRequest"/>
<wsdl:output message="tns:GetFrequentFlyerMileageResponse" name="GetFrequentFlyerMileageResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AirlineBinding" type="tns:Airline">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetFlights">
<soap:operation soapAction=""/>
<wsdl:input name="GetFlightsRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetFlightsResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="GetFlightsFault">
<soap:fault name="GetFlightsFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="BookFlight">
<soap:operation soapAction=""/>
<wsdl:input name="BookFlightRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="BookFlightResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetFrequentFlyerMileage">
<soap:operation soapAction=""/>
<wsdl:input name="GetFrequentFlyerMileageRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetFrequentFlyerMileageResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AirlineService">
<wsdl:port binding="tns:AirlineBinding" name="AirlinePort">
<soap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:schema="http://www.springframework.org/spring-ws/importing/schema"
xmlns:schema0="http://www.springframework.org/spring-ws/imported/schema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.springframework.org/spring-ws/import/definitions"
targetNamespace="http://www.springframework.org/spring-ws/import/definitions">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/spring-ws/importing/schema"
xmlns="http://www.springframework.org/spring-ws/importing/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/spring-ws/imported/schema"
schemaLocation="imported.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetOrderResponse">
<wsdl:part name="GetOrderResponse" element="schema0:GetOrderResponse"/>
</wsdl:message>
<wsdl:message name="GetOrderRequest">
<wsdl:part name="GetOrderRequest" element="schema:GetOrderRequest"/>
</wsdl:message>
<wsdl:portType name="Order">
<wsdl:operation name="GetOrder">
<wsdl:input message="tns:GetOrderRequest" name="GetOrderRequest"/>
<wsdl:output message="tns:GetOrderResponse" name="GetOrderResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OrderBinding" type="tns:Order">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetOrder">
<soap:operation soapAction=""/>
<wsdl:input name="GetOrderRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetOrderResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrderService">
<wsdl:port binding="tns:OrderBinding" name="OrderPort">
<soap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:schema="http://www.springframework.org/spring-ws/samples/airline/schemas"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.springframework.org/spring-ws/wsdl/definitions"
targetNamespace="http://www.springframework.org/spring-ws/wsdl/definitions">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://www.springframework.org/spring-ws/samples/airline/schemas"
schemaLocation="schema.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="GetFrequentFlyerMileageResponse">
<wsdl:part element="schema:GetFrequentFlyerMileageResponse" name="GetFrequentFlyerMileageResponse"/>
</wsdl:message>
<wsdl:message name="BookFlightResponse">
<wsdl:part element="schema:BookFlightResponse" name="BookFlightResponse"/>
</wsdl:message>
<wsdl:message name="GetFlightsRequest">
<wsdl:part element="schema:GetFlightsRequest" name="GetFlightsRequest"/>
</wsdl:message>
<wsdl:message name="GetFlightsFault">
<wsdl:part element="schema:GetFlightsFault" name="GetFlightsFault"/>
</wsdl:message>
<wsdl:message name="GetFrequentFlyerMileageRequest">
<wsdl:part element="schema:GetFrequentFlyerMileageRequest" name="GetFrequentFlyerMileageRequest"/>
</wsdl:message>
<wsdl:message name="GetFlightsResponse">
<wsdl:part element="schema:GetFlightsResponse" name="GetFlightsResponse"/>
</wsdl:message>
<wsdl:message name="BookFlightRequest">
<wsdl:part element="schema:BookFlightRequest" name="BookFlightRequest"/>
</wsdl:message>
<wsdl:portType name="Airline">
<wsdl:operation name="GetFlights">
<wsdl:input message="tns:GetFlightsRequest" name="GetFlightsRequest"/>
<wsdl:output message="tns:GetFlightsResponse" name="GetFlightsResponse"/>
<wsdl:fault message="tns:GetFlightsFault" name="GetFlightsFault"/>
</wsdl:operation>
<wsdl:operation name="GetFrequentFlyerMileage">
<wsdl:input message="tns:GetFrequentFlyerMileageRequest" name="GetFrequentFlyerMileageRequest"/>
<wsdl:output message="tns:GetFrequentFlyerMileageResponse" name="GetFrequentFlyerMileageResponse"/>
</wsdl:operation>
<wsdl:operation name="BookFlight">
<wsdl:input message="tns:BookFlightRequest" name="BookFlightRequest"/>
<wsdl:output message="tns:BookFlightResponse" name="BookFlightResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AirlineBinding" type="tns:Airline">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetFlights">
<soap:operation soapAction=""/>
<wsdl:input name="GetFlightsRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetFlightsResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="GetFlightsFault">
<soap:fault name="GetFlightsFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="GetFrequentFlyerMileage">
<soap:operation soapAction=""/>
<wsdl:input name="GetFrequentFlyerMileageRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetFrequentFlyerMileageResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="BookFlight">
<soap:operation soapAction=""/>
<wsdl:input name="BookFlightRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="BookFlightResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AirlineService">
<wsdl:port binding="tns:AirlineBinding" name="AirlinePort">
<soap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/spring-ws/imported/schema"
xmlns="http://www.springframework.org/spring-ws/imported/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/spring-ws/importing/schema"
xmlns="http://www.springframework.org/spring-ws/importing/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/spring-ws/imported/schema" schemaLocation="imported.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:schema="http://www.springframework.org/spring-ws/include/schema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.springframework.org/spring-ws/include/definitions"
targetNamespace="http://www.springframework.org/spring-ws/include/definitions">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/spring-ws/include/schema"
xmlns="http://www.springframework.org/spring-ws/include/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="included.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetOrderResponse">
<wsdl:part name="GetOrderResponse" element="schema:GetOrderResponse"/>
</wsdl:message>
<wsdl:message name="GetOrderRequest">
<wsdl:part name="GetOrderRequest" element="schema:GetOrderRequest"/>
</wsdl:message>
<wsdl:portType name="Order">
<wsdl:operation name="GetOrder">
<wsdl:input message="tns:GetOrderRequest" name="GetOrderRequest"/>
<wsdl:output message="tns:GetOrderResponse" name="GetOrderResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OrderBinding" type="tns:Order">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetOrder">
<soap:operation soapAction=""/>
<wsdl:input name="GetOrderRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetOrderResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrderService">
<wsdl:port binding="tns:OrderBinding" name="OrderPort">
<soap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/spring-ws/include/schema"
xmlns="http://www.springframework.org/spring-ws/include/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:element name="GetOrderResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/spring-ws/include/schema"
xmlns="http://www.springframework.org/spring-ws/include/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="included.xsd"/>
<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:schema="http://www.springframework.org/spring-ws/single/schema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.springframework.org/spring-ws/single/definitions"
targetNamespace="http://www.springframework.org/spring-ws/single/definitions">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.springframework.org/spring-ws/single/schema" schemaLocation="single.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetOrderResponse">
<wsdl:part name="GetOrderResponse" element="schema:GetOrderResponse"/>
</wsdl:message>
<wsdl:message name="GetOrderRequest">
<wsdl:part name="GetOrderRequest" element="schema:GetOrderRequest"/>
</wsdl:message>
<wsdl:message name="GetOrderFault">
<wsdl:part name="GetOrderFault" element="schema:GetOrderFault"/>
</wsdl:message>
<wsdl:portType name="Order">
<wsdl:operation name="GetOrder">
<wsdl:input message="tns:GetOrderRequest" name="GetOrderRequest"/>
<wsdl:output message="tns:GetOrderResponse" name="GetOrderResponse"/>
<wsdl:fault message="tns:GetOrderFault" name="GetOrderFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OrderBinding" type="tns:Order">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetOrder">
<soap:operation soapAction=""/>
<wsdl:input name="GetOrderRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetOrderResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="GetOrderFault">
<soap:fault name="GetOrderFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrderService">
<wsdl:port binding="tns:OrderBinding" name="OrderPort">
<soap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:schema="http://www.springframework.org/spring-ws/single/schema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.springframework.org/spring-ws/single/definitions"
targetNamespace="http://www.springframework.org/spring-ws/single/definitions">
<wsdl:types>
<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>
</wsdl:types>
<wsdl:message name="GetOrderResponse">
<wsdl:part name="GetOrderResponse" element="schema:GetOrderResponse"/>
</wsdl:message>
<wsdl:message name="GetOrderRequest">
<wsdl:part name="GetOrderRequest" element="schema:GetOrderRequest"/>
</wsdl:message>
<wsdl:message name="GetOrderFault">
<wsdl:part name="GetOrderFault" element="schema:GetOrderFault"/>
</wsdl:message>
<wsdl:portType name="Order">
<wsdl:operation name="GetOrder">
<wsdl:input message="tns:GetOrderRequest" name="GetOrderRequest"/>
<wsdl:output message="tns:GetOrderResponse" name="GetOrderResponse"/>
<wsdl:fault message="tns:GetOrderFault" name="GetOrderFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OrderBinding" type="tns:Order">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetOrder">
<soap:operation soapAction=""/>
<wsdl:input name="GetOrderRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="GetOrderResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="GetOrderFault">
<soap:fault name="GetOrderFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrderService">
<wsdl:port binding="tns:OrderBinding" name="OrderPort">
<soap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@@ -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>