You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2007/01/17 12:38:30 UTC

svn commit: r497000 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl: WSDL11ActionHelper.java WSDL11DefaultActionPatternHelper.java

Author: davidillsley
Date: Wed Jan 17 03:38:28 2007
New Revision: 497000

URL: http://svn.apache.org/viewvc?view=rev&rev=497000
Log:
Adding new WS-Addressing Default Action Pattern helper methods for non WSDL based configuration.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java?view=diff&rev=497000&r1=496999&r2=497000
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java Wed Jan 17 03:38:28 2007
@@ -93,7 +93,7 @@
     	log.trace(result);
     	return result;
     }
-
+    
     private static String getWSAWActionExtensionAttribute(AttributeExtensible ae){
     	// Search first for a wsaw:Action using the submission namespace
     	Object attribute = ae.getExtensionAttribute(submissionWSAWNS);
@@ -136,4 +136,15 @@
     		return null;
     	}
     }
+    
+    public static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName){
+        return WSDL11DefaultActionPatternHelper.getInputActionFromStringInformation(messageExchangePattern, targetNamespace, portTypeName, operationName, inputName);
+    }
+    public static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName){
+        return WSDL11DefaultActionPatternHelper.getOutputActionFromStringInformation(messageExchangePattern, targetNamespace, portTypeName, operationName, outputName);
+    }
+    public static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName){
+        return WSDL11DefaultActionPatternHelper.getFaultActionFromStringInformation(targetNamespace, portTypeName, operationName, faultName);
+    }
+                
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java?view=diff&rev=497000&r1=496999&r2=497000
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java Wed Jan 17 03:38:28 2007
@@ -92,7 +92,7 @@
     	
     	return result;
     }
-    
+            
 	/**
 	 * Get the name of the specified Input element using the rules defined in WSDL 1.1
 	 * Section 2.4.5 http://www.w3.org/TR/wsdl#_names
@@ -121,6 +121,48 @@
 		return result;
 	}
     
+    protected static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName){
+        if(messageExchangePattern == null && inputName == null){
+            throw new IllegalArgumentException("One of messageExchangePattern or inputName must the non-null to generate an action.");
+        }
+               
+        // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". 
+        // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" 
+        // character), the default action value may not conform to the rules of the IRI scheme. Authors
+        // are advised to specify explicit values in the WSDL in this case.'
+        String delimiter = SLASH;
+        if(targetNamespace.toLowerCase().startsWith(URN)){
+            delimiter = COLON;
+        }
+        
+        if(inputName == null){
+            inputName = operationName;
+            if(messageExchangePattern.indexOf("in-out")>=0){
+                inputName+=REQUEST;
+            }
+        }
+        
+        // Append the bits together
+        StringBuffer sb = new StringBuffer();
+        sb.append(targetNamespace);
+        // Deal with the problem that the targetNamespace may or may not have a trailing delimiter
+        if(!targetNamespace.endsWith(delimiter)){
+            sb.append(delimiter);
+        }
+        sb.append(portTypeName);
+        sb.append(delimiter);
+        sb.append(inputName);
+        
+        // Resolve the action from the StringBuffer
+        String result = sb.toString();
+        
+        if(log.isTraceEnabled()){
+            log.trace("getInputActionFromStringInformation result: "+result);
+        }
+        
+        return result;
+    }
+    
 	/**
 	 * Generate the Action for an Output using the Default Action Pattern
 	 * 
@@ -199,6 +241,48 @@
 		return result;
 	}
     
+    protected static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName){
+        if(messageExchangePattern == null && outputName == null){
+            throw new IllegalArgumentException("One of messageExchangePattern or outputName must the non-null to generate an action.");
+        }
+               
+        // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". 
+        // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" 
+        // character), the default action value may not conform to the rules of the IRI scheme. Authors
+        // are advised to specify explicit values in the WSDL in this case.'
+        String delimiter = SLASH;
+        if(targetNamespace.toLowerCase().startsWith(URN)){
+            delimiter = COLON;
+        }
+        
+        if(outputName == null){
+            outputName = operationName;
+            if(messageExchangePattern.indexOf("in-out")>=0){
+                outputName+=RESPONSE;
+            }
+        }
+        
+        // Append the bits together
+        StringBuffer sb = new StringBuffer();
+        sb.append(targetNamespace);
+        // Deal with the problem that the targetNamespace may or may not have a trailing delimiter
+        if(!targetNamespace.endsWith(delimiter)){
+            sb.append(delimiter);
+        }
+        sb.append(portTypeName);
+        sb.append(delimiter);
+        sb.append(outputName);
+        
+        // Resolve the action from the StringBuffer
+        String result = sb.toString();
+        
+        if(log.isTraceEnabled()){
+            log.trace("getOutputActionFromStringInformation result: "+result);
+        }
+        
+        return result;
+    }
+    
     /**
 	 * Generate the Action for a Fault using the Default Action Pattern
 	 * 
@@ -253,6 +337,41 @@
             log.trace("generateActionFromFaultElement result: "+result);
         }
     	
+        return result;
+    }
+    
+    protected static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName){
+        // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". 
+        // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" 
+        // character), the default action value may not conform to the rules of the IRI scheme. Authors
+        // are advised to specify explicit values in the WSDL in this case.'
+        String delimiter = SLASH;
+        if(targetNamespace.toLowerCase().startsWith(URN)){
+            delimiter = COLON;
+        }
+        
+//      Append the bits together
+        StringBuffer sb = new StringBuffer();
+        sb.append(targetNamespace);
+        // Deal with the problem that the targetNamespace may or may not have a trailing delimiter
+        if(!targetNamespace.endsWith(delimiter)){
+            sb.append(delimiter);
+        }
+        sb.append(portTypeName);
+        sb.append(delimiter);
+        sb.append(operationName);
+        sb.append(delimiter);
+        sb.append(FAULT);
+        sb.append(delimiter);
+        sb.append(faultName);
+        
+        // Resolve the action from the StringBuffer
+        String result = sb.toString();
+        
+        if(log.isTraceEnabled()){
+            log.trace("getFaultActionFromStringInformation result: "+result);
+        }
+        
         return result;
     }
 }



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