Author: ramkumar
Date: Tue May 12 08:47:30 2009
New Revision: 773823

URL: http://svn.apache.org/viewvc?rev=773823&view=rev
Log:
Fix for TUSCANY-2962

Modified:
    
tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
    
tuscany/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java?rev=773823&r1=773822&r2=773823&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
 Tue May 12 08:47:30 2009
@@ -22,6 +22,7 @@
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
 
+import java.util.List;
 import java.util.Map;
 
 import javax.wsdl.Binding;
@@ -69,6 +70,8 @@
 import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
+import com.ibm.wsdl.OperationImpl;
+
 /**
  * This is the StAXArtifactProcessor for the Web Services Binding.
  *
@@ -421,6 +424,19 @@
 
             PortType portType = getPortType(model);
             if (portType != null) {
+               // Introspect the WSDL portType and validate the input/output 
messages.
+               List<OperationImpl> operations = portType.getOperations();
+               for (OperationImpl operation : operations) {
+                       if (operation.getInput().getMessage() == null) {
+                               ContributionResolveException ce = new 
ContributionResolveException("WSDL binding operation input name " + 
operation.getInput().getName() + " does not match with PortType Definition");
+                        error("ContributionResolveException", wsdlDefinition, 
ce);
+                       }
+                       if (operation.getOutput().getMessage() == null) {
+                               ContributionResolveException ce = new 
ContributionResolveException("WSDL binding operation output name " + 
operation.getOutput().getName() + " does not match with PortType Definition");
+                        error("ContributionResolveException", wsdlDefinition, 
ce);
+                       }
+               }               
+               
                 WSDLInterfaceContract interfaceContract = 
wsdlFactory.createWSDLInterfaceContract();
                 WSDLInterface wsdlInterface = null;
                 try {

Modified: 
tuscany/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java?rev=773823&r1=773822&r2=773823&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
 Tue May 12 08:47:30 2009
@@ -21,6 +21,7 @@
 
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 
+import java.util.List;
 import javax.wsdl.PortType;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -45,9 +46,11 @@
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationImpl;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.Problem;
 import org.apache.tuscany.sca.monitor.Problem.Severity;
+import com.ibm.wsdl.OperationImpl;
 
 /**
  *
@@ -251,7 +254,21 @@
                     
wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
                     wsdlDefinition.setUnresolved(false);
                     WSDLObject<PortType> portType = 
wsdlDefinition.getWSDLObject(PortType.class, wsdlInterface.getName());
-                    if (portType != null) {                        
+                    if (portType != null) {
+                       // Introspect the WSDL portType and validate 
+                       // the input/output messages.
+                       List<OperationImpl> operations = 
portType.getElement().getOperations();
+                       for (OperationImpl operation : operations) {
+                               if (operation.getInput().getMessage() == null) {
+                                       ContributionResolveException ce = new 
ContributionResolveException("WSDL binding operation input name " + 
operation.getInput().getName() + " does not match with PortType Definition");
+                                error("ContributionResolveException", 
wsdlDefinition, ce);
+                               }
+                               if (operation.getOutput().getMessage() == null) 
{
+                                       ContributionResolveException ce = new 
ContributionResolveException("WSDL binding operation output name " + 
operation.getOutput().getName() + " does not match with PortType Definition");
+                                error("ContributionResolveException", 
wsdlDefinition, ce);
+                               }
+                       }
+                       
                         // Introspect the WSDL portType and add the resulting
                         // WSDLInterface to the resolver
                         try {


Reply via email to