ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r881670 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/template/java/ kernel/src/org/apache/axis2/client/
Date Wed, 18 Nov 2009 05:29:59 GMT
Author: amilas
Date: Wed Nov 18 05:29:59 2009
New Revision: 881670

URL: http://svn.apache.org/viewvc?rev=881670&view=rev
Log:
keeping the only element Qname to get the exception details cause a problem if two operations
has the fault messages
with same element qname. (eg. http://131.107.72.15/SoapWsdl_Faults_DocLitW_Service_Indigo/AppFaultsService.svc?wsdl)

inorder to solve this problem we need to keep both operation name and qname as the key for
fault maps. 

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/FaultMapKey.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=881670&r1=881669&r2=881670&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
Wed Nov 18 05:29:59 2009
@@ -97,6 +97,7 @@
 import java.lang.reflect.ParameterizedType;
 
 
+
 public class AxisServiceBasedMultiLanguageEmitter implements Emitter {
 
     protected static final String CALL_BACK_HANDLER_SUFFIX = "CallbackHandler";
@@ -2978,6 +2979,8 @@
                 addAttribute(doc, "value", getParamInitializer(typeMapping),
                         paramElement);
 
+                addAttribute(doc, "operationName", operation.getName().getLocalPart(), paramElement);
+
                 Iterator iter = msg.getExtensibilityAttributes().iterator();
                 while (iter.hasNext()) {
                     // process extensibility attributes

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=881670&r1=881669&r2=881670&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
Wed Nov 18 05:29:59 2009
@@ -119,9 +119,9 @@
     private void populateFaults(){
          <xsl:for-each select="method">
            <xsl:for-each select="fault/param">
-              faultExceptionNameMap.put( new javax.xml.namespace.QName("<xsl:value-of
select="@namespace"/>","<xsl:value-of select="@localname"/>"),"<xsl:value-of select="@name"/>");
-              faultExceptionClassNameMap.put(new javax.xml.namespace.QName("<xsl:value-of
select="@namespace"/>","<xsl:value-of select="@localname"/>"),"<xsl:value-of select="@name"/>");
-              faultMessageMap.put( new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>","<xsl:value-of
select="@localname"/>"),"<xsl:value-of select="@instantiatableType"/>");
+              faultExceptionNameMap.put(new org.apache.axis2.client.FaultMapKey(new javax.xml.namespace.QName("<xsl:value-of
select="@namespace"/>","<xsl:value-of select="@localname"/>"), "<xsl:value-of
select="@operationName"/>"),"<xsl:value-of select="@name"/>");
+              faultExceptionClassNameMap.put(new org.apache.axis2.client.FaultMapKey(new
javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>","<xsl:value-of select="@localname"/>"),
"<xsl:value-of select="@operationName"/>"),"<xsl:value-of select="@name"/>");
+              faultMessageMap.put(new org.apache.axis2.client.FaultMapKey(new javax.xml.namespace.QName("<xsl:value-of
select="@namespace"/>","<xsl:value-of select="@localname"/>"), "<xsl:value-of
select="@operationName"/>"),"<xsl:value-of select="@instantiatableType"/>");
            </xsl:for-each>
         </xsl:for-each>
 
@@ -525,15 +525,14 @@
 
             org.apache.axiom.om.OMElement faultElt = f.getDetail();
             if (faultElt!=null){
-                if (faultExceptionNameMap.containsKey(faultElt.getQName())){
+                if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of
select="@originalName"/>"))){
                     //make the fault by reflection
                     try{
-                        java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
+                        java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new
org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"));
                         java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
-                        java.lang.Exception ex=
-                                (java.lang.Exception) exceptionClass.newInstance();
+                        java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
                         //message class
-                        java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
+                        java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new
org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"));
                         java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
                         java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
                         java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
@@ -799,15 +798,14 @@
 									org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
 									org.apache.axiom.om.OMElement faultElt = f.getDetail();
 									if (faultElt!=null){
-										if (faultExceptionNameMap.containsKey(faultElt.getQName())){
+										if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of
select="@originalName"/>"))){
 											//make the fault by reflection
 											try{
-													java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
+													java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new
org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"));
 													java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
-													java.lang.Exception ex=
-														(java.lang.Exception) exceptionClass.newInstance();
+													java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
 													//message class
-													java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
+													java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new
org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"));
 														java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
 													java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
 													java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
@@ -1053,15 +1051,15 @@
                }catch(org.apache.axis2.AxisFault f){
                   org.apache.axiom.om.OMElement faultElt = f.getDetail();
                   if (faultElt!=null){
-                      if (faultExceptionNameMap.containsKey(faultElt.getQName())){
+                      if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of
select="@originalName"/>"))){
                           //make the fault by reflection
                           try{
-                              java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
+                              java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new
org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"));
                               java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
                               java.lang.Exception ex=
                                       (java.lang.Exception) exceptionClass.newInstance();
                               //message class
-                              java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
+                              java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new
org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"));
                               java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
                               java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
                               java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/FaultMapKey.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/FaultMapKey.java?rev=881670&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/FaultMapKey.java
(added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/FaultMapKey.java
Wed Nov 18 05:29:59 2009
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.client;
+
+import javax.xml.namespace.QName;
+
+/**
+ * this class is intended to use as the key for fault maps used
+ * in generated stubs.
+ */
+
+public class FaultMapKey {
+
+    private QName elementQname;
+    private String operationName;
+
+    public FaultMapKey(QName elementQname, String operationName) {
+        this.elementQname = elementQname;
+        this.operationName = operationName;
+    }
+
+    public boolean equals(Object obj) {
+        // it is safe to assume elementQname and operationName not null since it use
+        // with proper values
+        boolean isEqual = false;
+        if (obj instanceof FaultMapKey){
+            FaultMapKey faultMapKey = (FaultMapKey) obj;
+            isEqual = this.elementQname.equals(faultMapKey.getElementQname()) &&
+                          this.operationName.equals(faultMapKey.getOperationName());
+        }
+        return isEqual;
+    }
+
+    public int hashCode() {
+        return this.elementQname.hashCode() + this.operationName.hashCode();
+    }
+
+    public QName getElementQname() {
+        return elementQname;
+    }
+
+    public void setElementQname(QName elementQname) {
+        this.elementQname = elementQname;
+    }
+
+    public String getOperationName() {
+        return operationName;
+    }
+
+    public void setOperationName(String operationName) {
+        this.operationName = operationName;
+    }
+}



Mime
View raw message