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 de...@apache.org on 2006/03/03 04:51:21 UTC

svn commit: r382643 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/client/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/description/ samples/src/userguide/example3/META-INF/

Author: deepal
Date: Thu Mar  2 19:51:17 2006
New Revision: 382643

URL: http://svn.apache.org/viewcvs?rev=382643&view=rev
Log:
-fixing AXIS2-469

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=382643&r1=382642&r2=382643&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java Thu Mar  2 19:51:17 2006
@@ -290,6 +290,14 @@
     }
 
     /**
+     * To remove all the headers in ServiceClient
+     */
+    public void removeHeaders() {
+        headers.clear();
+    }
+
+
+    /**
      * Add a simple header consisting of some text (and a header name; duh) to
      * be sent with interactions.
      *

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java?rev=382643&r1=382642&r2=382643&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java Thu Mar  2 19:51:17 2006
@@ -18,16 +18,7 @@
 package org.apache.axis2.deployment;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Flow;
-import org.apache.axis2.description.FlowImpl;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.ParameterImpl;
-import org.apache.axis2.description.ParameterInclude;
-import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
@@ -202,16 +193,16 @@
 
         return flow;
     }
-    
+
     protected String[] processSupportedPolicyNamespaces(OMElement supportedPolicyElements) {
-    	OMAttribute namespaces = supportedPolicyElements.getAttribute(new QName(TAG_NAMESPACES));
-    	if (namespaces != null) {
-    		String value = namespaces.getAttributeValue();
-    		if (! value.trim().equals("")) {
-    			return value.split(" ");    			
-    		}
-    	}
-    	return null;
+        OMAttribute namespaces = supportedPolicyElements.getAttribute(new QName(TAG_NAMESPACES));
+        if (namespaces != null) {
+            String value = namespaces.getAttributeValue();
+            if (! value.trim().equals("")) {
+                return value.split(" ");
+            }
+        }
+        return null;
     }
 
     /**
@@ -324,35 +315,25 @@
      * @param parameters       <code>Parameter</code>
      * @param parameterInclude <code>ParameterInclude</code>
      * @param parent           <code>ParameterInclude</code>
-     * @return  list of WSA action parameters
      */
