You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2011/05/12 09:45:18 UTC

svn commit: r1102192 - /geronimo/bundles/trunk/axis2/src/main/java/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Author: xuhaihong
Date: Thu May 12 07:45:17 2011
New Revision: 1102192

URL: http://svn.apache.org/viewvc?rev=1102192&view=rev
Log:
Try the patch AXIS2-5034 from Geronimo side

Modified:
    geronimo/bundles/trunk/axis2/src/main/java/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: geronimo/bundles/trunk/axis2/src/main/java/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/bundles/trunk/axis2/src/main/java/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=1102192&r1=1102191&r2=1102192&view=diff
==============================================================================
--- geronimo/bundles/trunk/axis2/src/main/java/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ geronimo/bundles/trunk/axis2/src/main/java/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Thu May 12 07:45:17 2011
@@ -156,7 +156,7 @@ public class WSDL11ToAxisServiceBuilder 
 
     /**
      * List of BindingOperationEntry objects.
-     * Each object in the list may require a wrapped schema element for
+     * Each object in the list may require a wrapped schema element for 
      * the input/output or both.
      */
     private List wrappableBOEs = new ArrayList();
@@ -318,14 +318,14 @@ public class WSDL11ToAxisServiceBuilder 
             // setting target name space
             axisService.setTargetNamespace(wsdl4jDefinition.getTargetNamespace());
             axisService.setNamespaceMap(new NamespaceMap(wsdl4jDefinition.getNamespaces()));
-
+            
             Map importsMap = wsdl4jDefinition.getImports();
-
+            
             if (importsMap != null) {
                 List imports = new ArrayList(importsMap.keySet());
                 axisService.setImportedNamespaces(imports);
             }
-
+            
             //TODO : find the service also in imported wsdls
             Service wsdl4jService = findService(wsdl4jDefinition);
 
@@ -618,7 +618,7 @@ public class WSDL11ToAxisServiceBuilder 
      * This method is used for adding documentation for the message types of the service operations
      * eg: input message
      *     output message
-     *     fault messages
+     *     fault messages 
      *
      * @param axisOperation
      * @param documentationElement
@@ -634,7 +634,7 @@ public class WSDL11ToAxisServiceBuilder 
             }
         }
     }
-
+    
     private void populateBinding(AxisBinding axisBinding,
                                  Binding wsdl4jBinding,
                                  Definition bindingWSDL,
@@ -879,7 +879,7 @@ public class WSDL11ToAxisServiceBuilder 
                         Message wsdl4jFaultMessge = wsdl4jFault.getMessage();
 
                         AxisMessage faultMessage = findFaultMessage(
-                                wsdl4jFault.getName(),
+                                wsdl4jFaultMessge.getQName().getLocalPart(),
                                 axisOperation.getFaultMessages());
 
                         AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage();
@@ -1415,7 +1415,7 @@ public class WSDL11ToAxisServiceBuilder 
             axisOperation.setPolicyInclude(policyInclude);
         }
 
