axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r491172 - in /webservices/axis/trunk/c: src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java tests/auto_build/testcases/wsdls/FaultMappingDoc.wsdl
Date Sat, 30 Dec 2006 05:48:26 GMT
Author: nadiramra
Date: Fri Dec 29 21:48:25 2006
New Revision: 491172

URL: http://svn.apache.org/viewvc?view=rev&rev=491172
Log:
AXISCPP-1004 - Compile errors in code generated for fault element with anonymous type

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
    webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/FaultMappingDoc.wsdl

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java?view=diff&rev=491172&r1=491171&r2=491172
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java Fri Dec 29
21:48:25 2006
@@ -669,6 +669,7 @@
         
         exposeReferenceTypes(wsContext);
         exposeMessagePartsThatAreAnonymousTypes(wsContext);
+        // This call must be last one called of the exposexxx methods!
         exposeNestedTypesThatAreAnonymousTypes(wsContext);
         
         if (WSDL2Ws.verbose)
@@ -1138,6 +1139,25 @@
                     {
                           MethodInfo method = (MethodInfo)methods.get(i);
                           
+                          // Check for faults that need to be externalized
+                          Collection faultTypes = method.getFaultType();
+                          Iterator faultIterator = faultTypes.iterator();
+                          while(faultIterator.hasNext())
+                          {
+                              FaultInfo faultType = (FaultInfo)faultIterator.next();
+                              Collection parameterTypes = faultType.getParams();
+                              Iterator paramIterator = parameterTypes.iterator();
+                              while(paramIterator.hasNext())
+                              {
+                                  ParameterInfo parameterInfo =(ParameterInfo)paramIterator.next();
+                                  Type parameterType = parameterInfo.getType();
+
+                                  if(WSDL2Ws.verbose)
+                                      System.out.println( "EXPOSE2: Exposing fault type "+parameterType.getName());
+                                  externalizeTypeAndUpdateTypeMap(wsContext, parameterType);
+                              }                              
+                          }
+
                           // Check input parameters
                           Collection inputParameterTypes = method.getInputParameterTypes();
                           Iterator paramIterator = inputParameterTypes.iterator();
@@ -1149,20 +1169,7 @@
                               {
                                   if(WSDL2Ws.verbose)
                                       System.out.println( "EXPOSE2: Matches input parm, exposing
anon type "+parameterType.getName());
-                         
-                                  QName oldName = parameterType.getName();
-                                  Type innerClassType =  wsContext.getTypemap().getType(oldName);
-                                  if (innerClassType != null && !innerClassType.isExternalized())
-                                  {
-                                      QName newTypeName   =  new QName(parameterType.getName().getNamespaceURI(),

-                                                                       parameterType.getLanguageSpecificName());
-
-                                      innerClassType.externalize(newTypeName);
-                                      
-                                      // Update the typemap with new info
-                                      wsContext.getTypemap().removeType(oldName);
-                                      wsContext.getTypemap().addType(newTypeName, innerClassType);
-                                  }
+                                  externalizeTypeAndUpdateTypeMap(wsContext, parameterType);
                               }
                           }
                           
@@ -1176,21 +1183,8 @@
                               if(parameterType.getName().equals(type.getQName()))
                               {
                                   if(WSDL2Ws.verbose)
-                                      System.out.println( "EXPOSE2: Matches output parm,
exposing anon type "+parameterType.getName());
-                              
-                                  QName oldName = parameterType.getName();
-                                  Type innerClassType =  wsContext.getTypemap().getType(oldName);
-                                  if (innerClassType != null && !innerClassType.isExternalized())
-                                  {
-                                      QName newTypeName   =  new QName(parameterType.getName().getNamespaceURI(),

-                                                                       parameterType.getLanguageSpecificName());
-
-                                      innerClassType.externalize(newTypeName);
-
-                                      // Update the typemap with new info
-                                      wsContext.getTypemap().removeType(oldName);
-                                      wsContext.getTypemap().addType(newTypeName, innerClassType);
-                                  }
+                                      System.out.println( "EXPOSE2: Matches output parm,
exposing anon type "+parameterType.getName());                             
+                                  externalizeTypeAndUpdateTypeMap(wsContext, parameterType);
                               }
                           }
                     }
@@ -1286,6 +1280,23 @@
         }
     }
 
+    private void externalizeTypeAndUpdateTypeMap(WebServiceContext wsContext, Type parameterType)
+    {
+        QName oldName = parameterType.getName();
+        Type innerClassType =  wsContext.getTypemap().getType(oldName);
+        if (innerClassType != null && !innerClassType.isExternalized())
+        {
+            QName newTypeName   =  new QName(parameterType.getName().getNamespaceURI(), 
+                                             parameterType.getLanguageSpecificName());
+
+            innerClassType.externalize(newTypeName);
+            
+            // Update the typemap with new info
+            wsContext.getTypemap().removeType(oldName);
+            wsContext.getTypemap().addType(newTypeName, innerClassType);
+        }
+    }
+    
     public static void usage()
     {
         System.out.println(

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/FaultMappingDoc.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/FaultMappingDoc.wsdl?view=diff&rev=491172&r1=491171&r2=491172
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/FaultMappingDoc.wsdl (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/FaultMappingDoc.wsdl Fri Dec
29 21:48:25 2006
@@ -45,14 +45,15 @@
     </sequence>
    </complexType>
    <element name="OutOfBoundStruct" nillable="true" type="impl:OutOfBoundStruct"/>
-   <complexType name="DivByZeroStruct">
-    <sequence>
-     <element name="varString" nillable="true" type="xsd:string"/>
-     <element name="varInt" type="xsd:int"/>
-     <element name="varFloat" type="xsd:float"/>
-    </sequence>
-   </complexType>
-   <element name="DivByZeroStruct" nillable="true" type="impl:DivByZeroStruct"/>
+   <element name="DivByZeroStruct" nillable="true">
+   		<complexType>
+    		<sequence>
+     			<element name="varString" nillable="true" type="xsd:string"/>
+     			<element name="varInt" type="xsd:int"/>
+     			<element name="varFloat" type="xsd:float"/>
+    		</sequence>
+   		</complexType>   
+   </element>
    <element name="SpecialDetailStruct" nillable="true" type="impl:SpecialDetailStruct"/>
   </schema>
  </wsdl:types>



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


Mime
View raw message