-    protected ArrayList processParameters(Iterator parameters, ParameterInclude parameterInclude,
-                                          ParameterInclude parent)
+    protected void processParameters(Iterator parameters, ParameterInclude parameterInclude,
+                                     ParameterInclude parent)
             throws DeploymentException {
-        ArrayList wsamapping = new ArrayList();
-
         while (parameters.hasNext()) {
-
             // this is to check whether some one has locked the parmter at the top level
             OMElement parameterElement = (OMElement) parameters.next();
             Parameter parameter = new ParameterImpl();
-
             // setting parameterElement
             parameter.setParameterElement(parameterElement);
-
             // setting parameter Name
             OMAttribute paramName = parameterElement.getAttribute(new QName(ATTRIBUTE_NAME));
-
             if (paramName == null) {
                 throw new DeploymentException(
                         Messages.getMessage(DeploymentErrorMsgs.BAD_PARAMETER_ARGUMENT));
             }
-
             parameter.setName(paramName.getAttributeValue());
-
             // setting parameter Value (the chiled elemnt of the parameter)
             OMElement paramValue = parameterElement.getFirstElement();
-
             if (paramValue != null) {
                 parameter.setValue(parameterElement);
                 parameter.setParameterType(Parameter.OM_PARAMETER);
@@ -362,20 +343,15 @@
                 parameter.setValue(paratextValue);
                 parameter.setParameterType(Parameter.TEXT_PARAMETER);
             }
-
             // setting locking attribute
             OMAttribute paramLocked = parameterElement.getAttribute(new QName(ATTRIBUTE_LOCKED));
             Parameter parentParam = null;
-
             if (parent != null) {
                 parentParam = parent.getParameter(parameter.getName());
             }
-
             if (paramLocked != null) {
                 String lockedValue = paramLocked.getAttributeValue();
-
                 if (BOOLEAN_TRUE.equals(lockedValue)) {
-
                     // if the parameter is locked at some level parameter value replace by that
                     if ((parent != null) && parent.isParameterLocked(parameter.getName())) {
                         throw new DeploymentException(
@@ -388,14 +364,6 @@
                     parameter.setLocked(false);
                 }
             }
-
-            if (Constants.WSA_ACTION.equals(paramName.getAttributeValue())) {
-                wsamapping.add(parameter);
-
-                // no need to add this parameter , since this is just for mapping
-                continue;
-            }
-
             try {
                 if (parent != null) {
                     if ((parentParam == null) || !parent.isParameterLocked(parameter.getName())) {
@@ -408,12 +376,26 @@
                 throw new DeploymentException(axisFault);
             }
         }
+    }
 
-        return wsamapping;
+    /**
+     * To process <wsamapping>Value</wsamapping> elements which can be there inside operation tag
+     * either in services.xml or module.xml
+     *
+     * @param mappingIterator
+     * @return ArrayList
+     */
+    protected ArrayList processWsaMapping(Iterator mappingIterator) {
+        ArrayList mappingList = new ArrayList();
+        while (mappingIterator.hasNext()) {
+            OMElement mappingElement = (OMElement) mappingIterator.next();
+            mappingList.add(mappingElement.getText());
+        }
+        return mappingList;
     }
-    
+
     protected void processPolicyElements(int type, Iterator policyElements,
-            PolicyInclude policyInclude) {
+                                         PolicyInclude policyInclude) {
         OMPolicyReader reader = (OMPolicyReader) PolicyFactory
                 .getPolicyReader(PolicyFactory.OM_POLICY_READER);
 
@@ -424,7 +406,7 @@
     }
 
     protected void processPolicyRefElements(int type, Iterator policyRefElements,
-            PolicyInclude policyInclude) {
+                                            PolicyInclude policyInclude) {
         OMPolicyReader reader = (OMPolicyReader) PolicyFactory
                 .getPolicyReader(PolicyFactory.OM_POLICY_READER);
 
@@ -434,7 +416,7 @@
             policyInclude.addPolicyRefElement(type, policyReference);
         }
     }
-    
+
 
     /**
      * Gets the short file name. Short file name is the name before the dot.

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java?rev=382643&r1=382642&r2=382643&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java Thu Mar  2 19:51:17 2006
@@ -18,12 +18,9 @@
 package org.apache.axis2.deployment;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.InOnlyAxisOperation;
-import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
@@ -159,11 +156,11 @@
             if (outFaultFlow != null) {
                 module.setFaultOutFlow(processFlow(outFaultFlow, module));
             }
-            
+
             OMElement supportedPolicyNamespaces = moduleElement.getFirstChildWithName(new QName(TAG_SUPPORTED_POLICY_NAMESPACES));
-            
+
             if (supportedPolicyNamespaces != null) {
-            	module.setSupportedPolicyNamespaces(processSupportedPolicyNamespaces(supportedPolicyNamespaces));
+                module.setSupportedPolicyNamespaces(processSupportedPolicyNamespaces(supportedPolicyNamespaces));
             }
 
             // processing Operations
@@ -226,9 +223,14 @@
 
             // Operation Parameters
             Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER));
-            ArrayList wsamapping = processParameters(parameters, op_descrip, module);
+            processParameters(parameters, op_descrip, module);
 
-            op_descrip.setWsamappingList(wsamapping);
+            //To process wsamapping;
+            Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.WSA_ACTION));
+            if (mappingIterator != null) {
+                ArrayList wsamappings = processWsaMapping(mappingIterator);
+                op_descrip.setWsamappingList(wsamappings);
+            }
 
             // setting the mep of the operation
             // loading the message recivers
@@ -237,24 +239,18 @@
             if (receiverElement != null) {
                 MessageReceiver messageReceiver =
                         loadMessageReceiver(module.getModuleClassLoader(), receiverElement);
-
                 op_descrip.setMessageReceiver(messageReceiver);
             } else {
-
                 // setting default message receiver
                 MessageReceiver msgReceiver = loadDefaultMessageReceiver(mepURL, null);
-
                 op_descrip.setMessageReceiver(msgReceiver);
             }
-
             // Process Module Refs
             Iterator modules = operation.getChildrenWithName(new QName(TAG_MODULE));
-
             processOperationModuleRefs(modules, op_descrip);
 
             // setting Operation phase
             PhasesInfo info = axisConfig.getPhasesInfo();
-
             try {
                 info.setOperationPhases(op_descrip);
             } catch (AxisFault axisFault) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=382643&r1=382642&r2=382643&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java Thu Mar  2 19:51:17 2006
@@ -18,6 +18,7 @@
 package org.apache.axis2.deployment;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
@@ -58,22 +59,16 @@
      */
     public AxisService populateService(OMElement service_element) throws DeploymentException {
         try {
-
             // Processing service level parameters
             Iterator itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER));
-
             processParameters(itr, service, service.getParent());
-
             // process service description
             OMElement descriptionElement =
                     service_element.getFirstChildWithName(new QName(TAG_DESCRIPTION));
-
             if (descriptionElement != null) {
                 OMElement descriptionValue = descriptionElement.getFirstElement();
-
                 if (descriptionValue != null) {
                     StringWriter writer = new StringWriter();
-
                     descriptionValue.build();
                     descriptionValue.serialize(writer);
                     writer.flush();
@@ -110,11 +105,8 @@
                     }
                 }
             }
-
             //<schema targetNamespace="http://x.y.z"/>
-
             // setting the PolicyInclude
-
             // processing <wsp:Policy> .. </..> elements
             Iterator policyElements = service_element.getChildrenWithName(
                     new QName(POLICY_NS_URI, TAG_POLICY));
@@ -176,10 +168,12 @@
             for (int i = 0; i < ops.size(); i++) {
                 AxisOperation operationDesc = (AxisOperation) ops.get(i);
                 ArrayList wsamappings = operationDesc.getWsamappingList();
-
+                if (wsamappings == null) {
+                    continue;
+                }
                 for (int j = 0; j < wsamappings.size(); j++) {
-                    Parameter parameter = (Parameter) wsamappings.get(j);
-                    service.mapActionToOperation((String) parameter.getValue(), operationDesc);
+                    String mapping = (String) wsamappings.get(j);
+                    service.mapActionToOperation(mapping, operationDesc);
                 }
 
                 service.addOperation(operationDesc);
@@ -347,9 +341,13 @@
 
             // Operation Parameters
             Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER));
-            ArrayList wsamappings = processParameters(parameters, op_descrip, service);
-
-            op_descrip.setWsamappingList(wsamappings);
+            processParameters(parameters, op_descrip, service);
+            //To process wsamapping;
+            Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.WSA_ACTION));
+            if (mappingIterator != null) {
+                ArrayList wsamappings = processWsaMapping(mappingIterator);
+                op_descrip.setWsamappingList(wsamappings);
+            }
 
             // loading the message receivers
             OMElement receiverElement = operation.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVER));
