Added more logging
This commit is contained in:
@@ -32,6 +32,9 @@ import javax.wsdl.PortType;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -43,6 +46,9 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public abstract class AbstractPortTypesProvider implements PortTypesProvider {
|
||||
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private String portTypeName;
|
||||
|
||||
/** Returns the port type name used for this definition. */
|
||||
@@ -80,7 +86,11 @@ public abstract class AbstractPortTypesProvider implements PortTypesProvider {
|
||||
* @see #setPortTypeName(String)
|
||||
*/
|
||||
protected void populatePortType(Definition definition, PortType portType) throws WSDLException {
|
||||
portType.setQName(new QName(definition.getTargetNamespace(), getPortTypeName()));
|
||||
QName portTypeName = new QName(definition.getTargetNamespace(), getPortTypeName());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating port type [" + portTypeName + "]");
|
||||
}
|
||||
portType.setQName(portTypeName);
|
||||
}
|
||||
|
||||
private void createOperations(Definition definition, PortType portType) throws WSDLException {
|
||||
@@ -97,6 +107,9 @@ public abstract class AbstractPortTypesProvider implements PortTypesProvider {
|
||||
messages.add(message);
|
||||
}
|
||||
}
|
||||
if (operations.isEmpty() && logger.isWarnEnabled()) {
|
||||
logger.warn("No operations were created, make sure the WSDL contains messages");
|
||||
}
|
||||
for (Iterator iterator = operations.keySet().iterator(); iterator.hasNext();) {
|
||||
String operationName = (String) iterator.next();
|
||||
Operation operation = definition.createOperation();
|
||||
@@ -125,6 +138,10 @@ public abstract class AbstractPortTypesProvider implements PortTypesProvider {
|
||||
}
|
||||
operation.setStyle(getOperationType(operation));
|
||||
operation.setUndefined(false);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(
|
||||
"Adding operation [" + operation.getName() + "] to port type [" + portType.getQName() + "]");
|
||||
}
|
||||
portType.addOperation(operation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ import javax.wsdl.Service;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -48,6 +51,9 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class DefaultConcretePartProvider implements BindingsProvider, ServicesProvider {
|
||||
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private String bindingSuffix;
|
||||
|
||||
private String serviceName;
|
||||
@@ -101,6 +107,9 @@ public class DefaultConcretePartProvider implements BindingsProvider, ServicesPr
|
||||
definition.addBinding(binding);
|
||||
}
|
||||
}
|
||||
if (definition.getBindings().isEmpty() && logger.isWarnEnabled()) {
|
||||
logger.warn("No bindings were created, make sure the WSDL contains port types");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,8 +125,12 @@ public class DefaultConcretePartProvider implements BindingsProvider, ServicesPr
|
||||
protected void populateBinding(Definition definition, Binding binding) throws WSDLException {
|
||||
QName portTypeName = binding.getPortType().getQName();
|
||||
if (portTypeName != null) {
|
||||
binding.setQName(
|
||||
new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + getBindingSuffix()));
|
||||
QName bindingName =
|
||||
new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + getBindingSuffix());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating binding [" + bindingName + "]");
|
||||
}
|
||||
binding.setQName(bindingName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,6 +276,9 @@ public class DefaultConcretePartProvider implements BindingsProvider, ServicesPr
|
||||
protected void populateService(Definition definition, Service service) throws WSDLException {
|
||||
if (StringUtils.hasText(definition.getTargetNamespace()) && StringUtils.hasText(getServiceName())) {
|
||||
QName serviceName = new QName(definition.getTargetNamespace(), getServiceName());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating service [" + serviceName + "]");
|
||||
}
|
||||
service.setQName(serviceName);
|
||||
}
|
||||
}
|
||||
@@ -283,9 +299,15 @@ public class DefaultConcretePartProvider implements BindingsProvider, ServicesPr
|
||||
}
|
||||
populatePort(definition, port);
|
||||
if (StringUtils.hasText(port.getName())) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Adding port [" + port.getName() + "] to service [" + service.getQName() + "]");
|
||||
}
|
||||
service.addPort(port);
|
||||
}
|
||||
}
|
||||
if (service.getPorts().isEmpty() && logger.isWarnEnabled()) {
|
||||
logger.warn("No ports were created, make sure the WSDL contains bindings");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,7 +321,8 @@ public class DefaultConcretePartProvider implements BindingsProvider, ServicesPr
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populatePort(Definition definition, Port port) throws WSDLException {
|
||||
port.setName(port.getBinding().getQName().getLocalPart());
|
||||
String portName = port.getBinding().getQName().getLocalPart();
|
||||
port.setName(portName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import javax.wsdl.extensions.ExtensibilityElement;
|
||||
import javax.wsdl.extensions.schema.Schema;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -42,6 +44,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class DefaultMessagesProvider implements MessagesProvider {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DefaultMessagesProvider.class);
|
||||
|
||||
public void addMessages(Definition definition) throws WSDLException {
|
||||
Types types = definition.getTypes();
|
||||
Assert.notNull(types, "No types element present in definition");
|
||||
@@ -54,11 +58,17 @@ public class DefaultMessagesProvider implements MessagesProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (definition.getMessages().isEmpty() && logger.isWarnEnabled()) {
|
||||
logger.warn("No messages were created, make sure the referenced schema(s) contain elements");
|
||||
}
|
||||
}
|
||||
|
||||
private void createMessages(Definition definition, Element schemaElement) throws WSDLException {
|
||||
String schemaTargetNamespace = schemaElement.getAttribute("targetNamespace");
|
||||
Assert.hasText("No targetNamespace defined on schema");
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Looking for elements in schema with target namespace [" + schemaTargetNamespace + "]");
|
||||
}
|
||||
NodeList children = schemaElement.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
Node child = children.item(i);
|
||||
@@ -103,7 +113,11 @@ public class DefaultMessagesProvider implements MessagesProvider {
|
||||
* @throws WSDLException in case of errors
|
||||
*/
|
||||
protected void populateMessage(Definition definition, Message message, QName elementName) throws WSDLException {
|
||||
message.setQName(new QName(definition.getTargetNamespace(), elementName.getLocalPart()));
|
||||
QName messageName = new QName(definition.getTargetNamespace(), elementName.getLocalPart());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating message [" + messageName + "]");
|
||||
}
|
||||
message.setQName(messageName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,8 @@ import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
@@ -42,6 +44,8 @@ import org.springframework.xml.xsd.XsdSchemaCollection;
|
||||
*/
|
||||
public class InliningXsdSchemaTypesProvider extends TransformerObjectSupport implements TypesProvider {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(InliningXsdSchemaTypesProvider.class);
|
||||
|
||||
/** The prefix used to register the schema namespace in the WSDL. */
|
||||
public static final String SCHEMA_PREFIX = "sch";
|
||||
|
||||
@@ -78,6 +82,9 @@ public class InliningXsdSchemaTypesProvider extends TransformerObjectSupport imp
|
||||
Types types = definition.createTypes();
|
||||
XsdSchema[] schemas = schemaCollection.getXsdSchemas();
|
||||
for (int i = 0; i < schemas.length; i++) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Inling " + schemas[i]);
|
||||
}
|
||||
if (schemas.length == 1) {
|
||||
definition.addNamespace(SCHEMA_PREFIX, schemas[i].getTargetNamespace());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user