ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r327218 - /webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceCapabilityImpl.java
Date Fri, 21 Oct 2005 16:33:06 GMT
Author: scamp
Date: Fri Oct 21 09:32:57 2005
New Revision: 327218

URL: http://svn.apache.org/viewcvs?rev=327218&view=rev
Log:
added a check and a better message for when Operations messages and its faults messages are
underfined and thus the wsdl imports are messed up...

Modified:
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceCapabilityImpl.java

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceCapabilityImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceCapabilityImpl.java?rev=327218&r1=327217&r2=327218&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceCapabilityImpl.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceCapabilityImpl.java
Fri Oct 21 09:32:57 2005
@@ -22,6 +22,7 @@
 import org.apache.ws.util.WsrfWsdlUtils;
 import javax.wsdl.Binding;
 import javax.wsdl.Definition;
+import javax.wsdl.Fault;
 import javax.wsdl.Import;
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
@@ -32,6 +33,7 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -583,7 +585,7 @@
       return importIsRedundant;
    }
 
-   private void initCustomOperations(  )
+   private void initCustomOperations(  ) throws InvalidWsrfWsdlException
    {
       Set  customOpNames = new HashSet(  );
       Set  inheritedOps = getInheritedOperations(  );
@@ -591,6 +593,8 @@
       for ( int i = 0; i < ops.size(  ); i++ )
       {
          Operation op = (Operation) ops.get( i );
+         validateOperationIsDefined(op);
+         
          if ( !isInheritedOperation( inheritedOps, op ) )
          {
             customOpNames.add( op.getName(  ) );
@@ -599,6 +603,32 @@
 
       m_customOpNames = (String[]) customOpNames.toArray( new String[0] );
    }
+
+/**
+ * Determines if the given Operation's messages, and its fault's messages, are defined, thereby
ruling out 
+ * missing WSDL imports and avoiding potential generation issues.
+ * 
+ * @param op
+ * @throws InvalidWsrfWsdlException
+ */
+private void validateOperationIsDefined(Operation op) throws InvalidWsrfWsdlException {
+	if(op.getInput().getMessage().isUndefined() == true)
+	 {
+		 throw new InvalidWsrfWsdlException("The import for the namespace: " + op.getInput().getMessage().getQName().getNamespaceURI()
+ " was either undefined or is invalid.  Please check your WSDL imports."); 
+	 }
+	 if(op.getOutput().getMessage().isUndefined() == true)
+	 {
+		 throw new InvalidWsrfWsdlException("The import for the namespace: " + op.getInput().getMessage().getQName().getNamespaceURI()
+ " was either undefined or is invalid.  Please check your WSDL imports."); 
+	 }
+	 Iterator iterator = op.getFaults().values().iterator();
+	 while (iterator.hasNext()) {
+		 Fault fault = (Fault) iterator.next();
+		 if(fault.getMessage().isUndefined() == true)
+		 {
+			 throw new InvalidWsrfWsdlException("The import for the namespace: " + op.getInput().getMessage().getQName().getNamespaceURI()
+ " was either undefined or is invalid.  Please check your WSDL imports.");
+		 }
+	}
+}
 
    private void initImplementedPortTypes(  )
    throws InvalidWsrfWsdlException



Mime
View raw message