diff --git a/core/pom.xml b/core/pom.xml
index 0327a4d9..bd3d7de9 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -171,10 +171,22 @@
Wsdl11Definition that creates a WSDL definition at runtime, using a {@link Wsdl11DefinitionBuilder}. Can
- * be instructed to build abstract or concrete parts of the definition, by setting the buildAbstractPart
- * and buildConcretePart properties.
- *
- * @author Arjen Poutsma
- * @see #setBuilder(Wsdl11DefinitionBuilder)
- * @see #setBuildAbstractPart(boolean)
- * @see #setBuildConcretePart(boolean)
- * @since 1.0.0
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-public class DynamicWsdl11Definition implements Wsdl11Definition, InitializingBean {
-
- private Wsdl11DefinitionBuilder builder;
-
- private Wsdl11Definition definition;
-
- private boolean buildAbstractPart = true;
-
- private boolean buildConcretePart = true;
-
- public void setBuilder(Wsdl11DefinitionBuilder builder) {
- this.builder = builder;
- }
-
- /**
- * Indicates whether the built definition should contain an abstract part. If set to true (the default)
- * the definition will contain types, messages, and portTypes; if false, it will not.
- */
- public void setBuildAbstractPart(boolean buildAbstractPart) {
- this.buildAbstractPart = buildAbstractPart;
- }
-
- /**
- * Indicates whether the built definition should contain an concrete part. If set to true (the default)
- * the definition will contain bindings, and services; if false, it will not.
- */
- public void setBuildConcretePart(boolean buildConcretePart) {
- this.buildConcretePart = buildConcretePart;
- }
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(builder, "builder is required");
- builder.buildDefinition();
- builder.buildImports();
- if (buildAbstractPart) {
- builder.buildTypes();
- builder.buildMessages();
- builder.buildPortTypes();
- }
- if (buildConcretePart) {
- builder.buildBindings();
- builder.buildServices();
- }
- definition = builder.getDefinition();
- }
-
- public Source getSource() {
- return definition.getSource();
- }
-
- public String toString() {
- if (definition != null) {
- return definition.toString();
- }
- else {
- return "DynamicWsdl11Definition";
- }
- }
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/Wsdl11DefinitionBuilder.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/Wsdl11DefinitionBuilder.java
deleted file mode 100644
index acac5b60..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/Wsdl11DefinitionBuilder.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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;
-
-import org.springframework.ws.wsdl.WsdlDefinitionException;
-
-/**
- * Defines the contract for classes that can create a {@link Wsdl11Definition} at runtime.
- *
Wsdl11Definition.
- *
- * @return the WSDL definition, or null if {@link #buildDefinition()} has not been called
- * @throws WsdlDefinitionException in case of errors
- */
- Wsdl11Definition getDefinition() throws WsdlDefinitionException;
-
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractBindingWsdl4jDefinitionBuilder.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractBindingWsdl4jDefinitionBuilder.java
deleted file mode 100644
index 9aa94557..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractBindingWsdl4jDefinitionBuilder.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright 2005-2010 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.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.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLException;
-import javax.xml.namespace.QName;
-
-/**
- * Abstract base class for Wsdl11DefinitionBuilder implementations that use WSDL4J and contain a concrete
- * part. Creates a binding that matches any present portType, and a service containing
- * ports that match the bindings. Lets subclasses populate these through template methods.
- *
- * @author Arjen Poutsma
- * @since 1.0.0
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-public abstract class AbstractBindingWsdl4jDefinitionBuilder extends AbstractWsdl4jDefinitionBuilder {
-
- /** The suffix used to create a binding name from a port type name. */
- private static final String BINDING_SUFFIX = "Binding";
-
- /** The suffix used to create a binding name from a port type name. */
- private static final String PORT_SUFFIX = "Port";
-
- /**
- * Creates a {@link Binding} for each {@link PortType} in the definition, and calls {@link #populateBinding(Binding,
- * PortType)} 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.
- *
- * Calls the various populate methods with the created WSDL4J objects.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- * @see #populateBinding(Binding, PortType)
- * @see #populateBindingOperation(BindingOperation, Operation)
- * @see #populateBindingInput(BindingInput, Input)
- * @see #populateBindingOutput(BindingOutput, Output)
- * @see #populateBindingFault(BindingFault, Fault)
- */
- @Override
- public void buildBindings(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(binding, portType);
- 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
- * implement this method to define the binding name, or add extensions to it.
- *
- * Default implementation sets the binding name to the port type name with the suffix {@link Binding} appended to
- * it.
- *
- * @param binding the WSDL4J Binding
- * @param portType the corresponding PortType
- * @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() + BINDING_SUFFIX));
- }
- }
-
- 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(bindingOperation, operation);
- 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(bindingFault, fault);
- bindingOperation.addBindingFault(bindingFault);
- }
- binding.addBindingOperation(bindingOperation);
- }
- }
-
- private void createBindingOutput(Definition definition, Operation operation, BindingOperation bindingOperation)
- throws WSDLException {
- BindingOutput bindingOutput = definition.createBindingOutput();
- populateBindingOutput(bindingOutput, operation.getOutput());
- bindingOperation.setBindingOutput(bindingOutput);
- }
-
- private void createBindingInput(Definition definition, Operation operation, BindingOperation bindingOperation)
- throws WSDLException {
- BindingInput bindingInput = definition.createBindingInput();
- populateBindingInput(bindingInput, operation.getInput());
- bindingOperation.setBindingInput(bindingInput);
- }
-
- /**
- * 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.
- *
- * Default implementation sets the name of the binding operation to the name of the operation.
- *
- * @param bindingOperation the WSDL4J BindingOperation
- * @param operation the corresponding WSDL4J Operation
- * @throws WSDLException in case of errors
- */
- protected void populateBindingOperation(BindingOperation bindingOperation, Operation operation)
- throws WSDLException {
- bindingOperation.setName(operation.getName());
- }
-
- /**
- * Called after the {@link BindingInput} has been created. Subclasses can implement this method to define the name,
- * or add extensions to it.
- *
- * Default implementation set the name of the binding input to the name of the input.
- *
- * @param bindingInput the WSDL4J BindingInput
- * @param input the corresponding WSDL4J Input
- * @throws WSDLException in case of errors
- */
- protected void populateBindingInput(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.
- *
- * Default implementation set the name of the binding output to the name of the output.
- *
- * @param bindingOutput the WSDL4J BindingOutput
- * @param output the corresponding WSDL4J Output
- * @throws WSDLException in case of errors
- */
- protected void populateBindingOutput(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.
- *
- * Default implementation set the name of the binding fault to the name of the fault.
- *
- * @param bindingFault the WSDL4J BindingFault
- * @param fault the corresponding WSDL4J Fault
- * @throws WSDLException in case of errors
- */
- protected void populateBindingFault(BindingFault bindingFault, Fault fault) throws WSDLException {
- bindingFault.setName(fault.getName());
- }
-
- /**
- * Creates a single {@link Service}, and calls {@link #populateService(Service)} with it. Creates a corresponding
- * {@link Port} for each {@link Binding}, which is passed to {@link #populatePort(Port, Binding)}.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- * @see #populatePort(Port, Binding)
- */
- @Override
- public void buildServices(Definition definition) throws WSDLException {
- Service service = definition.createService();
- populateService(service);
- createPorts(definition, service);
- definition.addService(service);
- }
-
- /**
- * 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.
- *
- * Default implementation is empty.
- *
- * @param service the WSDL4J Service
- * @throws WSDLException in case of errors
- */
- protected void populateService(Service service) throws WSDLException {
- }
-
- 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.
- *
- * Default implementation sets the port name to the port type name with the suffix {@link Port} appended to it.
- *
- * @param port the WSDL4J Port
- * @param binding the corresponding WSDL4J Binding
- * @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);
- }
- }
-
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractSoap11Wsdl4jDefinitionBuilder.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractSoap11Wsdl4jDefinitionBuilder.java
deleted file mode 100644
index 63f7ef3a..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractSoap11Wsdl4jDefinitionBuilder.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright 2005-2010 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 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.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBinding;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.wsdl.extensions.soap.SOAPFault;
-import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.xml.namespace.QName;
-
-/**
- * Abstract base class for Wsdl11DefinitionBuilder implementations that use WSDL4J and contain a SOAP 1.1
- * binding. Requires the locationUri property to be set before use.
- *
- * @author Arjen Poutsma
- * @see #setLocationUri(String)
- * @since 1.0.0
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-public abstract class AbstractSoap11Wsdl4jDefinitionBuilder extends AbstractBindingWsdl4jDefinitionBuilder {
-
- private static final String WSDL_SOAP_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/soap/";
-
- private static final String WSDL_SOAP_PREFIX = "soap";
-
- /** The default soap:binding transport attribute value. */
- public static final String DEFAULT_TRANSPORT_URI = "http://schemas.xmlsoap.org/soap/http";
-
- private String transportUri = DEFAULT_TRANSPORT_URI;
-
- private String locationUri;
-
- /**
- * Sets the value used for the soap:binding transport attribute value.
- *
- * @see SOAPBinding#setTransportURI(String)
- * @see #DEFAULT_TRANSPORT_URI
- */
- public void setTransportUri(String transportUri) {
- this.transportUri = transportUri;
- }
-
- /** Sets the value used for the soap:address location attribute value. */
- public void setLocationUri(String locationUri) {
- this.locationUri = locationUri;
- }
-
- /** Adds the WSDL SOAP namespace to the definition. */
- @Override
- protected void populateDefinition(Definition definition) throws WSDLException {
- definition.addNamespace(WSDL_SOAP_PREFIX, WSDL_SOAP_NAMESPACE_URI);
- }
-
- /**
- * Calls {@link AbstractBindingWsdl4jDefinitionBuilder#populateBinding(Binding, PortType)}, creates {@link
- * SOAPBinding}, and calls {@link #populateSoapBinding(SOAPBinding)}.
- *
- * @param binding the WSDL4J Binding
- * @param portType the corresponding PortType
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBinding(Binding binding, PortType portType) throws WSDLException {
- super.populateBinding(binding, portType);
- SOAPBinding soapBinding = (SOAPBinding) createSoapExtension(Binding.class, "binding");
- populateSoapBinding(soapBinding);
- binding.addExtensibilityElement(soapBinding);
- }
-
- /**
- * Called after the {@link SOAPBinding} has been created. Default implementation sets the binding style to
- * "document", and set the transport URI to the value set on this builder. Subclasses can override this
- * behavior.
- *
- * @param soapBinding the WSDL4J SOAPBinding
- * @throws WSDLException in case of errors
- * @see SOAPBinding#setStyle(String)
- * @see SOAPBinding#setTransportURI(String)
- * @see #setTransportUri(String)
- * @see #DEFAULT_TRANSPORT_URI
- */
- protected void populateSoapBinding(SOAPBinding soapBinding) throws WSDLException {
- soapBinding.setStyle("document");
- soapBinding.setTransportURI(transportUri);
- }
-
- /**
- * Calls {@link AbstractBindingWsdl4jDefinitionBuilder#populateBindingOperation(BindingOperation, Operation)},
- * creates a {@link SOAPOperation}, and calls {@link #populateSoapOperation(SOAPOperation)}.
- *
- * @param bindingOperation the WSDL4J BindingOperation
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingOperation(BindingOperation bindingOperation, Operation operation)
- throws WSDLException {
- super.populateBindingOperation(bindingOperation, operation);
- SOAPOperation soapOperation = (SOAPOperation) createSoapExtension(BindingOperation.class, "operation");
- populateSoapOperation(soapOperation);
- bindingOperation.addExtensibilityElement(soapOperation);
- }
-
- /**
- * Called after the {@link SOAPOperation} has been created.
- *
- * Default implementation set the SOAPAction uri to an empty string.
- *
- * @param soapOperation the WSDL4J SOAPOperation
- * @throws WSDLException in case of errors
- * @see SOAPOperation#setSoapActionURI(String)
- */
- protected void populateSoapOperation(SOAPOperation soapOperation) throws WSDLException {
- soapOperation.setSoapActionURI("");
- }
-
- /**
- * Creates a {@link SOAPBody}, and calls {@link #populateSoapBody(SOAPBody)}.
- *
- * @param bindingInput the WSDL4J BindingInput
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingInput(BindingInput bindingInput, Input input) throws WSDLException {
- super.populateBindingInput(bindingInput, input);
- SOAPBody soapBody = (SOAPBody) createSoapExtension(BindingInput.class, "body");
- populateSoapBody(soapBody);
- bindingInput.addExtensibilityElement(soapBody);
- }
-
- /**
- * Creates a {@link SOAPBody}, and calls {@link #populateSoapBody(SOAPBody)}.
- *
- * @param bindingOutput the WSDL4J BindingOutput
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingOutput(BindingOutput bindingOutput, Output output) throws WSDLException {
- super.populateBindingOutput(bindingOutput, output);
- SOAPBody soapBody = (SOAPBody) createSoapExtension(BindingOutput.class, "body");
- populateSoapBody(soapBody);
- bindingOutput.addExtensibilityElement(soapBody);
- }
-
- /**
- * Creates a {@link SOAPBody}, and calls {@link #populateSoapBody(SOAPBody)}.
- *
- * @param bindingFault the WSDL4J BindingFault
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingFault(BindingFault bindingFault, Fault fault) throws WSDLException {
- super.populateBindingFault(bindingFault, fault);
- SOAPFault soapFault = (SOAPFault) createSoapExtension(BindingFault.class, "fault");
- populateSoapFault(bindingFault, soapFault);
- bindingFault.addExtensibilityElement(soapFault);
- }
-
- /**
- * Called after the {@link SOAPBody} has been created. Default implementation sets the use style to
- * "literal". Subclasses can override this behavior.
- *
- * @param soapBody the WSDL4J SOAPBody
- * @throws WSDLException in case of errors
- * @see SOAPBody#setUse(String)
- */
- protected void populateSoapBody(SOAPBody soapBody) throws WSDLException {
- soapBody.setUse("literal");
- }
-
- /**
- * Called after the {@link SOAPFault} has been created. Default implementation sets the use style to
- * "literal", and sets the name equal to the binding fault. Subclasses can override this behavior.
- *
- * @param bindingFault the WSDL4J BindingFault
- * @param soapFault the WSDL4J SOAPFault
- * @throws WSDLException in case of errors
- * @see SOAPFault#setUse(String)
- */
- protected void populateSoapFault(BindingFault bindingFault, SOAPFault soapFault) throws WSDLException {
- soapFault.setName(bindingFault.getName());
- soapFault.setUse("literal");
- }
-
- /**
- * Creates a {@link SOAPAddress}, and calls {@link #populateSoapAddress(SOAPAddress)}.
- *
- * @param port the WSDL4J Port
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populatePort(Port port, Binding binding) throws WSDLException {
- super.populatePort(port, binding);
- SOAPAddress soapAddress = (SOAPAddress) createSoapExtension(Port.class, "address");
- populateSoapAddress(soapAddress);
- port.addExtensibilityElement(soapAddress);
- }
-
- /**
- * Called after the {@link SOAPAddress} has been created. Default implementation sets the location URI to the value
- * set on this builder. Subclasses can override this behavior.
- *
- * @param soapAddress the WSDL4J SOAPAddress
- * @throws WSDLException in case of errors
- * @see SOAPAddress#setLocationURI(String)
- * @see #setLocationUri(String)
- */
- protected void populateSoapAddress(SOAPAddress soapAddress) throws WSDLException {
- soapAddress.setLocationURI(locationUri);
- }
-
- /**
- * Creates a SOAP extensibility element.
- *
- * @param parentType a class object indicating where in the WSDL definition this extension will exist
- * @param localName the local name of the extensibility element
- * @return the extensibility element
- * @throws WSDLException in case of errors
- * @see ExtensionRegistry#createExtension(Class,javax.xml.namespace.QName)
- */
- protected ExtensibilityElement createSoapExtension(Class parentType, String localName) throws WSDLException {
- return createExtension(parentType, new QName(WSDL_SOAP_NAMESPACE_URI, localName));
- }
-
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractSoap12Wsdl4jDefinitionBuilder.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractSoap12Wsdl4jDefinitionBuilder.java
deleted file mode 100755
index db74ba63..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractSoap12Wsdl4jDefinitionBuilder.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright 2005-2010 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 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.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.extensions.soap12.SOAP12Binding;
-import javax.wsdl.extensions.soap12.SOAP12Body;
-import javax.wsdl.extensions.soap12.SOAP12Fault;
-import javax.wsdl.extensions.soap12.SOAP12Operation;
-import javax.xml.namespace.QName;
-
-/**
- * Abstract base class for Wsdl11DefinitionBuilder implementations that use WSDL4J and contain a SOAP 1.2
- * binding. Requires the locationUri property to be set before use.
- *
- * @author Arjen Poutsma
- * @author Alex Marshall
- * @see #setLocationUri(String)
- * @since 1.5.0
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-public abstract class AbstractSoap12Wsdl4jDefinitionBuilder extends AbstractBindingWsdl4jDefinitionBuilder {
-
- private static final String WSDL_SOAP_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/soap12/";
-
- private static final String WSDL_SOAP_PREFIX = "soap12";
-
- /** The default soap12:binding transport attribute value. */
- public static final String DEFAULT_TRANSPORT_URI = "http://schemas.xmlsoap.org/soap/http";
-
- private String transportUri = DEFAULT_TRANSPORT_URI;
-
- private String locationUri;
-
- /**
- * Sets the value used for the soap12:binding transport attribute value.
- *
- * @see SOAP12Binding#setTransportURI(String)
- * @see #DEFAULT_TRANSPORT_URI
- */
- public void setTransportUri(String transportUri) {
- this.transportUri = transportUri;
- }
-
- /** Sets the value used for the soap12:address location attribute value. */
- public void setLocationUri(String locationUri) {
- this.locationUri = locationUri;
- }
-
- /** Adds the WSDL SOAP namespace to the definition. */
- @Override
- protected void populateDefinition(Definition definition) throws WSDLException {
- definition.addNamespace(WSDL_SOAP_PREFIX, WSDL_SOAP_NAMESPACE_URI);
- }
-
- /**
- * Calls {@link AbstractBindingWsdl4jDefinitionBuilder#populateBinding(Binding, PortType)}, creates {@link
- * SOAP12Binding}, and calls {@link #populateSoapBinding(SOAP12Binding)}.
- *
- * @param binding the WSDL4J Binding
- * @param portType the corresponding PortType
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBinding(Binding binding, PortType portType) throws WSDLException {
- super.populateBinding(binding, portType);
- SOAP12Binding soapBinding = (SOAP12Binding) createSoapExtension(Binding.class, "binding");
- populateSoapBinding(soapBinding);
- binding.addExtensibilityElement(soapBinding);
- }
-
- /**
- * Called after the {@link SOAP12Binding} has been created. Default implementation sets the binding style to
- * "document", and set the transport URI to the value set on this builder. Subclasses can override this
- * behavior.
- *
- * @param soapBinding the WSDL4J SOAP12Binding
- * @throws WSDLException in case of errors
- * @see SOAP12Binding#setStyle(String)
- * @see SOAP12Binding#setTransportURI(String)
- * @see #setTransportUri(String)
- * @see #DEFAULT_TRANSPORT_URI
- */
- protected void populateSoapBinding(SOAP12Binding soapBinding) throws WSDLException {
- soapBinding.setStyle("document");
- soapBinding.setTransportURI(transportUri);
- }
-
- /**
- * Calls {@link AbstractBindingWsdl4jDefinitionBuilder#populateBindingOperation(BindingOperation, Operation)},
- * creates a {@link SOAP12Operation}, and calls {@link #populateSoapOperation(SOAP12Operation)}.
- *
- * @param bindingOperation the WSDL4J BindingOperation
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingOperation(BindingOperation bindingOperation, Operation operation)
- throws WSDLException {
- super.populateBindingOperation(bindingOperation, operation);
- SOAP12Operation soapOperation = (SOAP12Operation) createSoapExtension(BindingOperation.class, "operation");
- populateSoapOperation(soapOperation);
- bindingOperation.addExtensibilityElement(soapOperation);
- }
-
- /**
- * Called after the {@link SOAP12Operation} has been created.
- *
- * Default implementation set the SOAPAction uri to an empty string.
- *
- * @param soapOperation the WSDL4J SOAP12Operation
- * @throws WSDLException in case of errors
- * @see SOAP12Operation#setSoapActionURI(String)
- */
- protected void populateSoapOperation(SOAP12Operation soapOperation) throws WSDLException {
- soapOperation.setSoapActionURI("");
- }
-
- /**
- * Creates a {@link SOAP12Body}, and calls {@link #populateSoapBody(SOAP12Body)}.
- *
- * @param bindingInput the WSDL4J BindingInput
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingInput(BindingInput bindingInput, Input input) throws WSDLException {
- super.populateBindingInput(bindingInput, input);
- SOAP12Body soapBody = (SOAP12Body) createSoapExtension(BindingInput.class, "body");
- populateSoapBody(soapBody);
- bindingInput.addExtensibilityElement(soapBody);
- }
-
- /**
- * Creates a {@link SOAP12Body}, and calls {@link #populateSoapBody(SOAP12Body)}.
- *
- * @param bindingOutput the WSDL4J BindingOutput
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingOutput(BindingOutput bindingOutput, Output output) throws WSDLException {
- super.populateBindingOutput(bindingOutput, output);
- SOAP12Body soapBody = (SOAP12Body) createSoapExtension(BindingOutput.class, "body");
- populateSoapBody(soapBody);
- bindingOutput.addExtensibilityElement(soapBody);
- }
-
- /**
- * Creates a {@link SOAP12Body}, and calls {@link #populateSoapBody(SOAP12Body)}.
- *
- * @param bindingFault the WSDL4J BindingFault
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populateBindingFault(BindingFault bindingFault, Fault fault) throws WSDLException {
- super.populateBindingFault(bindingFault, fault);
- SOAP12Fault soapFault = (SOAP12Fault) createSoapExtension(BindingFault.class, "fault");
- populateSoapFault(bindingFault, soapFault);
- bindingFault.addExtensibilityElement(soapFault);
- }
-
- /**
- * Called after the {@link SOAP12Body} has been created. Default implementation sets the use style to
- * "literal". Subclasses can override this behavior.
- *
- * @param soapBody the WSDL4J SOAP12Body
- * @throws WSDLException in case of errors
- * @see SOAP12Body#setUse(String)
- */
- protected void populateSoapBody(SOAP12Body soapBody) throws WSDLException {
- soapBody.setUse("literal");
- }
-
- /**
- * Called after the {@link SOAP12Fault} has been created. Default implementation sets the use style to
- * "literal", and sets the name equal to the binding fault. Subclasses can override this behavior.
- *
- * @param bindingFault the WSDL4J BindingFault
- * @param soapFault the WSDL4J SOAPFault
- * @throws WSDLException in case of errors
- * @see SOAP12Fault#setUse(String)
- */
- protected void populateSoapFault(BindingFault bindingFault, SOAP12Fault soapFault) throws WSDLException {
- soapFault.setName(bindingFault.getName());
- soapFault.setUse("literal");
- }
-
- /**
- * Creates a {@link SOAP12Address}, and calls {@link #populateSoapAddress(SOAP12Address)}.
- *
- * @param port the WSDL4J Port
- * @throws WSDLException in case of errors
- */
- @Override
- protected void populatePort(Port port, Binding binding) throws WSDLException {
- super.populatePort(port, binding);
- SOAP12Address soapAddress = (SOAP12Address) createSoapExtension(Port.class, "address");
- populateSoapAddress(soapAddress);
- port.addExtensibilityElement(soapAddress);
- }
-
- /**
- * Called after the {@link SOAP12Address} has been created. Default implementation sets the location URI to the
- * value set on this builder. Subclasses can override this behavior.
- *
- * @param soapAddress the WSDL4J SOAPAddress
- * @throws WSDLException in case of errors
- * @see SOAP12Address#setLocationURI(String)
- * @see #setLocationUri(String)
- */
- protected void populateSoapAddress(SOAP12Address soapAddress) throws WSDLException {
- soapAddress.setLocationURI(locationUri);
- }
-
- /**
- * Creates a SOAP 1.2 extensibility element.
- *
- * @param parentType a class object indicating where in the WSDL definition this extension will exist
- * @param localName the local name of the extensibility element
- * @return the extensibility element
- * @throws WSDLException in case of errors
- * @see ExtensionRegistry#createExtension(Class,javax.xml.namespace.QName)
- */
- protected ExtensibilityElement createSoapExtension(Class parentType, String localName) throws WSDLException {
- return createExtension(parentType, new QName(WSDL_SOAP_NAMESPACE_URI, localName));
- }
-
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractWsdl4jDefinitionBuilder.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractWsdl4jDefinitionBuilder.java
deleted file mode 100644
index ae7a6a16..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/AbstractWsdl4jDefinitionBuilder.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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.builder;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.factory.WSDLFactory;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.ws.wsdl.WsdlDefinitionException;
-import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
-import org.springframework.ws.wsdl.wsdl11.Wsdl11DefinitionBuilder;
-import org.springframework.ws.wsdl.wsdl11.Wsdl4jDefinition;
-import org.springframework.ws.wsdl.wsdl11.Wsdl4jDefinitionException;
-
-/**
- * Abstract base class for Wsdl11DefinitionBuilder implementations that use WSDL4J. Creates a base {@link
- * Definition}, and passes that to subclass template methods.
- *
- * @author Arjen Poutsma
- * @since 1.0.0
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-public abstract class AbstractWsdl4jDefinitionBuilder implements Wsdl11DefinitionBuilder {
-
- /** Logger available to subclasses. */
- protected final Log logger = LogFactory.getLog(getClass());
-
- /** The WSDL4J Definition created by buildDefinition(). */
- private Definition definition;
-
- public final void buildDefinition() throws WsdlDefinitionException {
- try {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- definition = wsdlFactory.newDefinition();
- if (definition.getExtensionRegistry() == null) {
- ExtensionRegistry extensionRegistry = wsdlFactory.newPopulatedExtensionRegistry();
- definition.setExtensionRegistry(extensionRegistry);
- }
- populateExtensionRegistry(definition.getExtensionRegistry());
- populateDefinition(definition);
- }
- catch (WSDLException ex) {
- throw new Wsdl4jDefinitionException(ex);
- }
- }
-
- /**
- * Called after the Definition has been created, but before any sub-elements are added. Default
- * implementation is empty.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- * @see #buildDefinition()
- */
- protected void populateDefinition(Definition definition) throws WSDLException {
- }
-
- public final void buildImports() throws WsdlDefinitionException {
- try {
- buildImports(definition);
- }
- catch (WSDLException ex) {
- throw new Wsdl4jDefinitionException(ex);
- }
- }
-
- /**
- * Adds imports to the definition.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- protected abstract void buildImports(Definition definition) throws WSDLException;
-
- public final void buildTypes() throws WsdlDefinitionException {
- try {
- buildTypes(definition);
- }
- catch (WSDLException ex) {
- throw new Wsdl4jDefinitionException(ex);
- }
- }
-
- /**
- * Adds types to the definition.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- protected abstract void buildTypes(Definition definition) throws WSDLException;
-
- public final void buildMessages() throws WsdlDefinitionException {
- try {
- buildMessages(definition);
- }
- catch (WSDLException ex) {
- throw new Wsdl4jDefinitionException(ex);
- }
- }
-
- /**
- * Adds messages to the definition.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- protected abstract void buildMessages(Definition definition) throws WSDLException;
-
- public final void buildPortTypes() throws WsdlDefinitionException {
- try {
- buildPortTypes(definition);
- }
- catch (WSDLException ex) {
- throw new Wsdl4jDefinitionException(ex);
- }
- }
-
- /**
- * Adds port types to the definition.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- protected abstract void buildPortTypes(Definition definition) throws WSDLException;
-
- public final void buildBindings() throws WsdlDefinitionException {
- try {
- buildBindings(definition);
- }
- catch (WSDLException ex) {
- throw new Wsdl4jDefinitionException(ex);
- }
- }
-
- /**
- * Adds bindings to the definition.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- protected abstract void buildBindings(Definition definition) throws WSDLException;
-
- public final void buildServices() throws WsdlDefinitionException {
- try {
- buildServices(definition);
- }
- catch (WSDLException ex) {
- throw new Wsdl4jDefinitionException(ex);
- }
- }
-
- /**
- * Adds services to the definition.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- protected abstract void buildServices(Definition definition) throws WSDLException;
-
- public final Wsdl11Definition getDefinition() throws WsdlDefinitionException {
- return new Wsdl4jDefinition(definition);
- }
-
- /**
- * Creates a WSDL4J extensibility element.
- *
- * @param parentType a class object indicating where in the WSDL definition this extension will exist
- * @param elementType the qname of the extensibility element
- * @return the extensibility element
- * @throws WSDLException in case of errors
- * @see javax.wsdl.extensions.ExtensionRegistry#createExtension(Class,javax.xml.namespace.QName)
- */
- protected ExtensibilityElement createExtension(Class parentType, QName elementType) throws WSDLException {
- return definition.getExtensionRegistry().createExtension(parentType, elementType);
- }
-
- /** Allows customization of the given {@link ExtensionRegistry}. Default implementation is empty. */
- protected void populateExtensionRegistry(ExtensionRegistry extensionRegistry) {
- }
-
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap11Wsdl4jDefinitionBuilder.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap11Wsdl4jDefinitionBuilder.java
deleted file mode 100644
index fb7f449e..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap11Wsdl4jDefinitionBuilder.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * Copyright 2005-2010 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.Iterator;
-import java.util.List;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.OperationType;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.schema.Schema;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.core.io.Resource;
-import org.springframework.util.Assert;
-import org.springframework.util.StringUtils;
-import org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition;
-import org.springframework.xml.namespace.QNameUtils;
-
-/**
- * Builds a WsdlDefinition with a SOAP 1.1 binding based on an XSD schema. This builder iterates over all
- * elements found in the schema, and creates a message for those elements that end with the
- * request or response suffix. It combines these messages into operations, and builds a
- * portType based on the operations.
- *
- * By default, the schema file is inlined in a types block. However, if the schemaLocation
- * property is set, an XSD import is used instead. As such, the imported schema file can contain further
- * imports, which will be resolved correctly in accordance with the schema location.
- *
- * To create messages from imported and included schemas, set the followIncludeImport property to
- * true.
- *
- * Typically used within a {@link DynamicWsdl11Definition}, like so:
- * - * <bean id="airline" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition"> - * <property name="builder"> - * <bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder"> - * <property name="schema" value="/WEB-INF/airline.xsd"/> - * <property name="portTypeName" value="Airline"/> - * <property name="locationUri" value="http://localhost:8080/airline/services"/> - * </bean> - * </property> - * </bean> - *- * - * Requires the
schema and portTypeName properties to be set.
- *
- * @author Arjen Poutsma
- * @see #setSchema(org.springframework.core.io.Resource)
- * @see #setPortTypeName(String)
- * @see #setRequestSuffix(String)
- * @see #setResponseSuffix(String)
- * @since 1.0.0
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-public class XsdBasedSoap11Wsdl4jDefinitionBuilder extends AbstractSoap11Wsdl4jDefinitionBuilder
- implements InitializingBean {
-
- /** The default suffix used to detect request elements in the schema. */
- public static final String DEFAULT_REQUEST_SUFFIX = "Request";
-
- /** The default suffix used to detect response elements in the schema. */
- public static final String DEFAULT_RESPONSE_SUFFIX = "Response";
-
- /** The default suffix used to detect fault elements in the schema. */
- public static final String DEFAULT_FAULT_SUFFIX = "Fault";
-
- /** The default prefix used to register the schema namespace in the WSDL. */
- public static final String DEFAULT_SCHEMA_PREFIX = "schema";
-
- /** The default prefix used to register the target namespace in the WSDL. */
- public static final String DEFAULT_PREFIX = "tns";
-
- /** The suffix used to create a service name from a port type name. */
- public static final String SERVICE_SUFFIX = "Service";
-
- private Resource schemaResource;
-
- private XsdSchemaHelper schemaHelper;
-
- private String schemaLocation;
-
- private String targetNamespace;
-
- private String portTypeName;
-
- private String schemaPrefix = DEFAULT_SCHEMA_PREFIX;
-
- private String prefix = DEFAULT_PREFIX;
-
- private String requestSuffix = DEFAULT_REQUEST_SUFFIX;
-
- private String responseSuffix = DEFAULT_RESPONSE_SUFFIX;
-
- private String faultSuffix = DEFAULT_FAULT_SUFFIX;
-
- private boolean followIncludeImport = false;
-
- /**
- * Sets the suffix used to detect request elements in the schema.
- *
- * @see #DEFAULT_REQUEST_SUFFIX
- */
- public void setRequestSuffix(String requestSuffix) {
- this.requestSuffix = requestSuffix;
- }
-
- /**
- * Sets the suffix used to detect response elements in the schema.
- *
- * @see #DEFAULT_RESPONSE_SUFFIX
- */
- public void setResponseSuffix(String responseSuffix) {
- this.responseSuffix = responseSuffix;
- }
-
- /**
- * Sets the suffix used to detect fault elements in the schema.
- *
- * @see #DEFAULT_FAULT_SUFFIX
- */
- public void setFaultSuffix(String faultSuffix) {
- this.faultSuffix = faultSuffix;
- }
-
- /** Sets the port type name used for this definition. Required. */
- public void setPortTypeName(String portTypeName) {
- this.portTypeName = portTypeName;
- }
-
- /** Sets the target namespace used for this definition. */
- public void setTargetNamespace(String targetNamespace) {
- this.targetNamespace = targetNamespace;
- }
-
- /**
- * Sets the prefix used to declare the schema target namespace.
- *
- * @see #DEFAULT_SCHEMA_PREFIX
- */
- public void setSchemaPrefix(String schemaPrefix) {
- this.schemaPrefix = schemaPrefix;
- }
-
- /**
- * Sets the prefix used to declare the target namespace.
- *
- * @see #DEFAULT_PREFIX
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- /** Sets the XSD schema to use for generating the WSDL. */
- 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;
- }
-
- /**
- * Sets the location of the schema to import. If this property is set, the schema element in the
- * generated WSDL will only contain an import, referring to the value of this property.
- */
- public void setSchemaLocation(String schemaLocation) {
- Assert.hasLength(schemaLocation, "'schemaLocation' must not be empty");
- this.schemaLocation = schemaLocation;
- }
-
- /**
- * Indicates whether schema <xsd:include/> and <xsd:import/> should be
- * followed. Default is false.
- */
- public void setFollowIncludeImport(boolean followIncludeImport) {
- this.followIncludeImport = followIncludeImport;
- }
-
- public final void afterPropertiesSet() throws IOException, ParserConfigurationException, SAXException {
- Assert.notNull(schemaResource, "'schema' is required");
- Assert.notNull(portTypeName, "'portTypeName' is required");
- schemaHelper = new XsdSchemaHelper(schemaResource);
- if (!StringUtils.hasLength(targetNamespace)) {
- targetNamespace = schemaHelper.getTargetNamespace();
- }
- }
-
- /** Adds the target namespace and schema namespace to the definition. */
- @Override
- protected void populateDefinition(Definition definition) throws WSDLException {
- super.populateDefinition(definition);
- definition.setTargetNamespace(targetNamespace);
- definition.addNamespace(schemaPrefix, schemaHelper.getTargetNamespace());
- if (!targetNamespace.equals(schemaHelper.getTargetNamespace())) {
- definition.addNamespace(prefix, targetNamespace);
- }
- }
-
- /** Does nothing. */
- @Override
- protected void buildImports(Definition definition) throws WSDLException {
- }
-
- /**
- * Creates a {@link Types} object containing a {@link Schema}. By default, the schema set by the schema
- * property will be inlined into this type. If the schemaLocation is set, object
- * that is populated with the types found in the schema.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- @Override
- protected void buildTypes(Definition definition) throws WSDLException {
- Types types = definition.createTypes();
- Schema schema = (Schema) createExtension(Types.class, XsdSchemaHelper.SCHEMA_NAME);
- if (!StringUtils.hasLength(schemaLocation)) {
- schema.setElement(schemaHelper.getSchemaElement());
- }
- else {
- 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(XsdSchemaHelper.SCHEMA_NAME.getNamespaceURI(),
- QNameUtils.toQualifiedName(XsdSchemaHelper.SCHEMA_NAME));
- schema.setElement(importingSchemaElement);
- Element importElement = document.createElementNS(XsdSchemaHelper.IMPORT_NAME.getNamespaceURI(),
- QNameUtils.toQualifiedName(XsdSchemaHelper.IMPORT_NAME));
- importingSchemaElement.appendChild(importElement);
- importElement.setAttribute("namespace", schemaHelper.getTargetNamespace());
- importElement.setAttribute("schemaLocation", schemaLocation);
- }
- types.addExtensibilityElement(schema);
- definition.setTypes(types);
- }
-
- /**
- * Creates messages for each element found in the schema for which {@link #isRequestMessage(QName)}, {@link
- * #isResponseMessage(QName)}, or {@link #isFaultMessage(QName)} is true.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- @Override
- protected void buildMessages(Definition definition) throws WSDLException {
- 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 (definition.getPrefix(elementName.getNamespaceURI()) == null) {
- int i = 0;
- while (true) {
- String prefix = schemaPrefix + Integer.toString(i);
- if (!StringUtils.hasLength(definition.getNamespace(prefix))) {
- definition.addNamespace(prefix, elementName.getNamespaceURI());
- break;
- }
- i++;
- }
- }
- Message message = definition.createMessage();
- populateMessage(message, elementName);
- Part part = definition.createPart();
- populatePart(part, elementName);
- message.addPart(part);
- message.setUndefined(false);
- definition.addMessage(message);
- }
- }
- }
-
- /**
- * Indicates whether the given name name should be included as request {@link Message} in the definition. Default
- * implementation checks whether the local part ends with the request suffix.
- *
- * @param name the name of the element elligable for being a message
- * @return true if to be included as message; false otherwise
- * @see #setRequestSuffix(String)
- */
- protected boolean isRequestMessage(QName name) {
- return name.getLocalPart().endsWith(requestSuffix);
- }
-
- /**
- * Indicates whether the given name should be included as {@link Message} in the definition. Default implementation
- * checks whether the local part ends with the response suffix.
- *
- * @param name the name of the element elligable for being a message
- * @return true if to be included as message; false otherwise
- * @see #setResponseSuffix(String)
- */
- protected boolean isResponseMessage(QName name) {
- return name.getLocalPart().endsWith(responseSuffix);
- }
-
- /**
- * Indicates whether the given name should be included as {@link Message} in the definition. Default implementation
- * checks whether the local part ends with the fault suffix.
- *
- * @param name the name of the element elligable for being a message
- * @return true if to be included as message; false otherwise
- * @see #setFaultSuffix(String)
- */
- protected boolean isFaultMessage(QName name) {
- return name.getLocalPart().endsWith(faultSuffix);
- }
-
- /**
- * Called after the {@link Message} has been created.
- *
- * Default implementation sets the name of the message to the element name.
- *
- * @param message the WSDL4J Message
- * @param elementName the element name
- * @throws WSDLException in case of errors
- */
- protected void populateMessage(Message message, QName elementName) throws WSDLException {
- message.setQName(new QName(targetNamespace, elementName.getLocalPart()));
- }
-
- /**
- * Called after the {@link Part} has been created.
- *
- * Default implementation sets the element name of the part.
- *
- * @param part the WSDL4J Part
- * @param elementName the elementName
- * @throws WSDLException in case of errors
- * @see Part#setElementName(javax.xml.namespace.QName)
- */
- protected void populatePart(Part part, QName elementName) throws WSDLException {
- part.setElementName(elementName);
- part.setName(elementName.getLocalPart());
- }
-
- @Override
- protected void buildPortTypes(Definition definition) throws WSDLException {
- PortType portType = definition.createPortType();
- populatePortType(portType);
- createOperations(definition, portType);
- portType.setUndefined(false);
- definition.addPortType(portType);
- }
-
- /**
- * Called after the {@link PortType} has been created.
- *
- * Default implementation sets the name of the port type to the defined value.
- *
- * @param portType the WSDL4J PortType
- * @throws WSDLException in case of errors
- * @see #setPortTypeName(String)
- */
- protected void populatePortType(PortType portType) throws WSDLException {
- portType.setQName(new QName(targetNamespace, portTypeName));
- }
-
- private void createOperations(Definition definition, PortType portType) throws WSDLException {
- for (Iterator messageIterator = definition.getMessages().values().iterator(); messageIterator.hasNext();) {
- Message message = (Message) messageIterator.next();
- for (Iterator partIterator = message.getParts().values().iterator(); partIterator.hasNext();) {
- Part part = (Part) partIterator.next();
- if (isRequestMessage(part.getElementName())) {
- Message requestMessage = message;
- Message responseMessage = definition.getMessage(getResponseMessageName(requestMessage.getQName()));
- Message faultMessage = definition.getMessage(getFaultMessageName(requestMessage.getQName()));
- Operation operation = definition.createOperation();
- populateOperation(operation, requestMessage, responseMessage);
- if (requestMessage != null) {
- Input input = definition.createInput();
- input.setMessage(requestMessage);
- input.setName(requestMessage.getQName().getLocalPart());
- operation.setInput(input);
- }
- if (responseMessage != null) {
- Output output = definition.createOutput();
- output.setMessage(responseMessage);
- output.setName(responseMessage.getQName().getLocalPart());
- operation.setOutput(output);
- }
- if (faultMessage != null) {
- Fault fault = definition.createFault();
- fault.setMessage(faultMessage);
- fault.setName(faultMessage.getQName().getLocalPart());
- operation.addFault(fault);
- }
- if (requestMessage != null && responseMessage != null) {
- operation.setStyle(OperationType.REQUEST_RESPONSE);
- }
- else if (requestMessage != null && responseMessage == null) {
- operation.setStyle(OperationType.ONE_WAY);
- }
- else if (requestMessage == null && responseMessage != null) {
- operation.setStyle(OperationType.NOTIFICATION);
- }
- operation.setUndefined(false);
- portType.addOperation(operation);
- }
- }
- }
- }
-
- /**
- * Given an request message name, return the corresponding response message name.
- *
- * Default implementation removes the request suffix, and appends the response suffix.
- *
- * @param requestMessageName the name of the request message
- * @return the name of the corresponding response message, or null
- */
- protected QName getResponseMessageName(QName requestMessageName) {
- String localPart = requestMessageName.getLocalPart();
- if (localPart.endsWith(requestSuffix)) {
- String prefix = localPart.substring(0, localPart.length() - requestSuffix.length());
- return new QName(requestMessageName.getNamespaceURI(), prefix + responseSuffix);
- }
- else {
- return null;
- }
- }
-
- /**
- * Given an request message name, return the corresponding fault message name.
- *
- * Default implementation removes the request suffix, and appends the fault suffix.
- *
- * @param requestMessageName the name of the request message
- * @return the name of the corresponding response message, or null
- */
- protected QName getFaultMessageName(QName requestMessageName) {
- String localPart = requestMessageName.getLocalPart();
- if (localPart.endsWith(requestSuffix)) {
- String prefix = localPart.substring(0, localPart.length() - requestSuffix.length());
- return new QName(requestMessageName.getNamespaceURI(), prefix + faultSuffix);
- }
- else {
- return null;
- }
- }
-
- /**
- * Called after the {@link Operation} has been created.
- *
- * Default implementation sets the name of the operation to name of the messages, without suffix.
- *
- * @param operation the WSDL4J Operation
- * @param requestMessage the WSDL4J request Message
- * @param responseMessage the WSDL4J response Message
- * @throws WSDLException in case of errors
- * @see #setPortTypeName(String)
- */
- protected void populateOperation(Operation operation, Message requestMessage, Message responseMessage)
- throws WSDLException {
- String localPart = requestMessage.getQName().getLocalPart();
- String operationName = null;
- if (localPart.endsWith(requestSuffix)) {
- operationName = localPart.substring(0, localPart.length() - requestSuffix.length());
- }
- else {
- localPart = responseMessage.getQName().getLocalPart();
- if (localPart.endsWith(responseSuffix)) {
- operationName = localPart.substring(0, localPart.length() - responseSuffix.length());
- }
- }
- operation.setName(operationName);
- }
-
- /** Sets the name of the service to the name of the port type, with "Service" appended to it. */
- @Override
- protected void populateService(Service service) throws WSDLException {
- service.setQName(new QName(targetNamespace, portTypeName + SERVICE_SUFFIX));
- }
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap12Wsdl4jDefinitionBuilder.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap12Wsdl4jDefinitionBuilder.java
deleted file mode 100755
index 1b1036be..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap12Wsdl4jDefinitionBuilder.java
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * Copyright 2005-2010 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.Iterator;
-import java.util.List;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.OperationType;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.schema.Schema;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.core.io.Resource;
-import org.springframework.util.Assert;
-import org.springframework.util.StringUtils;
-import org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition;
-import org.springframework.xml.namespace.QNameUtils;
-
-/**
- * Builds a WsdlDefinition with a SOAP 1.2 binding based on an XSD schema. This builder iterates over all
- * elements found in the schema, and creates a message for those elements that end with the
- * request or response suffix. It combines these messages into operations, and builds a
- * portType based on the operations.
- *
- * By default, the schema file is inlined in a types block. However, if the schemaLocation
- * property is set, an XSD import is used instead. As such, the imported schema file can contain further
- * imports, which will be resolved correctly in accordance with the schema location.
- *
- * To create messages from imported and included schemas, set the followIncludeImport property to
- * true.
- *
- * Typically used within a {@link DynamicWsdl11Definition}, like so:
- * - * <bean id="airline" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition"> - * <property name="builder"> - * <bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder"> - * <property name="schema" value="/WEB-INF/airline.xsd"/> - * <property name="portTypeName" value="Airline"/> - * <property name="locationUri" value="http://localhost:8080/airline/services"/> - * </bean> - * </property> - * </bean> - *- * - * Requires the
schema and portTypeName properties to be set.
- *
- * @author Arjen Poutsma
- * @author Alex Marshall
- * @see #setSchema(org.springframework.core.io.Resource)
- * @see #setPortTypeName(String)
- * @see #setRequestSuffix(String)
- * @see #setResponseSuffix(String)
- * @since 1.5.0
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-public class XsdBasedSoap12Wsdl4jDefinitionBuilder extends AbstractSoap12Wsdl4jDefinitionBuilder
- implements InitializingBean {
-
- /** The default suffix used to detect request elements in the schema. */
- public static final String DEFAULT_REQUEST_SUFFIX = "Request";
-
- /** The default suffix used to detect response elements in the schema. */
- public static final String DEFAULT_RESPONSE_SUFFIX = "Response";
-
- /** The default suffix used to detect fault elements in the schema. */
- public static final String DEFAULT_FAULT_SUFFIX = "Fault";
-
- /** The default prefix used to register the schema namespace in the WSDL. */
- public static final String DEFAULT_SCHEMA_PREFIX = "schema";
-
- /** The default prefix used to register the target namespace in the WSDL. */
- public static final String DEFAULT_PREFIX = "tns";
-
- /** The suffix used to create a service name from a port type name. */
- public static final String SERVICE_SUFFIX = "Service";
-
- private Resource schemaResource;
-
- private XsdSchemaHelper schemaHelper;
-
- private String schemaLocation;
-
- private String targetNamespace;
-
- private String portTypeName;
-
- private String schemaPrefix = DEFAULT_SCHEMA_PREFIX;
-
- private String prefix = DEFAULT_PREFIX;
-
- private String requestSuffix = DEFAULT_REQUEST_SUFFIX;
-
- private String responseSuffix = DEFAULT_RESPONSE_SUFFIX;
-
- private String faultSuffix = DEFAULT_FAULT_SUFFIX;
-
- private boolean followIncludeImport = false;
-
- /**
- * Sets the suffix used to detect request elements in the schema.
- *
- * @see #DEFAULT_REQUEST_SUFFIX
- */
- public void setRequestSuffix(String requestSuffix) {
- this.requestSuffix = requestSuffix;
- }
-
- /**
- * Sets the suffix used to detect response elements in the schema.
- *
- * @see #DEFAULT_RESPONSE_SUFFIX
- */
- public void setResponseSuffix(String responseSuffix) {
- this.responseSuffix = responseSuffix;
- }
-
- /**
- * Sets the suffix used to detect fault elements in the schema.
- *
- * @see #DEFAULT_FAULT_SUFFIX
- */
- public void setFaultSuffix(String faultSuffix) {
- this.faultSuffix = faultSuffix;
- }
-
- /** Sets the port type name used for this definition. Required. */
- public void setPortTypeName(String portTypeName) {
- this.portTypeName = portTypeName;
- }
-
- /** Sets the target namespace used for this definition. */
- public void setTargetNamespace(String targetNamespace) {
- this.targetNamespace = targetNamespace;
- }
-
- /**
- * Sets the prefix used to declare the schema target namespace.
- *
- * @see #DEFAULT_SCHEMA_PREFIX
- */
- public void setSchemaPrefix(String schemaPrefix) {
- this.schemaPrefix = schemaPrefix;
- }
-
- /**
- * Sets the prefix used to declare the target namespace.
- *
- * @see #DEFAULT_PREFIX
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- /** Sets the XSD schema to use for generating the WSDL. */
- 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;
- }
-
- /**
- * Sets the location of the schema to import. If this property is set, the schema element in the
- * generated WSDL will only contain an import, referring to the value of this property.
- */
- public void setSchemaLocation(String schemaLocation) {
- Assert.hasLength(schemaLocation, "'schemaLocation' must not be empty");
- this.schemaLocation = schemaLocation;
- }
-
- /**
- * Indicates whether schema <xsd:include/> and <xsd:import/> should be
- * followed. Default is false.
- */
- public void setFollowIncludeImport(boolean followIncludeImport) {
- this.followIncludeImport = followIncludeImport;
- }
-
- public final void afterPropertiesSet() throws IOException, ParserConfigurationException, SAXException {
- Assert.notNull(schemaResource, "'schema' is required");
- Assert.notNull(portTypeName, "'portTypeName' is required");
- schemaHelper = new XsdSchemaHelper(schemaResource);
- if (!StringUtils.hasLength(targetNamespace)) {
- targetNamespace = schemaHelper.getTargetNamespace();
- }
- }
-
- /** Adds the target namespace and schema namespace to the definition. */
- @Override
- protected void populateDefinition(Definition definition) throws WSDLException {
- super.populateDefinition(definition);
- definition.setTargetNamespace(targetNamespace);
- definition.addNamespace(schemaPrefix, schemaHelper.getTargetNamespace());
- if (!targetNamespace.equals(schemaHelper.getTargetNamespace())) {
- definition.addNamespace(prefix, targetNamespace);
- }
- }
-
- /** Does nothing. */
- @Override
- protected void buildImports(Definition definition) throws WSDLException {
- }
-
- /**
- * Creates a {@link Types} object containing a {@link Schema}. By default, the schema set by the schema
- * property will be inlined into this type. If the schemaLocation is set, object
- * that is populated with the types found in the schema.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- @Override
- protected void buildTypes(Definition definition) throws WSDLException {
- Types types = definition.createTypes();
- Schema schema = (Schema) createExtension(Types.class, XsdSchemaHelper.SCHEMA_NAME);
- if (!StringUtils.hasLength(schemaLocation)) {
- schema.setElement(schemaHelper.getSchemaElement());
- }
- else {
- 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(XsdSchemaHelper.SCHEMA_NAME.getNamespaceURI(),
- QNameUtils.toQualifiedName(XsdSchemaHelper.SCHEMA_NAME));
- schema.setElement(importingSchemaElement);
- Element importElement = document.createElementNS(XsdSchemaHelper.IMPORT_NAME.getNamespaceURI(),
- QNameUtils.toQualifiedName(XsdSchemaHelper.IMPORT_NAME));
- importingSchemaElement.appendChild(importElement);
- importElement.setAttribute("namespace", schemaHelper.getTargetNamespace());
- importElement.setAttribute("schemaLocation", schemaLocation);
- }
- types.addExtensibilityElement(schema);
- definition.setTypes(types);
- }
-
- /**
- * Creates messages for each element found in the schema for which {@link #isRequestMessage(QName)}, {@link
- * #isResponseMessage(QName)}, or {@link #isFaultMessage(QName)} is true.
- *
- * @param definition the WSDL4J Definition
- * @throws WSDLException in case of errors
- */
- @Override
- protected void buildMessages(Definition definition) throws WSDLException {
- 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 (definition.getPrefix(elementName.getNamespaceURI()) == null) {
- int i = 0;
- while (true) {
- String prefix = schemaPrefix + Integer.toString(i);
- if (!StringUtils.hasLength(definition.getNamespace(prefix))) {
- definition.addNamespace(prefix, elementName.getNamespaceURI());
- break;
- }
- i++;
- }
- }
- Message message = definition.createMessage();
- populateMessage(message, elementName);
- Part part = definition.createPart();
- populatePart(part, elementName);
- message.addPart(part);
- message.setUndefined(false);
- definition.addMessage(message);
- }
- }
- }
-
- /**
- * Indicates whether the given name name should be included as request {@link Message} in the definition. Default
- * implementation checks whether the local part ends with the request suffix.
- *
- * @param name the name of the element elligable for being a message
- * @return true if to be included as message; false otherwise
- * @see #setRequestSuffix(String)
- */
- protected boolean isRequestMessage(QName name) {
- return name.getLocalPart().endsWith(requestSuffix);
- }
-
- /**
- * Indicates whether the given name should be included as {@link Message} in the definition. Default implementation
- * checks whether the local part ends with the response suffix.
- *
- * @param name the name of the element elligable for being a message
- * @return true if to be included as message; false otherwise
- * @see #setResponseSuffix(String)
- */
- protected boolean isResponseMessage(QName name) {
- return name.getLocalPart().endsWith(responseSuffix);
- }
-
- /**
- * Indicates whether the given name should be included as {@link Message} in the definition. Default implementation
- * checks whether the local part ends with the fault suffix.
- *
- * @param name the name of the element elligable for being a message
- * @return true if to be included as message; false otherwise
- * @see #setFaultSuffix(String)
- */
- protected boolean isFaultMessage(QName name) {
- return name.getLocalPart().endsWith(faultSuffix);
- }
-
- /**
- * Called after the {@link Message} has been created.
- *
- * Default implementation sets the name of the message to the element name.
- *
- * @param message the WSDL4J Message
- * @param elementName the element name
- * @throws WSDLException in case of errors
- */
- protected void populateMessage(Message message, QName elementName) throws WSDLException {
- message.setQName(new QName(targetNamespace, elementName.getLocalPart()));
- }
-
- /**
- * Called after the {@link Part} has been created.
- *
- * Default implementation sets the element name of the part.
- *
- * @param part the WSDL4J Part
- * @param elementName the elementName
- * @throws WSDLException in case of errors
- * @see Part#setElementName(javax.xml.namespace.QName)
- */
- protected void populatePart(Part part, QName elementName) throws WSDLException {
- part.setElementName(elementName);
- part.setName(elementName.getLocalPart());
- }
-
- @Override
- protected void buildPortTypes(Definition definition) throws WSDLException {
- PortType portType = definition.createPortType();
- populatePortType(portType);
- createOperations(definition, portType);
- portType.setUndefined(false);
- definition.addPortType(portType);
- }
-
- /**
- * Called after the {@link PortType} has been created.
- *
- * Default implementation sets the name of the port type to the defined value.
- *
- * @param portType the WSDL4J PortType
- * @throws WSDLException in case of errors
- * @see #setPortTypeName(String)
- */
- protected void populatePortType(PortType portType) throws WSDLException {
- portType.setQName(new QName(targetNamespace, portTypeName));
- }
-
- private void createOperations(Definition definition, PortType portType) throws WSDLException {
- for (Iterator messageIterator = definition.getMessages().values().iterator(); messageIterator.hasNext();) {
- Message message = (Message) messageIterator.next();
- for (Iterator partIterator = message.getParts().values().iterator(); partIterator.hasNext();) {
- Part part = (Part) partIterator.next();
- if (isRequestMessage(part.getElementName())) {
- Message requestMessage = message;
- Message responseMessage = definition.getMessage(getResponseMessageName(requestMessage.getQName()));
- Message faultMessage = definition.getMessage(getFaultMessageName(requestMessage.getQName()));
- Operation operation = definition.createOperation();
- populateOperation(operation, requestMessage, responseMessage);
- if (requestMessage != null) {
- Input input = definition.createInput();
- input.setMessage(requestMessage);
- input.setName(requestMessage.getQName().getLocalPart());
- operation.setInput(input);
- }
- if (responseMessage != null) {
- Output output = definition.createOutput();
- output.setMessage(responseMessage);
- output.setName(responseMessage.getQName().getLocalPart());
- operation.setOutput(output);
- }
- if (faultMessage != null) {
- Fault fault = definition.createFault();
- fault.setMessage(faultMessage);
- fault.setName(faultMessage.getQName().getLocalPart());
- operation.addFault(fault);
- }
- if (requestMessage != null && responseMessage != null) {
- operation.setStyle(OperationType.REQUEST_RESPONSE);
- }
- else if (requestMessage != null && responseMessage == null) {
- operation.setStyle(OperationType.ONE_WAY);
- }
- else if (requestMessage == null && responseMessage != null) {
- operation.setStyle(OperationType.NOTIFICATION);
- }
- operation.setUndefined(false);
- portType.addOperation(operation);
- }
- }
- }
- }
-
- /**
- * Given an request message name, return the corresponding response message name.
- *
- * Default implementation removes the request suffix, and appends the response suffix.
- *
- * @param requestMessageName the name of the request message
- * @return the name of the corresponding response message, or null
- */
- protected QName getResponseMessageName(QName requestMessageName) {
- String localPart = requestMessageName.getLocalPart();
- if (localPart.endsWith(requestSuffix)) {
- String prefix = localPart.substring(0, localPart.length() - requestSuffix.length());
- return new QName(requestMessageName.getNamespaceURI(), prefix + responseSuffix);
- }
- else {
- return null;
- }
- }
-
- /**
- * Given an request message name, return the corresponding fault message name.
- *
- * Default implementation removes the request suffix, and appends the fault suffix.
- *
- * @param requestMessageName the name of the request message
- * @return the name of the corresponding response message, or null
- */
- protected QName getFaultMessageName(QName requestMessageName) {
- String localPart = requestMessageName.getLocalPart();
- if (localPart.endsWith(requestSuffix)) {
- String prefix = localPart.substring(0, localPart.length() - requestSuffix.length());
- return new QName(requestMessageName.getNamespaceURI(), prefix + faultSuffix);
- }
- else {
- return null;
- }
- }
-
- /**
- * Called after the {@link Operation} has been created.
- *
- * Default implementation sets the name of the operation to name of the messages, without suffix.
- *
- * @param operation the WSDL4J Operation
- * @param requestMessage the WSDL4J request Message
- * @param responseMessage the WSDL4J response Message
- * @throws WSDLException in case of errors
- * @see #setPortTypeName(String)
- */
- protected void populateOperation(Operation operation, Message requestMessage, Message responseMessage)
- throws WSDLException {
- String localPart = requestMessage.getQName().getLocalPart();
- String operationName = null;
- if (localPart.endsWith(requestSuffix)) {
- operationName = localPart.substring(0, localPart.length() - requestSuffix.length());
- }
- else {
- localPart = responseMessage.getQName().getLocalPart();
- if (localPart.endsWith(responseSuffix)) {
- operationName = localPart.substring(0, localPart.length() - responseSuffix.length());
- }
- }
- operation.setName(operationName);
- }
-
- /** Sets the name of the service to the name of the port type, with "Service" appended to it. */
- @Override
- protected void populateService(Service service) throws WSDLException {
- service.setQName(new QName(targetNamespace, portTypeName + SERVICE_SUFFIX));
- }
-
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdSchemaHelper.java b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdSchemaHelper.java
deleted file mode 100644
index 11ad489d..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/XsdSchemaHelper.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-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.namespace.QNameUtils;
-import org.springframework.xml.sax.SaxUtils;
-
-/**
- * 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
- * @deprecated as of Spring Web Services 1.5: superseded by {@link org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition}
- * and the {@link org.springframework.ws.wsdl.wsdl11.provider} package
- */
-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;
- }
-
-
-}
diff --git a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/package.html b/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/package.html
deleted file mode 100644
index cde2b794..00000000
--- a/core/src/main/java/org/springframework/ws/wsdl/wsdl11/builder/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-Deprecated as of Spring Web Services 1.5: superseded by the DefaultWsdl11Definition
-and org.springframework.ws.wsdl.wsdl11.provider package.
-
-
diff --git a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/DynamicWsdl11DefinitionTest.java b/core/src/test/java/org/springframework/ws/wsdl/wsdl11/DynamicWsdl11DefinitionTest.java
deleted file mode 100644
index c5806819..00000000
--- a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/DynamicWsdl11DefinitionTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2005-2010 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 junit.framework.TestCase;
-import org.easymock.MockControl;
-
-public class DynamicWsdl11DefinitionTest extends TestCase {
-
- private DynamicWsdl11Definition definition;
-
- private MockControl builderControl;
-
- private Wsdl11DefinitionBuilder builderMock;
-
- @Override
- protected void setUp() throws Exception {
- definition = new DynamicWsdl11Definition();
- builderControl = MockControl.createControl(Wsdl11DefinitionBuilder.class);
- builderMock = (Wsdl11DefinitionBuilder) builderControl.getMock();
- definition.setBuilder(builderMock);
- }
-
- public void testComplete() throws Exception {
- builderMock.buildDefinition();
- builderMock.buildImports();
- builderMock.buildTypes();
- builderMock.buildMessages();
- builderMock.buildPortTypes();
- builderMock.buildBindings();
- builderMock.buildServices();
- builderControl.expectAndReturn(builderMock.getDefinition(), null);
- builderControl.replay();
- definition.afterPropertiesSet();
- builderControl.verify();
- }
-
- public void testAbstract() throws Exception {
- definition.setBuildConcretePart(false);
- builderMock.buildDefinition();
- builderMock.buildImports();
- builderMock.buildTypes();
- builderMock.buildMessages();
- builderMock.buildPortTypes();
- builderControl.expectAndReturn(builderMock.getDefinition(), null);
- builderControl.replay();
- definition.afterPropertiesSet();
- builderControl.verify();
- }
-
- public void testConcrete() throws Exception {
- definition.setBuildAbstractPart(false);
- builderMock.buildDefinition();
- builderMock.buildImports();
- builderMock.buildBindings();
- builderMock.buildServices();
- builderControl.expectAndReturn(builderMock.getDefinition(), null);
- builderControl.replay();
- definition.afterPropertiesSet();
- builderControl.verify();
- }
-}
\ No newline at end of file
diff --git a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap11Wsdl4jDefinitionBuilderTest.java b/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap11Wsdl4jDefinitionBuilderTest.java
deleted file mode 100644
index 27a806ef..00000000
--- a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap11Wsdl4jDefinitionBuilderTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2005-2010 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 javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-
-import org.custommonkey.xmlunit.XMLTestCase;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.w3c.dom.Document;
-
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
-import org.springframework.xml.transform.StringResult;
-
-public class XsdBasedSoap11Wsdl4jDefinitionBuilderTest extends XMLTestCase {
-
- private XsdBasedSoap11Wsdl4jDefinitionBuilder builder;
-
- private Transformer transformer;
-
- private DocumentBuilder documentBuilder;
-
- @Override
- protected void setUp() throws Exception {
- builder = new XsdBasedSoap11Wsdl4jDefinitionBuilder();
- builder.setLocationUri("http://localhost:8080/");
- 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 {
- try {
- builder.setSchema(new ClassPathResource("bla"));
- fail("IllegalArgumentException expected");
- }
- catch (IllegalArgumentException ex) {
- // expected
- }
- }
-
- 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();
- 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-soap11.wsdl"));
- XMLUnit.setIgnoreWhitespace(true);
- assertXMLEqual("Invalid WSDL built", expected, result);
- }
-
- public void testNoSchemaPrefix() throws Exception {
- builder.setSchema(new ClassPathResource("single.xsd", getClass()));
- builder.setPortTypeName("Order");
- builder.setTargetNamespace("http://www.springframework.org/spring-ws/single/definitions");
- builder.setSchemaPrefix("");
- builder.afterPropertiesSet();
-
- buildAll();
-
- Wsdl11Definition definition = builder.getDefinition();
-
- transformer.transform(definition.getSource(), new StringResult());
- }
-
- private void buildAll() {
- builder.buildDefinition();
- builder.buildImports();
- builder.buildTypes();
- builder.buildMessages();
- builder.buildPortTypes();
- builder.buildBindings();
- builder.buildServices();
- }
-
-
-}
\ No newline at end of file
diff --git a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap12Wsdl4jDefinitionBuilderTest.java b/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap12Wsdl4jDefinitionBuilderTest.java
deleted file mode 100644
index f2d1f7b1..00000000
--- a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdBasedSoap12Wsdl4jDefinitionBuilderTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2005-2010 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 javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-
-import org.custommonkey.xmlunit.XMLTestCase;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.w3c.dom.Document;
-
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
-import org.springframework.xml.transform.StringResult;
-
-public class XsdBasedSoap12Wsdl4jDefinitionBuilderTest extends XMLTestCase {
-
- private XsdBasedSoap12Wsdl4jDefinitionBuilder builder;
-
- private Transformer transformer;
-
- private DocumentBuilder documentBuilder;
-
- @Override
- protected void setUp() throws Exception {
- builder = new XsdBasedSoap12Wsdl4jDefinitionBuilder();
- builder.setLocationUri("http://localhost:8080/");
- 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 {
- try {
- builder.setSchema(new ClassPathResource("bla"));
- fail("IllegalArgumentException expected");
- }
- catch (IllegalArgumentException ex) {
- // expected
- }
- }
-
- 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-soap12.wsdl"));
- XMLUnit.setIgnoreWhitespace(true);
- assertXMLEqual("Invalid WSDL built", expected, result);
- }
-
- public void testNoSchemaPrefix() throws Exception {
- builder.setSchema(new ClassPathResource("single.xsd", getClass()));
- builder.setPortTypeName("Order");
- builder.setTargetNamespace("http://www.springframework.org/spring-ws/single/definitions");
- builder.setSchemaPrefix("");
- builder.afterPropertiesSet();
-
- buildAll();
-
- Wsdl11Definition definition = builder.getDefinition();
-
- transformer.transform(definition.getSource(), new StringResult());
- }
-
- private void buildAll() {
- builder.buildDefinition();
- builder.buildImports();
- builder.buildTypes();
- builder.buildMessages();
- builder.buildPortTypes();
- builder.buildBindings();
- builder.buildServices();
- }
-
-
-}
\ No newline at end of file
diff --git a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdSchemaHelperTest.java b/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdSchemaHelperTest.java
deleted file mode 100644
index 9939ea24..00000000
--- a/core/src/test/java/org/springframework/ws/wsdl/wsdl11/builder/XsdSchemaHelperTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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));
- }
-}
\ No newline at end of file
diff --git a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/airline-soap11.wsdl b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/airline-soap11.wsdl
deleted file mode 100644
index 425cf5a0..00000000
--- a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/airline-soap11.wsdl
+++ /dev/null
@@ -1,207 +0,0 @@
-
-UserDetailsService. Logic based on
- * Acegi's DigestProcessingFilter.
- *
- * An Acegi UserDetailService is used to load UserDetails from. The digest of the password
- * contained in this details object is then compared with the digest in the message.
- *
- * @author Arjen Poutsma
- * @see org.acegisecurity.userdetails.UserDetailsService
- * @see org.acegisecurity.ui.digestauth.DigestProcessingFilter
- * @since 1.5.0
- * @deprecated As of Spring-WS 1.5, in favor of Spring Security
- */
-public class AcegiDigestPasswordValidationCallbackHandler extends AbstractWsPasswordCallbackHandler
- implements InitializingBean {
-
- private UserCache userCache = new NullUserCache();
-
- private UserDetailsService userDetailsService;
-
- /** Sets the users cache. Not required, but can benefit performance. */
- public void setUserCache(UserCache userCache) {
- this.userCache = userCache;
- }
-
- /** Sets the Acegi user details service. Required. */
- public void setUserDetailsService(UserDetailsService userDetailsService) {
- this.userDetailsService = userDetailsService;
- }
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(userDetailsService, "userDetailsService is required");
- }
-
- @Override
- protected void handleUsernameToken(WSPasswordCallback callback) throws IOException, UnsupportedCallbackException {
- String identifier = callback.getIdentifier();
- UserDetails user = loadUserDetails(identifier);
- if (user != null) {
- AcegiUtils.checkUserValidity(user);
- callback.setPassword(user.getPassword());
- }
- }
-
- @Override
- protected void handleUsernameTokenPrincipal(UsernameTokenPrincipalCallback callback)
- throws IOException, UnsupportedCallbackException {
- UserDetails user = loadUserDetails(callback.getPrincipal().getName());
- WSUsernameTokenPrincipal principal = callback.getPrincipal();
- UsernamePasswordAuthenticationToken authRequest =
- new UsernamePasswordAuthenticationToken(principal, principal.getPassword(), user.getAuthorities());
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication success: " + authRequest.toString());
- }
- SecurityContextHolder.getContext().setAuthentication(authRequest);
- }
-
- @Override
- protected void handleCleanup(CleanupCallback callback) throws IOException, UnsupportedCallbackException {
- SecurityContextHolder.clearContext();
- }
-
- private UserDetails loadUserDetails(String username) throws DataAccessException {
- UserDetails user = userCache.getUserFromCache(username);
-
- if (user == null) {
- try {
- user = userDetailsService.loadUserByUsername(username);
- }
- catch (UsernameNotFoundException notFound) {
- if (logger.isDebugEnabled()) {
- logger.debug("Username '" + username + "' not found");
- }
- return null;
- }
- userCache.putUserInCache(user);
- }
- return user;
- }
-}
diff --git a/security/src/main/java/org/springframework/ws/soap/security/wss4j/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandler.java b/security/src/main/java/org/springframework/ws/soap/security/wss4j/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandler.java
deleted file mode 100644
index 1798e057..00000000
--- a/security/src/main/java/org/springframework/ws/soap/security/wss4j/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandler.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.wss4j.callback.acegi;
-
-import java.io.IOException;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.acegisecurity.Authentication;
-import org.acegisecurity.AuthenticationException;
-import org.acegisecurity.AuthenticationManager;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
-import org.apache.ws.security.WSPasswordCallback;
-import org.apache.ws.security.WSSecurityException;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.util.Assert;
-import org.springframework.ws.soap.security.callback.CleanupCallback;
-import org.springframework.ws.soap.security.wss4j.callback.AbstractWsPasswordCallbackHandler;
-
-/**
- * Callback handler that validates a certificate uses an Acegi AuthenticationManager. Logic based on
- * Acegi's BasicProcessingFilter.
- *
- * This handler requires an Acegi AuthenticationManager to operate. It can be set using the
- * authenticationManager property. An Acegi UsernamePasswordAuthenticationToken is created
- * with the username as principal and password as credentials.
- *
- * @author Arjen Poutsma
- * @see org.acegisecurity.providers.UsernamePasswordAuthenticationToken
- * @see org.acegisecurity.ui.basicauth.BasicProcessingFilter
- * @since 1.5.0
- * @deprecated As of Spring-WS 1.5, in favor of Spring Security
- */
-public class AcegiPlainTextPasswordValidationCallbackHandler extends AbstractWsPasswordCallbackHandler
- implements InitializingBean {
-
- private AuthenticationManager authenticationManager;
-
- private boolean ignoreFailure = false;
-
- /** Sets the Acegi authentication manager. Required. */
- public void setAuthenticationManager(AuthenticationManager authenticationManager) {
- this.authenticationManager = authenticationManager;
- }
-
- public void setIgnoreFailure(boolean ignoreFailure) {
- this.ignoreFailure = ignoreFailure;
- }
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(authenticationManager, "authenticationManager is required");
- }
-
- @Override
- protected void handleCleanup(CleanupCallback callback) throws IOException, UnsupportedCallbackException {
- SecurityContextHolder.clearContext();
- }
-
- @Override
- protected void handleUsernameTokenUnknown(WSPasswordCallback callback)
- throws IOException, UnsupportedCallbackException {
- String identifier = callback.getIdentifier();
- try {
- Authentication authResult = authenticationManager
- .authenticate(new UsernamePasswordAuthenticationToken(identifier, callback.getPassword()));
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication success: " + authResult.toString());
- }
- SecurityContextHolder.getContext().setAuthentication(authResult);
- }
- catch (AuthenticationException failed) {
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication request for user '" + identifier + "' failed: " + failed.toString());
- }
- SecurityContextHolder.clearContext();
- if (!ignoreFailure) {
- throw new WSSecurityException(WSSecurityException.FAILED_AUTHENTICATION);
- }
- }
- }
-}
diff --git a/security/src/main/java/org/springframework/ws/soap/security/wss4j/callback/acegi/package.html b/security/src/main/java/org/springframework/ws/soap/security/wss4j/callback/acegi/package.html
deleted file mode 100644
index f553860c..00000000
--- a/security/src/main/java/org/springframework/ws/soap/security/wss4j/callback/acegi/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-Contains CallbackHandler implementations for WSS4J that use the Acegi
- Security System for Spring.
-
-
\ No newline at end of file
diff --git a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiCertificateValidationCallbackHandler.java b/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiCertificateValidationCallbackHandler.java
deleted file mode 100644
index 3e7f60dc..00000000
--- a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiCertificateValidationCallbackHandler.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import java.io.IOException;
-import java.security.cert.X509Certificate;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import com.sun.xml.wss.impl.callback.CertificateValidationCallback;
-import org.acegisecurity.Authentication;
-import org.acegisecurity.AuthenticationException;
-import org.acegisecurity.AuthenticationManager;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.x509.X509AuthenticationToken;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.util.Assert;
-import org.springframework.ws.soap.security.callback.AbstractCallbackHandler;
-import org.springframework.ws.soap.security.callback.CleanupCallback;
-
-/**
- * Callback handler that validates a certificate using an Acegi AuthenticationManager. Logic based on
- * Acegi's X509ProcessingFilter. An Acegi X509AuthenticationToken is created with the
- * certificate as the credentials. The configured authentication manager is expected to supply a provider which can
- * handle this token (usually an instance of X509AuthenticationProvider).
- *
- * This class only handles CertificateValidationCallbacks, and throws an
- * UnsupportedCallbackException for others.
- *
- * @author Arjen Poutsma
- * @see X509AuthenticationToken
- * @see org.acegisecurity.providers.x509.X509AuthenticationProvider
- * @see org.acegisecurity.ui.x509.X509ProcessingFilter
- * @see CertificateValidationCallback
- * @since 1.0.0
- * @deprecated As of Spring-WS 1.5, in favor of Spring Security
- */
-public class AcegiCertificateValidationCallbackHandler extends AbstractCallbackHandler implements InitializingBean {
-
- private AuthenticationManager authenticationManager;
-
- private boolean ignoreFailure = false;
-
- /** Sets the Acegi authentication manager. Required. */
- public void setAuthenticationManager(AuthenticationManager authenticationManager) {
- this.authenticationManager = authenticationManager;
- }
-
- public void setIgnoreFailure(boolean ignoreFailure) {
- this.ignoreFailure = ignoreFailure;
- }
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(authenticationManager, "authenticationManager is required");
- }
-
- /**
- * Handles CertificateValidationCallbacks, and throws an UnsupportedCallbackException for
- * others
- *
- * @throws UnsupportedCallbackException when the callback is not supported
- */
- @Override
- protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException {
- if (callback instanceof CertificateValidationCallback) {
- ((CertificateValidationCallback) callback).setValidator(new AcegiCertificateValidator());
- }
- else if (callback instanceof CleanupCallback) {
- SecurityContextHolder.clearContext();
- }
- else {
- throw new UnsupportedCallbackException(callback);
- }
- }
-
- private class AcegiCertificateValidator implements CertificateValidationCallback.CertificateValidator {
-
- public boolean validate(X509Certificate certificate)
- throws CertificateValidationCallback.CertificateValidationException {
- boolean result;
- try {
- Authentication authResult =
- authenticationManager.authenticate(new X509AuthenticationToken(certificate));
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication request for certificate with DN [" +
- certificate.getSubjectX500Principal().getName() + "] successful");
- }
- SecurityContextHolder.getContext().setAuthentication(authResult);
- return true;
- }
- catch (AuthenticationException failed) {
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication request for certificate with DN [" +
- certificate.getSubjectX500Principal().getName() + "] failed: " + failed.toString());
- }
- SecurityContextHolder.clearContext();
- result = ignoreFailure;
- }
- return result;
- }
- }
-}
diff --git a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiDigestPasswordValidationCallbackHandler.java b/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiDigestPasswordValidationCallbackHandler.java
deleted file mode 100644
index 1b43cf2d..00000000
--- a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiDigestPasswordValidationCallbackHandler.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import java.io.IOException;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import com.sun.xml.wss.impl.callback.PasswordValidationCallback;
-import com.sun.xml.wss.impl.callback.TimestampValidationCallback;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
-import org.acegisecurity.providers.dao.UserCache;
-import org.acegisecurity.providers.dao.cache.NullUserCache;
-import org.acegisecurity.userdetails.UserDetails;
-import org.acegisecurity.userdetails.UserDetailsService;
-import org.acegisecurity.userdetails.UsernameNotFoundException;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.dao.DataAccessException;
-import org.springframework.util.Assert;
-import org.springframework.ws.soap.security.callback.AbstractCallbackHandler;
-import org.springframework.ws.soap.security.callback.CleanupCallback;
-import org.springframework.ws.soap.security.support.AcegiUtils;
-import org.springframework.ws.soap.security.xwss.callback.DefaultTimestampValidator;
-
-/**
- * Callback handler that validates a password digest using an Acegi UserDetailsService. Logic based on
- * Acegi's DigestProcessingFilter.
- *
- * An Acegi UserDetailService is used to load UserDetails from. The digest of the password
- * contained in this details object is then compared with the digest in the message.
- *
- * This class only handles PasswordValidationCallbacks that contain a DigestPasswordRequest,
- * and throws an UnsupportedCallbackException for others.
- *
- * @author Arjen Poutsma
- * @see UserDetailsService
- * @see PasswordValidationCallback
- * @see com.sun.xml.wss.impl.callback.PasswordValidationCallback.DigestPasswordRequest
- * @see org.acegisecurity.ui.digestauth.DigestProcessingFilter
- * @since 1.0.0
- * @deprecated As of Spring-WS 1.5, in favor of Spring Security
- */
-public class AcegiDigestPasswordValidationCallbackHandler extends AbstractCallbackHandler implements InitializingBean {
-
- private UserCache userCache = new NullUserCache();
-
- private UserDetailsService userDetailsService;
-
- /** Sets the users cache. Not required, but can benefit performance. */
- public void setUserCache(UserCache userCache) {
- this.userCache = userCache;
- }
-
- /** Sets the Acegi user details service. Required. */
- public void setUserDetailsService(UserDetailsService userDetailsService) {
- this.userDetailsService = userDetailsService;
- }
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(userDetailsService, "userDetailsService is required");
- }
-
- /**
- * Handles PasswordValidationCallbacks that contain a DigestPasswordRequest, and throws an
- * UnsupportedCallbackException for others
- *
- * @throws UnsupportedCallbackException when the callback is not supported
- */
- @Override
- protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException {
- if (callback instanceof PasswordValidationCallback) {
- PasswordValidationCallback passwordCallback = (PasswordValidationCallback) callback;
- if (passwordCallback.getRequest() instanceof PasswordValidationCallback.DigestPasswordRequest) {
- PasswordValidationCallback.DigestPasswordRequest request =
- (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest();
- String username = request.getUsername();
- UserDetails user = loadUserDetails(username);
- if (user != null) {
- AcegiUtils.checkUserValidity(user);
- request.setPassword(user.getPassword());
- }
- AcegiDigestPasswordValidator validator = new AcegiDigestPasswordValidator(user);
- passwordCallback.setValidator(validator);
- return;
- }
- }
- else if (callback instanceof TimestampValidationCallback) {
- TimestampValidationCallback timestampCallback = (TimestampValidationCallback) callback;
- timestampCallback.setValidator(new DefaultTimestampValidator());
-
- }
- else if (callback instanceof CleanupCallback) {
- SecurityContextHolder.clearContext();
- return;
- }
- throw new UnsupportedCallbackException(callback);
- }
-
- private UserDetails loadUserDetails(String username) throws DataAccessException {
- UserDetails user = userCache.getUserFromCache(username);
-
- if (user == null) {
- try {
- user = userDetailsService.loadUserByUsername(username);
- }
- catch (UsernameNotFoundException notFound) {
- if (logger.isDebugEnabled()) {
- logger.debug("Username '" + username + "' not found");
- }
- return null;
- }
- userCache.putUserInCache(user);
- }
- return user;
- }
-
- private class AcegiDigestPasswordValidator extends PasswordValidationCallback.DigestPasswordValidator {
-
- private UserDetails user;
-
- private AcegiDigestPasswordValidator(UserDetails user) {
- this.user = user;
- }
-
- @Override
- public boolean validate(PasswordValidationCallback.Request request)
- throws PasswordValidationCallback.PasswordValidationException {
- if (super.validate(request)) {
- UsernamePasswordAuthenticationToken authRequest =
- new UsernamePasswordAuthenticationToken(user, user.getPassword());
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication success: " + authRequest.toString());
- }
-
- SecurityContextHolder.getContext().setAuthentication(authRequest);
- return true;
- }
- else {
- return false;
- }
- }
- }
-
-}
diff --git a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandler.java b/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandler.java
deleted file mode 100644
index a124ab3b..00000000
--- a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandler.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import java.io.IOException;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import com.sun.xml.wss.impl.callback.PasswordValidationCallback;
-import org.acegisecurity.Authentication;
-import org.acegisecurity.AuthenticationException;
-import org.acegisecurity.AuthenticationManager;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.util.Assert;
-import org.springframework.ws.soap.security.callback.AbstractCallbackHandler;
-import org.springframework.ws.soap.security.callback.CleanupCallback;
-
-/**
- * Callback handler that validates a certificate uses an Acegi AuthenticationManager. Logic based on
- * Acegi's BasicProcessingFilter.
- *
- * This handler requires an Acegi AuthenticationManager to operate. It can be set using the
- * authenticationManager property. An Acegi UsernamePasswordAuthenticationToken is created
- * with the username as principal and password as credentials.
- *
- * This class only handles PasswordValidationCallbacks that contain a
- * PlainTextPasswordRequest, and throws an UnsupportedCallbackException for others.
- *
- * @author Arjen Poutsma
- * @see UsernamePasswordAuthenticationToken
- * @see PasswordValidationCallback
- * @see com.sun.xml.wss.impl.callback.PasswordValidationCallback.PlainTextPasswordRequest
- * @see org.acegisecurity.ui.basicauth.BasicProcessingFilter
- * @since 1.0.0
- * @deprecated As of Spring-WS 1.5, in favor of Spring Security
- */
-public class AcegiPlainTextPasswordValidationCallbackHandler extends AbstractCallbackHandler
- implements InitializingBean {
-
- private AuthenticationManager authenticationManager;
-
- private boolean ignoreFailure = false;
-
- /** Sets the Acegi authentication manager. Required. */
- public void setAuthenticationManager(AuthenticationManager authenticationManager) {
- this.authenticationManager = authenticationManager;
- }
-
- public void setIgnoreFailure(boolean ignoreFailure) {
- this.ignoreFailure = ignoreFailure;
- }
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(authenticationManager, "authenticationManager is required");
- }
-
- /**
- * Handles PasswordValidationCallbacks that contain a PlainTextPasswordRequest, and throws
- * an UnsupportedCallbackException for others.
- *
- * @throws UnsupportedCallbackException when the callback is not supported
- */
- @Override
- protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException {
- if (callback instanceof PasswordValidationCallback) {
- PasswordValidationCallback validationCallback = (PasswordValidationCallback) callback;
- if (validationCallback.getRequest() instanceof PasswordValidationCallback.PlainTextPasswordRequest) {
- validationCallback.setValidator(new AcegiPlainTextPasswordValidator());
- return;
- }
- }
- else if (callback instanceof CleanupCallback) {
- SecurityContextHolder.clearContext();
- return;
- }
- throw new UnsupportedCallbackException(callback);
- }
-
- private class AcegiPlainTextPasswordValidator implements PasswordValidationCallback.PasswordValidator {
-
- public boolean validate(PasswordValidationCallback.Request request)
- throws PasswordValidationCallback.PasswordValidationException {
- PasswordValidationCallback.PlainTextPasswordRequest plainTextRequest =
- (PasswordValidationCallback.PlainTextPasswordRequest) request;
- try {
- Authentication authResult = authenticationManager.authenticate(
- new UsernamePasswordAuthenticationToken(plainTextRequest.getUsername(),
- plainTextRequest.getPassword()));
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication success: " + authResult.toString());
- }
- SecurityContextHolder.getContext().setAuthentication(authResult);
- return true;
- }
- catch (AuthenticationException failed) {
- if (logger.isDebugEnabled()) {
- logger.debug("Authentication request for user '" + plainTextRequest.getUsername() + "' failed: " +
- failed.toString());
- }
- SecurityContextHolder.clearContext();
- return ignoreFailure;
- }
- }
- }
-
-}
diff --git a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiUsernamePasswordCallbackHandler.java b/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiUsernamePasswordCallbackHandler.java
deleted file mode 100644
index b9667e8e..00000000
--- a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiUsernamePasswordCallbackHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import java.io.IOException;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import com.sun.xml.wss.impl.callback.PasswordCallback;
-import com.sun.xml.wss.impl.callback.UsernameCallback;
-import org.acegisecurity.Authentication;
-import org.acegisecurity.context.SecurityContextHolder;
-
-import org.springframework.ws.soap.security.callback.AbstractCallbackHandler;
-
-/**
- * Callback handler that adds username/password information to a mesage using an Acegi {@link
- * org.acegisecurity.context.SecurityContext SecurityContext}.
- *
- * This class handles UsernameCallbacks and PasswordCallbacks, and throws an
- * UnsupportedCallbackException for others
- *
- * @author Arjen Poutsma
- * @since 1.5.0
- * @deprecated As of Spring-WS 1.5, in favor of Spring Security
- */
-public class AcegiUsernamePasswordCallbackHandler extends AbstractCallbackHandler {
-
- @Override
- protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException {
- if (callback instanceof UsernameCallback) {
- Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
- if (authentication != null && authentication.getName() != null) {
- UsernameCallback usernameCallback = (UsernameCallback) callback;
- usernameCallback.setUsername(authentication.getName());
- return;
- }
- else {
- logger.warn("Cannot handle UsernameCallback: Acegi SecurityContext contains no Authentication");
- }
- }
- else if (callback instanceof PasswordCallback) {
- Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
- if (authentication != null && authentication.getName() != null) {
- PasswordCallback passwordCallback = (PasswordCallback) callback;
- passwordCallback.setPassword(authentication.getCredentials().toString());
- return;
- }
- else {
- logger.warn("Canot handle PasswordCallback: Acegi SecurityContext contains no Authentication");
- }
- }
- throw new UnsupportedCallbackException(callback);
- }
-}
diff --git a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/package.html b/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/package.html
deleted file mode 100644
index 10c499c8..00000000
--- a/security/src/main/java/org/springframework/ws/soap/security/xwss/callback/acegi/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-Contains CallbackHandler implementations for XWSS that use the Acegi
- Security System for Spring.
-
-
\ No newline at end of file
diff --git a/security/src/test/java/org/springframework/ws/soap/security/wss4j/callback/acegi/AcegiDigestPasswordValidationCallbackHandlerTest.java b/security/src/test/java/org/springframework/ws/soap/security/wss4j/callback/acegi/AcegiDigestPasswordValidationCallbackHandlerTest.java
deleted file mode 100644
index 1c259272..00000000
--- a/security/src/test/java/org/springframework/ws/soap/security/wss4j/callback/acegi/AcegiDigestPasswordValidationCallbackHandlerTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.wss4j.callback.acegi;
-
-import junit.framework.TestCase;
-import org.acegisecurity.Authentication;
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.GrantedAuthorityImpl;
-import org.acegisecurity.DisabledException;
-import org.acegisecurity.context.SecurityContext;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.userdetails.User;
-import org.acegisecurity.userdetails.UserDetails;
-import org.acegisecurity.userdetails.UserDetailsService;
-import org.apache.ws.security.WSUsernameTokenPrincipal;
-import org.apache.ws.security.WSPasswordCallback;
-import org.easymock.MockControl;
-
-import org.springframework.ws.soap.security.wss4j.callback.UsernameTokenPrincipalCallback;
-
-/** @author tareq */
-public class AcegiDigestPasswordValidationCallbackHandlerTest extends TestCase {
-
- private AcegiDigestPasswordValidationCallbackHandler callbackHandler;
-
- private GrantedAuthorityImpl grantedAuthority;
-
- private UserDetailsService userDetailsService;
-
- private MockControl control;
-
- private UserDetails user;
-
- @Override
- protected void setUp() throws Exception {
- callbackHandler = new AcegiDigestPasswordValidationCallbackHandler();
-
- grantedAuthority = new GrantedAuthorityImpl("ROLE_1");
-
- control = MockControl.createControl(UserDetailsService.class);
- userDetailsService = (UserDetailsService) control.getMock();
- userDetailsService.loadUserByUsername("Ernie");
- callbackHandler.setUserDetailsService(userDetailsService);
- }
-
- @Override
- protected void tearDown() throws Exception {
- control.reset();
- }
-
- public void testHandleUsernameTokenPrincipal() throws Exception {
- user = new User("Ernie", "Bert", true, true, true, true, new GrantedAuthority[]{grantedAuthority});
- WSUsernameTokenPrincipal principal = new WSUsernameTokenPrincipal("Ernie", true);
- UsernameTokenPrincipalCallback callback = new UsernameTokenPrincipalCallback(principal);
- control.setDefaultReturnValue(user);
- control.replay();
- callbackHandler.handleUsernameTokenPrincipal(callback);
- SecurityContext context = SecurityContextHolder.getContext();
- assertNotNull("SecurityContext must not be null", context);
- Authentication authentication = context.getAuthentication();
- assertNotNull("Authentication must not be null", authentication);
- GrantedAuthority[] authorities = authentication.getAuthorities();
- assertTrue("GrantedAuthority[] must not be null or empty", (authorities != null && authorities.length > 0));
- assertEquals("Unexpected authority", grantedAuthority, authorities[0]);
- }
-
- public void testHandleUsernameTokenWithDisabledUser() throws Exception {
- user = new User("Ernie", "Bert", false, true, true, true, new GrantedAuthority[]{grantedAuthority});
- WSPasswordCallback callback = new WSPasswordCallback("ID", WSPasswordCallback.USERNAME_TOKEN);
- control.setDefaultReturnValue(user);
- control.replay();
- try {
- callbackHandler.handleUsernameToken(callback);
- fail("disabled user authenticated");
- } catch (DisabledException expected) {
- }
- }
-}
diff --git a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiCertificateValidationCallbackHandlerTest.java b/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiCertificateValidationCallbackHandlerTest.java
deleted file mode 100644
index 8bc73df3..00000000
--- a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiCertificateValidationCallbackHandlerTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import java.io.InputStream;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-
-import com.sun.xml.wss.impl.callback.CertificateValidationCallback;
-import junit.framework.TestCase;
-import org.acegisecurity.AuthenticationManager;
-import org.acegisecurity.BadCredentialsException;
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.TestingAuthenticationToken;
-import org.acegisecurity.providers.x509.X509AuthenticationToken;
-import org.easymock.MockControl;
-
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.ws.soap.security.callback.CleanupCallback;
-
-public class AcegiCertificateValidationCallbackHandlerTest extends TestCase {
-
- private AcegiCertificateValidationCallbackHandler callbackHandler;
-
- private MockControl control;
-
- private AuthenticationManager mock;
-
- private X509Certificate certificate;
-
- private CertificateValidationCallback callback;
-
- @Override
- protected void setUp() throws Exception {
- callbackHandler = new AcegiCertificateValidationCallbackHandler();
- control = MockControl.createControl(AuthenticationManager.class);
- mock = (AuthenticationManager) control.getMock();
- callbackHandler.setAuthenticationManager(mock);
- KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
- InputStream is = null;
- try {
- is = new ClassPathResource("/org/springframework/ws/soap/security/xwss/test-keystore.jks").getInputStream();
- keyStore.load(is, "password".toCharArray());
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- certificate = (X509Certificate) keyStore.getCertificate("alias");
- callback = new CertificateValidationCallback(certificate);
- }
-
- @Override
- protected void tearDown() throws Exception {
- SecurityContextHolder.clearContext();
- }
-
- public void testValidateCertificateValid() throws Exception {
- mock.authenticate(new X509AuthenticationToken(certificate));
- control.setMatcher(MockControl.ALWAYS_MATCHER);
- control.setReturnValue(new TestingAuthenticationToken(certificate, null, new GrantedAuthority[0]));
- control.replay();
- callbackHandler.handleInternal(callback);
- boolean authenticated = callback.getResult();
- assertTrue("Not authenticated", authenticated);
- assertNotNull("No Authentication created", SecurityContextHolder.getContext().getAuthentication());
- control.verify();
- }
-
- public void testValidateCertificateInvalid() throws Exception {
- mock.authenticate(new X509AuthenticationToken(certificate));
- control.setMatcher(MockControl.ALWAYS_MATCHER);
- control.setThrowable(new BadCredentialsException(""));
- control.replay();
- callbackHandler.handleInternal(callback);
- boolean authenticated = callback.getResult();
- assertFalse("Authenticated", authenticated);
- assertNull("Authentication created", SecurityContextHolder.getContext().getAuthentication());
- control.verify();
- }
-
- public void testCleanUp() throws Exception {
- TestingAuthenticationToken authentication =
- new TestingAuthenticationToken(new Object(), new Object(), new GrantedAuthority[0]);
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- CleanupCallback cleanupCallback = new CleanupCallback();
- callbackHandler.handleInternal(cleanupCallback);
- assertNull("Authentication created", SecurityContextHolder.getContext().getAuthentication());
- }
-
-}
\ No newline at end of file
diff --git a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiDigestPasswordValidationCallbackHandlerTest.java b/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiDigestPasswordValidationCallbackHandlerTest.java
deleted file mode 100644
index 6f596675..00000000
--- a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiDigestPasswordValidationCallbackHandlerTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import com.sun.xml.wss.impl.callback.PasswordValidationCallback;
-import junit.framework.TestCase;
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.DisabledException;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.TestingAuthenticationToken;
-import org.acegisecurity.userdetails.User;
-import org.acegisecurity.userdetails.UserDetailsService;
-import org.acegisecurity.userdetails.UsernameNotFoundException;
-import org.easymock.MockControl;
-
-import org.springframework.ws.soap.security.callback.CleanupCallback;
-
-public class AcegiDigestPasswordValidationCallbackHandlerTest extends TestCase {
-
- private AcegiDigestPasswordValidationCallbackHandler callbackHandler;
-
- private MockControl control;
-
- private UserDetailsService mock;
-
- private String username;
-
- private String password;
-
- private PasswordValidationCallback callback;
-
- @Override
- protected void setUp() throws Exception {
- callbackHandler = new AcegiDigestPasswordValidationCallbackHandler();
- control = MockControl.createControl(UserDetailsService.class);
- mock = (UserDetailsService) control.getMock();
- callbackHandler.setUserDetailsService(mock);
- username = "Bert";
- password = "Ernie";
- String nonce = "9mdsYDCrjjYRur0rxzYt2oD7";
- String passwordDigest = "kwNstEaiFOrI7B31j7GuETYvdgk=";
- String creationTime = "2006-06-01T23:48:42Z";
- PasswordValidationCallback.DigestPasswordRequest request =
- new PasswordValidationCallback.DigestPasswordRequest(username, passwordDigest, nonce, creationTime);
- callback = new PasswordValidationCallback(request);
- }
-
- @Override
- protected void tearDown() throws Exception {
- SecurityContextHolder.clearContext();
- }
-
- public void testAuthenticateUserDigestUserNotFound() throws Exception {
- control.expectAndThrow(mock.loadUserByUsername(username), new UsernameNotFoundException(username));
- control.replay();
- callbackHandler.handleInternal(callback);
- boolean authenticated = callback.getResult();
- assertFalse("Authenticated", authenticated);
- assertNull("Authentication created", SecurityContextHolder.getContext().getAuthentication());
- control.verify();
- }
-
- public void testAuthenticateUserDigestValid() throws Exception {
- User user = new User(username, password, true, true, true, true, new GrantedAuthority[0]);
- control.expectAndReturn(mock.loadUserByUsername(username), user);
- control.replay();
- callbackHandler.handleInternal(callback);
- boolean authenticated = callback.getResult();
- assertTrue("Not authenticated", authenticated);
- assertNotNull("No Authentication created", SecurityContextHolder.getContext().getAuthentication());
- control.verify();
- }
-
- public void testAuthenticateUserDigestValidInvalid() throws Exception {
- User user = new User(username, "Big bird", true, true, true, true, new GrantedAuthority[0]);
- control.expectAndReturn(mock.loadUserByUsername(username), user);
- control.replay();
- callbackHandler.handleInternal(callback);
- boolean authenticated = callback.getResult();
- assertFalse("Authenticated", authenticated);
- assertNull("Authentication created", SecurityContextHolder.getContext().getAuthentication());
- control.verify();
- }
-
- public void testAuthenticateUserDigestDisbaled() throws Exception {
- User user = new User(username, "Ernie", false, true, true, true, new GrantedAuthority[0]);
- control.expectAndReturn(mock.loadUserByUsername(username), user);
- control.replay();
- try {
- callbackHandler.handleInternal(callback);
- fail("disabled user authenticated");
- } catch (
- DisabledException expected) {
- }
- }
-
- public void testCleanUp() throws Exception {
- TestingAuthenticationToken authentication =
- new TestingAuthenticationToken(new Object(), new Object(), new GrantedAuthority[0]);
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- CleanupCallback cleanupCallback = new CleanupCallback();
- callbackHandler.handleInternal(cleanupCallback);
- assertNull("Authentication created", SecurityContextHolder.getContext().getAuthentication());
- }
-
-}
\ No newline at end of file
diff --git a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandlerTest.java b/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandlerTest.java
deleted file mode 100644
index 40b10896..00000000
--- a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiPlainTextPasswordValidationCallbackHandlerTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import com.sun.xml.wss.impl.callback.PasswordValidationCallback;
-import junit.framework.TestCase;
-import org.acegisecurity.Authentication;
-import org.acegisecurity.AuthenticationManager;
-import org.acegisecurity.BadCredentialsException;
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.TestingAuthenticationToken;
-import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
-import org.easymock.MockControl;
-
-import org.springframework.ws.soap.security.callback.CleanupCallback;
-
-public class AcegiPlainTextPasswordValidationCallbackHandlerTest extends TestCase {
-
- private AcegiPlainTextPasswordValidationCallbackHandler callbackHandler;
-
- private MockControl control;
-
- private AuthenticationManager mock;
-
- private PasswordValidationCallback callback;
-
- private String username;
-
- private String password;
-
- @Override
- protected void setUp() throws Exception {
- callbackHandler = new AcegiPlainTextPasswordValidationCallbackHandler();
- control = MockControl.createControl(AuthenticationManager.class);
- mock = (AuthenticationManager) control.getMock();
- callbackHandler.setAuthenticationManager(mock);
- username = "Bert";
- password = "Ernie";
- PasswordValidationCallback.PlainTextPasswordRequest request =
- new PasswordValidationCallback.PlainTextPasswordRequest(username, password);
- callback = new PasswordValidationCallback(request);
- }
-
- @Override
- protected void tearDown() throws Exception {
- SecurityContextHolder.clearContext();
- }
-
- public void testAuthenticateUserPlainTextValid() throws Exception {
- Authentication authResult = new TestingAuthenticationToken(username, password, new GrantedAuthority[0]);
- control.expectAndReturn(mock.authenticate(new UsernamePasswordAuthenticationToken(username, password)),
- authResult);
- control.replay();
- callbackHandler.handleInternal(callback);
- boolean authenticated = callback.getResult();
- assertTrue("Not authenticated", authenticated);
- assertNotNull("No Authentication created", SecurityContextHolder.getContext().getAuthentication());
- control.verify();
- }
-
- public void testAuthenticateUserPlainTextInvalid() throws Exception {
- control.expectAndThrow(mock.authenticate(new UsernamePasswordAuthenticationToken(username, password)),
- new BadCredentialsException(""));
- control.replay();
- callbackHandler.handleInternal(callback);
- boolean authenticated = callback.getResult();
- assertFalse("Authenticated", authenticated);
- assertNull("Authentication created", SecurityContextHolder.getContext().getAuthentication());
- control.verify();
- }
-
- public void testCleanUp() throws Exception {
- TestingAuthenticationToken authentication =
- new TestingAuthenticationToken(new Object(), new Object(), new GrantedAuthority[0]);
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- CleanupCallback cleanupCallback = new CleanupCallback();
- callbackHandler.handleInternal(cleanupCallback);
- assertNull("Authentication created", SecurityContextHolder.getContext().getAuthentication());
- }
-
-}
\ No newline at end of file
diff --git a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiUsernamePasswordCallbackHandlerTest.java b/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiUsernamePasswordCallbackHandlerTest.java
deleted file mode 100644
index 2952575b..00000000
--- a/security/src/test/java/org/springframework/ws/soap/security/xwss/callback/acegi/AcegiUsernamePasswordCallbackHandlerTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2005-2010 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.soap.security.xwss.callback.acegi;
-
-import com.sun.xml.wss.impl.callback.PasswordCallback;
-import com.sun.xml.wss.impl.callback.UsernameCallback;
-import junit.framework.TestCase;
-import org.acegisecurity.Authentication;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
-
-public class AcegiUsernamePasswordCallbackHandlerTest extends TestCase {
-
- private AcegiUsernamePasswordCallbackHandler handler;
-
- @Override
- protected void setUp() throws Exception {
- handler = new AcegiUsernamePasswordCallbackHandler();
- Authentication authentication = new UsernamePasswordAuthenticationToken("Bert", "Ernie");
- SecurityContextHolder.getContext().setAuthentication(authentication);
- }
-
- @Override
- protected void tearDown() throws Exception {
- SecurityContextHolder.clearContext();
- }
-
- public void testUsernameCallback() throws Exception {
- UsernameCallback usernameCallback = new UsernameCallback();
- handler.handleInternal(usernameCallback);
- assertEquals("Invalid username", "Bert", usernameCallback.getUsername());
- }
-
- public void testPasswordCallback() throws Exception {
- PasswordCallback passwordCallback = new PasswordCallback();
- handler.handleInternal(passwordCallback);
- assertEquals("Invalid username", "Ernie", passwordCallback.getPassword());
- }
-}
\ No newline at end of file