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 di...@apache.org on 2006/12/15 15:03:36 UTC

svn commit: r487557 - /webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java

Author: dims
Date: Fri Dec 15 06:03:35 2006
New Revision: 487557

URL: http://svn.apache.org/viewvc?view=rev&rev=487557
Log:
Fix for AXIS2-1459 - the produce with WSDL2Java does not compile

Modified:
    webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java

Modified: webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=487557&r1=487556&r2=487557
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/branches/java/1_1/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Fri Dec 15 06:03:35 2006
@@ -543,6 +543,95 @@
     }
 
     /**
+         * add the qNames of the operation fault message names to faultMessages Mep
+         *
+         * @param operationFaultMessages
+         * @param faultMessagesToMep
+         */
+
+        private void addFaultMessages(List operationFaultMessages, Set faultMessagesToMep) {
+
+            AxisMessage faultMessage;
+            for (Iterator iter = operationFaultMessages.iterator(); iter.hasNext();) {
+                faultMessage = (AxisMessage) iter.next();
+                faultMessagesToMep.add(faultMessage.getElementQName());
+            }
+
+        }
+
+        /**
+         * A util method that returns a unique list of faults for a given mep
+         *
+         * @param doc
+         * @return DOM element
+         */
+        protected Element getUniqueListofFaultsofMep(Document doc, String mep) {
+
+            //  list to keep fault message qnames for this mep
+            Set faultListForMep = new HashSet();
+
+            Iterator iter = this.axisService.getOperations();
+            AxisOperation axisOperation;
+
+            for (; iter.hasNext();) {
+                axisOperation = (AxisOperation) iter.next();
+                if (mep == null) {
+                    // add the fault messages
+                    addFaultMessages(axisOperation.getFaultMessages(),faultListForMep);
+                } else {
+                    if (mep.equals(axisOperation.getMessageExchangePattern())){
+                       // add the fault messages
+                       addFaultMessages(axisOperation.getFaultMessages(),faultListForMep);
+                    }
+                }
+            }
+
+            Element rootElement = doc.createElement("fault-list");
+            Element faultElement;
+            QName key;
+            Iterator iterator = faultListForMep.iterator();
+            while (iterator.hasNext()) {
+                faultElement = doc.createElement("fault");
+                key = (QName) iterator.next();
+
+                //as for the name of a fault, we generate an exception
+                addAttribute(doc, "name",
+                        (String) fullyQualifiedFaultClassNameMap.get(key),
+                        faultElement);
+                addAttribute(doc, "shortName",
+                        (String) faultClassNameMap.get(key),
+                        faultElement);
+
+                //the type represents the type that will be wrapped by this
+                //name
+                String typeMapping =
+                        this.mapper.getTypeMappingName(key);
+                addAttribute(doc, "type", (typeMapping == null)
+                        ? ""
+                        : typeMapping, faultElement);
+                String attribValue = (String) instantiatableMessageClassNames.
+                        get(key);
+
+                addAttribute(doc, "instantiatableType",
+                        attribValue == null ? "" : attribValue,
+                        faultElement);
+
+                // add an extra attribute to say whether the type mapping is
+                // the default
+                if (mapper.getDefaultMappingName().equals(typeMapping)) {
+                    addAttribute(doc, "default", "yes", faultElement);
+                }
+                addAttribute(doc, "value", getParamInitializer(typeMapping),
+                        faultElement);
+
+
+                rootElement.appendChild(faultElement);
+            }
+            return rootElement;
+        }
+
+
+    /**
      * Adds the endpoint to the document.
      *
      * @param doc
@@ -1051,7 +1140,7 @@
         rootElement.appendChild(createDOMElementforDatabinders(doc,true));
 
         //attach a list of faults
-        rootElement.appendChild(getUniqueListofFaults(doc));
+        rootElement.appendChild(getUniqueListofFaultsofMep(doc,mep));
 
         doc.appendChild(rootElement);
 



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