You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2006/07/14 08:30:09 UTC

svn commit: r421814 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl: codegen/extension/SchemaUnwrapperExtension.java i18n/resource.properties

Author: ajith
Date: Thu Jul 13 23:30:08 2006
New Revision: 421814

URL: http://svn.apache.org/viewvc?rev=421814&view=rev
Log:
1. Added a check to the SchemaUnwrapperExtension.java to find whether we are processing a schema that adheres to the 'unwrappable' style
2. Added the message to the resource.properties file

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?rev=421814&r1=421813&r2=421814&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java Thu Jul 13 23:30:08 2006
@@ -19,6 +19,8 @@
 import org.apache.ws.commons.schema.XmlSchemaParticle;
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaChoice;
+import org.apache.ws.commons.schema.XmlSchemaAll;
 
 import javax.xml.namespace.QName;
 import java.util.Iterator;
@@ -84,6 +86,15 @@
 
     /**
      * walk the given schema element
+     * For a successful unwrapping the element should have the
+     * following structure
+     * < element >
+     *      < complexType >
+     *          < sequence >
+     *              < element />
+     *          < /sequence >
+     *      < /complexType >
+     * < /element >
      */
 
     public void walkSchema(AxisMessage message,CodeGenConfiguration config)
@@ -94,6 +105,12 @@
         }
 
         XmlSchemaType schemaType = message.getSchemaElement().getSchemaType();
+        if (schemaType.getQName()!=null){
+            throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
+                    "named type","anonymous type"));
+        }
+       
+
         //create a type mapper
         if (schemaType instanceof XmlSchemaComplexType){
             XmlSchemaComplexType cmplxType = (XmlSchemaComplexType)schemaType;
@@ -132,14 +149,12 @@
                                         WSDLConstants.INPUT_PART_QNAME_SUFFIX,
                                         partName));
 
-
-                    }else{
                         // if the particle contains anything other than
                         // a XMLSchemaElement then we are not in a position
                         // to unwrap it
-                        //in this case just do nothing and return breaking
-                        //the whole thing
-                        return;
+                    }else{
+                        throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
+                                "unknown type","Element"));
                     }
                 }
 
@@ -164,16 +179,26 @@
                     throw new CodeGenerationException(axisFault);
                 }
 
-
-            }else{
                 //we do not know how to deal with other particles
                 //such as xs:all or xs:choice. Usually occurs when
                 //passed with the user built WSDL where the style
                 //is document. We'll just return here doing nothing
-
+            }else if (particle instanceof XmlSchemaChoice){
+                  throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
+                                "choice","sequence"));
+
+            }else if (particle instanceof XmlSchemaAll){
+                  throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
+                                "all","sequence"));
+            }else{
+                throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
+                                "unknown","sequence"));
             }
         }else{
-            //we've no idea how to unwrap a non complexYype!!!!!!
+             //we've no idea how to unwrap a non complexYype!!!!!!
+             throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
+                                "unknown","complexType"));
+
         }
 
     }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties?rev=421814&r1=421813&r2=421814&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties Thu Jul 13 23:30:08 2006
@@ -69,6 +69,7 @@
 extension.databindingMismatch=The specified databinding frameworks do not match!
 extension.unhandledSchemaConstruct=Unhandled schema construct!
 extension.unsupportedforunwrapping=Unsupported framework for unwrapping!
+extension.unsupportedSchemaFormat=Unsupported Schema format for unwrapping! found {0} but expected {1}
 
 emitter.unknownStyle=Unknown code generation style {0}
 emitter.cannotFindBinding=Cannot find a binding!!



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org