-        copyExtensionAttributes(wsdl4jOperation.getExtensionAttributes(),
+        copyExtensionAttributes(wsdl4jOperation.getExtensionAttributes(), 
                                axisOperation, PORT_TYPE_OPERATION);
 
         Input wsdl4jInputMessage = wsdl4jOperation.getInput();
@@ -1553,7 +1553,7 @@ public class WSDL11ToAxisServiceBuilder 
             Message faultMessage = fault.getMessage();
             if (null != faultMessage) {
                 axisFaultMessage
-                        .setName(fault.getName());
+                        .setName(faultMessage.getQName().getLocalPart());
 
                 copyExtensibleElements(faultMessage.getExtensibilityElements(),
                                        dif, axisFaultMessage, PORT_TYPE_OPERATION_FAULT);
@@ -1572,7 +1572,7 @@ public class WSDL11ToAxisServiceBuilder 
             if (action != null) {
                 axisOperation.addFaultAction(fault.getName(), action);
             }
-
+            
             // Also add mapping from Exception name to fault action
             String faultMessageName = axisFaultMessage.getName();
             if (null != faultMessageName) {
@@ -1583,7 +1583,7 @@ public class WSDL11ToAxisServiceBuilder 
                 if (log.isDebugEnabled()) {
                     log.debug("Searching for fault action using faultMessageName = "+faultMessageName+", exceptionClassName = "+exceptionClassName);
                 }
-
+            
                 String faultAction = axisOperation.getFaultAction(exceptionClassName);
                 if (faultAction == null) {
                     faultAction = WSDL11ActionHelper.getActionFromFaultElement(dif,
@@ -1602,7 +1602,7 @@ public class WSDL11ToAxisServiceBuilder 
                     }
                 }
             }
-
+            
             axisOperation.setFaultMessages(axisFaultMessage);
         }
         return axisOperation;
@@ -1652,7 +1652,7 @@ public class WSDL11ToAxisServiceBuilder 
      * @param namespaceURI - namespace of the porttype uri.
      *  we use this only if a user has not specified a namespace in soap:body
      * @param boeListToProcess - List of BindingOperationEntry objects which require wrappering
-     *
+     *                     
      * @return null if there is no element
      */
     private Map createSchemaForPorttype(String namespaceURI,
@@ -1744,7 +1744,7 @@ public class WSDL11ToAxisServiceBuilder 
                     partsCollection = message.getParts().values();
                 }
 
-                List parameterOrder =
+                List parameterOrder = 
                    boEntry.getBindingOperation().getOperation().getParameterOrdering();
                 namespaceImportsMap = new HashMap();
                 namespacePrefixMap = new HashMap();
@@ -1755,7 +1755,7 @@ public class WSDL11ToAxisServiceBuilder 
                                                          parameterOrder,
                                                          false,
                                                          namespaceImportsMap,
-                                                         namespacePrefixMap,
+                                                         namespacePrefixMap, 
                                                          boEntry);
 
                 elementDeclaration.appendChild(newComplexType);
@@ -1831,7 +1831,7 @@ public class WSDL11ToAxisServiceBuilder 
                     partsCollection = message.getParts().values();
                 }
 
-                List parameterOrder =
+                List parameterOrder = 
                     boEntry.getBindingOperation().getOperation().getParameterOrdering();
 
                 // we have to initialize the hash maps always since we add the elements onece we
@@ -1995,10 +1995,10 @@ public class WSDL11ToAxisServiceBuilder 
         List partsList = null;
         ExtensibilityElement extElement;
         for (Iterator iter = extensibilityElements.iterator(); iter.hasNext();) {
-
-
+            
+            
             extElement = (ExtensibilityElement) iter.next();
-
+            
             if (log.isDebugEnabled()) {
                 log.debug("Extensibility Element type is:" + extElement.getElementType());
                 log.debug("Extensibility Element class is:" + extElement.getClass().getName());
@@ -2035,7 +2035,7 @@ public class WSDL11ToAxisServiceBuilder 
                         }
                     }
                 }
-            }
+            } 
         }
         if (partsList == null) {
             log.debug("SOAP body parts have not been set. All the parts in the message were added to the message.");
@@ -2128,7 +2128,7 @@ public class WSDL11ToAxisServiceBuilder 
                                      xsdPrefix,
                                      namespaceImportsMap,
                                      namespacePrefixMap,
-                                     cmplxTypeSequence,
+                                     cmplxTypeSequence, 
                                      isOutMessage,
                                      boe);
                     partsMap.remove(partName);
@@ -2245,7 +2245,7 @@ public class WSDL11ToAxisServiceBuilder 
                    "The binding operation " + bindingOperationName + " is RPC/literal. " +
                    "The message parts for this operation must use the type " +
                    "attribute as specificed by " +
-                   "WS-I Basic Profile specification (4.4.1).  Message part, " +
+                   "WS-I Basic Profile specification (4.4.1).  Message part, " + 
                    partName + ", violates" +
                    "this rule.  Please remove the element attribute " +
                    "and use the type attribute.");