@@ -381,17 +379,14 @@
 
                 info.setOperationPhases(op_descrip);
             }
-
             Iterator moduleConfigs = operation.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
-
             processOperationModuleConfig(moduleConfigs, op_descrip, op_descrip);
-
             // adding the operation
             operations.add(op_descrip);
         }
-
         return operations;
     }
+
 
     protected void processServiceModuleConfig(Iterator moduleConfigs, ParameterInclude parent,
                                               AxisService service)

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java?rev=382643&r1=382642&r2=382643&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java Thu Mar  2 19:51:17 2006
@@ -79,6 +79,7 @@
      */
     public abstract void addMessageContext(MessageContext msgContext, OperationContext opContext)
             throws AxisFault;
+
     public abstract void addFaultMessageContext(MessageContext msgContext, OperationContext opContext)
             throws AxisFault;
 
@@ -146,11 +147,12 @@
         for (Iterator iterator = col.iterator(); iterator.hasNext();) {
             AxisOperation axisOperation = copyOperation((AxisOperation) iterator.next());
             ArrayList wsamappings = axisOperation.getWsamappingList();
+            if (wsamappings != null) {
+                for (int j = 0; j < wsamappings.size(); j++) {
+                    String mapping = (String) wsamappings.get(j);
 
-            for (int j = 0; j < wsamappings.size(); j++) {
-                Parameter parameter = (Parameter) wsamappings.get(j);
-
-                service.mapActionToOperation((String) parameter.getValue(), axisOperation);
+                    service.mapActionToOperation(mapping, axisOperation);
+                }
             }
             if (service.getOperation(axisOperation.getName()) == null) {
                 // this opration is a control operation.

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=382643&r1=382642&r2=382643&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Thu Mar  2 19:51:17 2006
@@ -148,10 +148,11 @@
             AxisOperation axisOperation = copyOperation((AxisOperation) iterator.next());
             ArrayList wsamappings = axisOperation.getWsamappingList();
 
-            for (int j = 0; j < wsamappings.size(); j++) {
-                Parameter parameter = (Parameter) wsamappings.get(j);
-
-                this.mapActionToOperation((String) parameter.getValue(), axisOperation);
+            if (wsamappings != null) {
+                for (int j = 0; j < wsamappings.size(); j++) {
+                    String mapping = (String) wsamappings.get(j);
+                    this.mapActionToOperation(mapping, axisOperation);
+                }
             }
             if (this.getOperation(axisOperation.getName()) == null) {
                 // this opration is a control operation.

Modified: webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml?rev=382643&r1=382642&r2=382643&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml (original)
+++ webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml Thu Mar  2 19:51:17 2006
@@ -8,7 +8,7 @@
         <operation name="echo">
             <messageReceiver
                     class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
-            <parameter name="wsamapping">urn:sample/echo</parameter>
+            <wsamapping>urn:sample/echo</wsamapping>
         </operation>
     </service>
 </serviceGroup>