From 7d60695aaaf715e9e79ac8c7aa0107573c164870 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 8 Jul 2010 13:02:30 +0000 Subject: Add some wsdli:location validation git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@961748 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/ws/xml/WebServiceBindingProcessor.java | 11 ++++++++--- .../resources/binding-wsxml-validation-messages.properties | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'sca-java-2.x/trunk/modules/binding-ws/src/main') diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java index 0b81dbbb5a..b388311987 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java @@ -33,7 +33,6 @@ import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.extensions.soap.SOAPAddress; -import javax.wsdl.extensions.soap.SOAPBinding; import javax.wsdl.extensions.soap12.SOAP12Address; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; @@ -236,8 +235,14 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem // Read wsdlLocation wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION)); - if (wsdlElement == null && wsBinding.getLocation() != null) { - error(monitor, "WsdliLocationMissingWsdlElement", reader); + if (wsBinding.getLocation() != null) { + if (wsdlElement == null) { + error(monitor, "WsdliLocationMissingWsdlElement", reader); + } + String[] iris = wsBinding.getLocation().split(" "); + if (iris.length % 2 != 0) { + error(monitor, "WsdliLocationNotIRIPairs", reader); + } } // Skip to end element diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties b/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties index b5ede881e7..4c2a857d6c 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties @@ -25,6 +25,7 @@ WsdlBindingDoesNotMatch = The #wsdl.binding({0}) not found in the available WSDL WsdlServiceDoesNotMatch = [BWS20005] The #wsdl.service({0}) not found in the available WSDL Definitions WsdlPortTypeDoesNotMatch = The #wsdl.port({0}) does not match with the WSDL Definitions WsdliLocationMissingWsdlElement = [BWS20017] binding.ws has a @wsdli:wsdlLocation attribute but no @wsdlElement attribute +WsdliLocationNotIRIPairs = The binding.ws @wsdli:wsdlLocation attribute MUST be a list of pairs of IRIs URINotAbsolute = [BWS20001] The URI value for binding.ws on an SCA reference must be absolute. Non-absolute value found {0} InvalidURISyntax = The URI value {0} found on binding.ws has invalid syntax WSDLServiceOnService = [BWS20003] The wsdlElement attribute of a binding.ws on an SCA service must not specify the wsdl.service form of URI. The following URI was found {0} -- cgit v1.2.3