@@ -2253,13 +2253,13 @@ public class WSDL11ToAxisServiceBuilder 
                 // The presense of an element means that a wrapper xsd element is not needed.
                 boe.setWrappedOutput(false);
                 if (log.isDebugEnabled()) {
-                    log.debug("The binding operation " + bindingOperationName +
+                    log.debug("The binding operation " + bindingOperationName + 
                               " references message part " +
                               partName + ".  This part does not use the " +
                               "type attribute, so a wrappering element is not added.");
                 }
             }
-
+            
         }
     }
 
@@ -2373,7 +2373,7 @@ public class WSDL11ToAxisServiceBuilder 
                 UnknownExtensibilityElement unknown =
                         (UnknownExtensibilityElement) (wsdl4jExtensibilityElement);
                 QName type = unknown.getElementType();
-
+                
                 // <wsp:Policy>
                 if (Constants.isPolicyElement(type)) {
                     if (isTraceEnabled) {
@@ -2381,7 +2381,7 @@ public class WSDL11ToAxisServiceBuilder 
                     }
                     Policy policy = (Policy) PolicyUtil.getPolicyComponent(unknown.getElement());
                     description.getPolicySubject().attachPolicy(policy);
-
+                    
 //                    int attachmentScope =
 //                            getPolicyAttachmentPoint(description, originOfExtensibilityElements);
 //                    if (attachmentScope > -1) {
@@ -2396,7 +2396,7 @@ public class WSDL11ToAxisServiceBuilder 
                     PolicyReference policyReference = (PolicyReference) PolicyUtil
                             .getPolicyComponent(unknown.getElement());
                     description.getPolicySubject().attachPolicyReference(policyReference);
-
+                    
 //                    int attachmentScope =
 //                            getPolicyAttachmentPoint(description, originOfExtensibilityElements);
 //                    if (attachmentScope > -1) {
@@ -2425,7 +2425,7 @@ public class WSDL11ToAxisServiceBuilder 
                         wsdl4jExtensibilityElement.getElementType().getNamespaceURI().equals(
                                 org.apache.axis2.namespace.Constants.FORMAT_BINDING)) {
                     Element typeMapping = unknown.getElement();
-
+                    
                     NodeList typeMaps = typeMapping.getElementsByTagNameNS(
                             org.apache.axis2.namespace.Constants.FORMAT_BINDING,
                             "typeMap");
@@ -2508,15 +2508,15 @@ public class WSDL11ToAxisServiceBuilder 
                 }
 
                 String soapActionURI = soapOperation.getSoapActionURI();
-
+                
                 if (this.isCodegen && ((soapActionURI == null) || (soapActionURI.equals("")))) {
                     soapActionURI = axisBindingOperation.getAxisOperation().getInputAction();
                 }
-
+                
                 if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
                     log.debug("WSDL Binding Operation: " + axisBindingOperation.getName() +
                             ", SOAPAction: " + soapActionURI);
-
+                
                 if (soapActionURI != null && !soapActionURI.equals("")) {
                     axisBindingOperation
                             .setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, soapActionURI);
@@ -2542,11 +2542,11 @@ public class WSDL11ToAxisServiceBuilder 
                 if (this.isCodegen && ((soapAction == null) || (soapAction.equals("")))) {
                     soapAction = axisBindingOperation.getAxisOperation().getInputAction();
                 }
-
+                
                 if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
                     log.debug("WSDL Binding Operation: " + axisBindingOperation.getName() +
                             ", SOAPAction: " + soapAction);
-
+                
                 if (soapAction != null && !soapAction.equals("")) {
                     axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION, soapAction);
                     axisBindingOperation.getAxisOperation().setSoapAction(soapAction);
@@ -2597,7 +2597,7 @@ public class WSDL11ToAxisServiceBuilder 
                         msg = getMessage(wsdl4jDefinition, soapHeader
                             .getMessage(), new HashSet());
                     }
-
+                    
                     if (msg == null) {
                         // TODO i18n this
                         throw new AxisFault("message "
@@ -2645,7 +2645,7 @@ public class WSDL11ToAxisServiceBuilder 
                     // find the relevant schema part from the messages
                     Message msg = wsdl4jDefinition.getMessage(soapHeader
                             .getMessage());
-
+                    
                     if (msg == null) {
                         msg = getMessage(wsdl4jDefinition, soapHeader
                             .getMessage(), new HashSet());
@@ -2745,9 +2745,9 @@ public class WSDL11ToAxisServiceBuilder 
             }
         }
     }
