ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidills...@apache.org
Subject svn commit: r429644 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: addressing/AddressingHelper.java description/WSDL11ToAxisServiceBuilder.java
Date Tue, 08 Aug 2006 13:10:01 GMT
Author: davidillsley
Date: Tue Aug  8 06:10:01 2006
New Revision: 429644

URL: http://svn.apache.org/viewvc?rev=429644&view=rev
Log:
More AXIS2-948 - Use Anonymous values found in WSDL

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingHelper.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingHelper.java?rev=429644&r1=429643&r2=429644&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingHelper.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingHelper.java
Tue Aug  8 06:10:01 2006
@@ -30,6 +30,9 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants.Final;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -75,6 +78,78 @@
             return isReplyRedirected(messageContext);
         }else{
             return !faultTo.hasAnonymousAddress(); 
+        }
+    }
+    
+    /**
+     * Extract the Parameter repreesnting the Anonymous flag from the AxisOperation
+     * and return the String value. Return the default of "optional" if not specified.
+     * @param axisOperation
+     * @return
+     */
+    public static String getAnonymousParameterValue(AxisOperation axisOperation){
+        String value = Utils.getParameterValue(axisOperation.getParameter(AddressingConstants.WSAW_ANONYMOUS_PARAMETER_NAME));
+        if(log.isDebugEnabled()){
+            log.debug("getAnonymousParameterValue: value: '"+value+"'");
+        }
+        if(value == null || "".equals(value.trim())){
+            value = "optional";
+        }
+        return value.trim();
+    }
+    
+    /**
+     * Set the value of an existing unlocked Parameter representing Anonymous or add a new
one if one
+     * does not exist. If a locked Parameter of the same name already exists the method will
trace and
+     * return.
+     * @param axisOperation
+     * @param value
+     */
+    public static void setAnonymousParameterValue(AxisOperation axisOperation, String value){
+        if(value == null){
+            if(log.isDebugEnabled()){
+                log.debug("setAnonymousParameterValue: value passed in is null. return");
+            }
+            return;
+        }
+        
+        Parameter param = axisOperation.getParameter(AddressingConstants.WSAW_ANONYMOUS_PARAMETER_NAME);
+        // If an existing parameter exists
+        if(param !=null){
+            if(log.isDebugEnabled()){
+                log.debug("setAnonymousParameterValue: Parameter already exists");
+            }
+            // and is not locked
+            if(!param.isLocked()){
+                if(log.isDebugEnabled()){
+                    log.debug("setAnonymousParameterValue: Parameter not locked. Setting
value: "+value);
+                }
+                // set the value
+                param.setValue(value);
+            }
+        }else{
+            // otherwise, if no Parameter exists
+            if(log.isDebugEnabled()){
+                log.debug("setAnonymousParameterValue: Parameter does not exist");
+            }
+            // Create new Parameter with correct name/value
+            param = new Parameter();
+            param.setName(AddressingConstants.WSAW_ANONYMOUS_PARAMETER_NAME);
+            param.setValue(value);
+            try{
+                if(log.isDebugEnabled()){
+                    log.debug("setAnonymousParameterValue: Adding parameter with value: "+value);
+                }
+                // and add it to the AxisOperation object
+                axisOperation.addParameter(param);
+            }catch(AxisFault af){
+                // This should not happen. AxisFault is only ever thrown when a locked Parameter
+                // of the same name already exists and this should be dealt with by the outer
+                // if statement.
+                if(log.isDebugEnabled()){
+                    log.debug("setAnonymousParameterValue: addParameter failed: "+af.getMessage());
+                }
+            }
         }
     }
     

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=429644&r1=429643&r2=429644&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Tue Aug  8 06:10:01 2006
@@ -4,6 +4,7 @@
 import com.ibm.wsdl.util.xml.DOM2Writer;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.addressing.wsdl.WSDL11ActionHelper;
 import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
@@ -1492,7 +1493,12 @@
                                     .setWSAddressingFlag(AddressingConstants.ADDRESSING_OPTIONAL);
                         }
                     }
-
+                } else if (AddressingConstants.Final.WSAW_ANONYMOUS.equals(unknown.getElementType()))
{
+                    if (originOfExtensibilityElements.equals(BINDING_OPERATION)) {
+                        AxisOperation axisOperation = (AxisOperation) description;
+                        String anonymousValue = unknown.getElement().getTextContent();
+                        AddressingHelper.setAnonymousParameterValue(axisOperation, anonymousValue);
+                    }
                 } else {
 
                     // Ignore this element - it is a totally unknown element



---------------------------------------------------------------------
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