-
+    
     private static void setMessageSerialization(AxisBindingOperation bindingOperation,
-                                                String originOfExtensibilityElements,
+                                                String originOfExtensibilityElements, 
                                                 String messageSerialization) {
         if (bindingOperation != null) {
             if (BINDING_OPERATION_INPUT.equals(originOfExtensibilityElements)) {
@@ -2761,43 +2761,43 @@ public class WSDL11ToAxisServiceBuilder 
             }
         }
     }
-
+    
     /**
-     * Look deeper in the imports to find the requested Message. Use a HashSet to make
+     * Look deeper in the imports to find the requested Message. Use a HashSet to make 
      * sure we don't traverse the same Definition object twice (avoid recursion).
-     *
+     * 
      * @param definition
      * @param message
      * @param instances
      * @return
      */
     private Message getMessage(Definition definition, QName message, Set seen) {
-
+        
         Message msg = definition.getMessage(message);
-
-        if (msg != null) {
+        
+        if (msg != null) { 
             if (log.isDebugEnabled()) {
                 log.debug("getMessage returning = " + ((message.getLocalPart() != null) ? message.getLocalPart(): "NULL"));
             }
 
             return msg;
         }
-
+        
         seen.add(definition);
-
+        
         Iterator iter = definition.getImports().values().iterator();
-
+        
         while (iter.hasNext()) {
             Vector values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 Import wsdlImport = (Import) valuesIter.next();
                 Definition innerDefinition = wsdlImport.getDefinition();
-
-                if (seen.contains(innerDefinition)) {
+                
+                if (seen.contains(innerDefinition)) { 
                     continue; // Skip seen
                 }
                 Message result = getMessage(innerDefinition, message, seen);
-                if (result != null) {
+                if (result != null) { 
                     return result;
                 }
             }
@@ -2809,10 +2809,10 @@ public class WSDL11ToAxisServiceBuilder 
 
         return null;
     }
-
-
-
-
+ 
+    
+    
+    
     private int getPolicyAttachmentPoint(AxisDescription description,
                                          String originOfExtensibilityElements) {
         int result = -1; // Attachment Point Not Identified
@@ -2892,7 +2892,7 @@ public class WSDL11ToAxisServiceBuilder 
                 this.bindingType = BINDING_TYPE_HTTP;
             }
         }
-
+        
         if (log.isDebugEnabled()) {
             log.debug("Binding Name    =" + binding.getQName());
             log.debug("  isSOAPBinding =" + isSOAPBinding );
@@ -2912,7 +2912,7 @@ public class WSDL11ToAxisServiceBuilder 
                     binding.getBindingOperations().iterator(); bindingOperationsIterator.hasNext();)
             {
                 bindingOp = (BindingOperation) bindingOperationsIterator.next();
-
+                
                 if (log.isDebugEnabled()) {
                     log.debug("  Binding Operation  =" + bindingOp.getName());
                 }
@@ -2929,9 +2929,9 @@ public class WSDL11ToAxisServiceBuilder 
                             if (log.isDebugEnabled()) {
                                 log.debug("    schema wrappering required");
                             }
-                            BindingOperationEntry boe =
-                                new BindingOperationEntry(bindingOp,
-                                                          true,
+                            BindingOperationEntry boe = 
+                                new BindingOperationEntry(bindingOp, 
+                                                          true, 
                                                           false,
                                                           style,
                                                           true);
@@ -2942,9 +2942,9 @@ public class WSDL11ToAxisServiceBuilder 
                         if (log.isDebugEnabled()) {
                             log.debug("    schema wrappering required");
                         }
-                        BindingOperationEntry boe =
-                            new BindingOperationEntry(bindingOp,
-                                                      true,
+                        BindingOperationEntry boe = 
+                            new BindingOperationEntry(bindingOp, 
+                                                      true, 
                                                       false,
                                                       style,
                                                       true);
@@ -2956,9 +2956,9 @@ public class WSDL11ToAxisServiceBuilder 
                     if (log.isDebugEnabled()) {
                         log.debug("    schema wrappering required");
                     }
-                    BindingOperationEntry boe =
-                        new BindingOperationEntry(bindingOp,
-                                                  false,
+                    BindingOperationEntry boe = 
+                        new BindingOperationEntry(bindingOp, 
+                                                  false, 
                                                   true,
                                                   null,
                                                   false);
@@ -3060,12 +3060,12 @@ public class WSDL11ToAxisServiceBuilder 
 
 						if (PORT_TYPE.equals(origin)
 						        || PORT_TYPE_OPERATION.equals(origin)
-						        || PORT_TYPE_OPERATION_INPUT.equals(origin)
+						        || PORT_TYPE_OPERATION_INPUT.equals(origin) 
 						        || PORT_TYPE_OPERATION_OUTPUT.equals(origin)) {
-
+                      
 						    if (description != null) {
 						        PolicySubject subject = description.getPolicySubject();
-
+                             
 						        if (subject != null) {
 						            subject.attachPolicyReference(ref);
 						        }
@@ -3079,7 +3079,7 @@ public class WSDL11ToAxisServiceBuilder 
 
     /**
 	 * Process the policy definitions
-	 *
+	 * 
 	 * @param definition
 	 */
     private void processPoliciesInDefintion(Definition definition) {
@@ -3088,7 +3088,7 @@ public class WSDL11ToAxisServiceBuilder 
 
     /**
 	 * Process the policy definitions
-	 *
+	 * 
 	 * @param definition
 	 */
     private void processPoliciesInDefintion(Definition definition, Set visitedWSDLs) {
@@ -3132,7 +3132,7 @@ public class WSDL11ToAxisServiceBuilder 
             }
         }
     }
-
+    
     private void setEndpointURL(AxisEndpoint axisEndpoint, String endpointURL) throws AxisFault {
     	axisEndpoint.setEndpointURL(endpointURL);
     	try {
@@ -3140,7 +3140,7 @@ public class WSDL11ToAxisServiceBuilder 
     		axisEndpoint.setTransportInDescription(url.getProtocol());
     	} catch (Exception e) {
     		log.debug(e.getMessage(),e);
-		}
+		}    	
     }
 
 
@@ -3287,11 +3287,11 @@ public class WSDL11ToAxisServiceBuilder 
         }
         return isAvailable;
     }
-
+    
     /**
      * Find BindingOperationEntry
      * @param boes List of BindingOperationEntry
-     * @param bo BindingOperation
+     * @param bo BindingOperation 
      * @return BindingOperation or null
      */
     private BindingOperationEntry find(List boes, BindingOperation bo) {
@@ -3307,7 +3307,7 @@ public class WSDL11ToAxisServiceBuilder 
      * BindingOperation plus state information
      */
     class BindingOperationEntry {
-
+        
         private BindingOperation bindingOperation;
         private boolean isSOAPBinding;
         private boolean isHTTPBinding;
@@ -3315,7 +3315,7 @@ public class WSDL11ToAxisServiceBuilder 
         private boolean isRPC;
         private boolean wrappedInput = true;
         private boolean wrappedOutput = true;
-
+        
         public BindingOperationEntry(BindingOperation bindingOperation, boolean isSOAPBinding, boolean isHTTPBinding, String soapStyle, boolean isRPC) {
             super();
             this.bindingOperation = bindingOperation;
@@ -3324,7 +3324,7 @@ public class WSDL11ToAxisServiceBuilder 
             this.soapStyle = soapStyle;
             this.isRPC = isRPC;
         }
-
+        
         public boolean isHTTPBinding() {
             return isHTTPBinding;
         }
@@ -3334,7 +3334,7 @@ public class WSDL11ToAxisServiceBuilder 
         public String getSoapStyle() {
             return soapStyle;
         }
-
+        
         public boolean isRPC() {
             return isRPC;
         }