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 gd...@apache.org on 2008/08/30 16:30:38 UTC

svn commit: r690515 [2/2] - in /webservices/axis2/trunk/java/modules: kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/description/ kernel/src/org/apache/axis2/engine/ kernel/test-resources/deployment/module1/META-INF/ kernel/test/or...

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?rev=690515&r1=690514&r2=690515&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Sat Aug 30 07:30:37 2008
@@ -19,12 +19,7 @@
 
 package org.apache.axis2.description;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.*;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
@@ -33,11 +28,7 @@
 import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.namespace.Constants;
-import org.apache.axis2.util.ExternalPolicySerializer;
-import org.apache.axis2.util.JavaUtils;
-import org.apache.axis2.util.PolicyLocator;
-import org.apache.axis2.util.PolicyUtil;
-import org.apache.axis2.util.WSDLSerializationUtil;
+import org.apache.axis2.util.*;
 import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
 import org.apache.axis2.wsdl.WSDLConstants;
@@ -50,13 +41,7 @@
 import javax.xml.namespace.QName;
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.*;
 
 public class AxisService2WSDL11 implements Java2WSDLConstants {
 
@@ -64,9 +49,7 @@
 
 	private String serviceName;
 
-	private String[] serviceEndpointURLs;
-
-	private String targetNamespace;
+    private String targetNamespace;
 
 	private OMElement definition;
 
@@ -93,21 +76,21 @@
 	private ExternalPolicySerializer serializer;
 
 	private HashMap messagesMap;
-	
 
-        public AxisService2WSDL11(AxisService service) throws Exception {
-		this.axisService = service;
-		this.serviceName = service.getName();
-		init();
+    public AxisService2WSDL11(AxisService service) throws Exception {
+        this.axisService = service;
+        this.serviceName = service.getName();
+        init();
 	}
 
 	private void init() throws AxisFault {
+/*
 		// the EPR list of AxisService contains REST EPRs as well. Those REST
 		// EPRs will be used to generated HTTPBinding
 		// and rest of the EPRs will be used to generate SOAP 1.1 and 1.2
 		// bindings. Let's first initialize those set of
 		// EPRs now to be used later, especially when we generate the WSDL.
-		serviceEndpointURLs = axisService.getEPRs();
+        String[] serviceEndpointURLs = axisService.getEPRs();
 		if (serviceEndpointURLs == null) {
 			Map endpointMap = axisService.getEndpoints();
 			if (endpointMap.size() > 0) {
@@ -123,7 +106,7 @@
 						.getEndpointName() };
 			}
 		}
-
+*/
 		this.targetNamespace = axisService.getTargetNamespace();
 
 		serializer = new ExternalPolicySerializer();
@@ -143,11 +126,16 @@
 		init();
 	}
 
-	public OMElement generateOM() throws Exception {
+    /**
+     * Build the OM structure of the WSDL document
+     *
+     * @return an OMElement containing a WSDL document
+     * @throws Exception
+     */
+    public OMElement generateOM() throws Exception {
 
 		OMFactory fac = OMAbstractFactory.getOMFactory();
-		wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
-				DEFAULT_WSDL_NAMESPACE_PREFIX);
+		wsdl = fac.createOMNamespace(WSDL_NAMESPACE, DEFAULT_WSDL_NAMESPACE_PREFIX);
 		OMElement ele = fac.createOMElement("definitions", wsdl);
 		setDefinitionElement(ele);
 
@@ -162,10 +150,9 @@
 		soap12 = ele.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);
 		http = ele.declareNamespace(HTTP_NAMESPACE, HTTP_PREFIX);
 		mime = ele.declareNamespace(MIME_NAMESPACE, MIME_PREFIX);
-		wsaw = ele.declareNamespace(AddressingConstants.Final.WSAW_NAMESPACE,
-				"wsaw");
-		String prefix = WSDLSerializationUtil.getPrefix(axisService
-				.getTargetNamespace(), namespaceMap);
+		wsaw = ele.declareNamespace(AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
+		String prefix = WSDLSerializationUtil.getPrefix(axisService.getTargetNamespace(),
+                                                        namespaceMap);
 		if (prefix == null || "".equals(prefix)) {
 			prefix = DEFAULT_TARGET_NAMESPACE_PREFIX;
 		}
@@ -175,8 +162,8 @@
 
 		// axis2.xml indicated no HTTP binding?
 		boolean disableREST = false;
-		Parameter disableRESTParameter = axisService
-				.getParameter(org.apache.axis2.Constants.Configuration.DISABLE_REST);
+		Parameter disableRESTParameter = axisService.getParameter(
+                org.apache.axis2.Constants.Configuration.DISABLE_REST);
 		if (disableRESTParameter != null
 				&& JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) {
 			disableREST = true;
@@ -195,8 +182,7 @@
 		Parameter disableSOAP12Parameter = axisService
 				.getParameter(org.apache.axis2.Constants.Configuration.DISABLE_SOAP12);
 		if (disableSOAP12Parameter != null
-				&& JavaUtils
-						.isTrueExplicitly(disableSOAP12Parameter.getValue())) {
+				&& JavaUtils.isTrueExplicitly(disableSOAP12Parameter.getValue())) {
 			disableSOAP12 = true;
 		}
 
@@ -204,11 +190,9 @@
 		// <documentation>&lt;b&gt;NEW!&lt;/b&gt; This method accepts an ISBN
 		// string and returns &lt;b&gt;Amazon.co.uk&lt;/b&gt; Sales Rank for
 		// that book.</documentation>
-		WSDLSerializationUtil.addWSDLDocumentationElement(axisService, ele,
-				fac, wsdl);
+		WSDLSerializationUtil.addWSDLDocumentationElement(axisService, ele,	fac, wsdl);
 
-		ele.addAttribute("targetNamespace", axisService.getTargetNamespace(),
-				null);
+		ele.addAttribute("targetNamespace", axisService.getTargetNamespace(), null);
 		OMElement wsdlTypes = fac.createOMElement("types", wsdl);
 		ele.addChild(wsdlTypes);
 
@@ -227,8 +211,7 @@
 				schema.write(writer);
 				String schemaString = writer.toString();
 				if (!"".equals(schemaString)) {
-					wsdlTypes.addChild(XMLUtils.toOM(new StringReader(
-							schemaString)));
+					wsdlTypes.addChild(XMLUtils.toOM(new StringReader(schemaString)));
 				}
 			}
 		}
@@ -244,8 +227,7 @@
 		// }
 
 		generateService(fac, ele, disableREST, disableSOAP12 , disableSOAP11);
-		addPoliciesToDefinitionElement(policiesInDefinitions.values()
-				.iterator(), definition);
+		addPoliciesToDefinitionElement(policiesInDefinitions.values().iterator(), definition);
 
 		return ele;
 	}
@@ -267,8 +249,8 @@
 					|| WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
 					|| WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
 					|| WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
-				AxisMessage inaxisMessage = axisOperation
-						.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                AxisMessage inaxisMessage =
+                        axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
 				if (inaxisMessage != null) {
 					writeMessage(inaxisMessage, fac, defintions);
 					generateHeaderMessages(inaxisMessage, fac, defintions);
@@ -291,15 +273,14 @@
 			// generate fault Messages
 			ArrayList faultyMessages = axisOperation.getFaultMessages();
 			if (faultyMessages != null) {
-				for (int i = 0; i < faultyMessages.size(); i++) {
-					AxisMessage axisMessage = (AxisMessage) faultyMessages
-							.get(i);
-					String name = axisMessage.getName();
-					if (faultMessageNames.add(name)) {
-						writeMessage(axisMessage, fac, defintions);
-						generateHeaderMessages(axisMessage, fac, defintions);
-					}
-				}
+                for (Object faultyMessage : faultyMessages) {
+                    AxisMessage axisMessage = (AxisMessage)faultyMessage;
+                    String name = axisMessage.getName();
+                    if (faultMessageNames.add(name)) {
+                        writeMessage(axisMessage, fac, defintions);
+                        generateHeaderMessages(axisMessage, fac, defintions);
+                    }
+                }
 			}
 		}
 	}
@@ -307,53 +288,45 @@
 	private void generateHeaderMessages(AxisMessage axismessage, OMFactory fac,
 			OMElement defintions) {
 		ArrayList extList = axismessage.getSoapHeaders();
-		for (int i = 0; i < extList.size(); i++) {
-			SOAPHeaderMessage header = (SOAPHeaderMessage) extList.get(i);
-			OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME,
-					wsdl);
-			messageElement.addAttribute(ATTRIBUTE_NAME, header.getMessage()
-					.getLocalPart(), null);
-			defintions.addChild(messageElement);
-			OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME,
-					wsdl);
-			messageElement.addChild(messagePart);
-			messagePart.addAttribute(ATTRIBUTE_NAME, header.part(), null);
-			if (header.getElement() == null) {
-				throw new RuntimeException(ELEMENT_ATTRIBUTE_NAME
-						+ " is null for " + header.getMessage());
-			}
-			messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
-					WSDLSerializationUtil.getPrefix(header.getElement()
-							.getNamespaceURI(), axisService.getNamespaceMap())
-							+ ":" + header.getElement().getLocalPart(), null);
-		}
+        for (Object anExtList : extList) {
+            SOAPHeaderMessage header = (SOAPHeaderMessage)anExtList;
+            OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
+            messageElement.addAttribute(ATTRIBUTE_NAME, header.getMessage().getLocalPart(), null);
+            defintions.addChild(messageElement);
+            OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
+            messageElement.addChild(messagePart);
+            messagePart.addAttribute(ATTRIBUTE_NAME, header.part(), null);
+            if (header.getElement() == null) {
+                throw new RuntimeException(ELEMENT_ATTRIBUTE_NAME
+                                           + " is null for " + header.getMessage());
+            }
+            messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
+                                     WSDLSerializationUtil.getPrefix(header.getElement()
+                                             .getNamespaceURI(), axisService.getNamespaceMap())
+                                     + ":" + header.getElement().getLocalPart(), null);
+        }
 	}
 
-	private void writeMessage(AxisMessage axismessage, OMFactory fac,
-			OMElement defintions) {
+	private void writeMessage(AxisMessage axismessage, OMFactory fac, OMElement defintions) {
 		if (messagesMap.get(axismessage.getName()) == null) {
 			messagesMap.put(axismessage.getName(), axismessage);
 			QName schemaElementName = axismessage.getElementQName();
-			OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME,
-					wsdl);
-			messageElement.addAttribute(ATTRIBUTE_NAME, axismessage.getName(),
-					null);
+			OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
+			messageElement.addAttribute(ATTRIBUTE_NAME, axismessage.getName(), null);
 			defintions.addChild(messageElement);
 			if (schemaElementName != null) {
-				OMElement messagePart = fac.createOMElement(
-						PART_ATTRIBUTE_NAME, wsdl);
+				OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
 				messageElement.addChild(messagePart);
 				if (axismessage.getMessagePartName() != null) {
-					messagePart.addAttribute(ATTRIBUTE_NAME, axismessage
-							.getMessagePartName(), null);
+					messagePart.addAttribute(ATTRIBUTE_NAME,
+                                             axismessage.getMessagePartName(),
+                                             null);
 				} else {
-					messagePart.addAttribute(ATTRIBUTE_NAME, axismessage
-							.getPartName(), null);
+					messagePart.addAttribute(ATTRIBUTE_NAME, axismessage.getPartName(), null);
 				}
 				messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
-						WSDLSerializationUtil.getPrefix(schemaElementName
-								.getNamespaceURI(), axisService
-								.getNamespaceMap())
+						WSDLSerializationUtil.getPrefix(schemaElementName.getNamespaceURI(),
+                                                        axisService.getNamespaceMap())
 								+ ":" + schemaElementName.getLocalPart(), null);
 			}
 		}
@@ -446,23 +419,23 @@
 			// generate fault Messages
 			ArrayList faultMessages = axisOperation.getFaultMessages();
 			if (faultMessages != null) {
-				for (int i = 0; i < faultMessages.size(); i++) {
-					AxisMessage faultyMessage = (AxisMessage) faultMessages
-							.get(i);
-					OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
-							wsdl);
-					WSDLSerializationUtil.addWSDLDocumentationElement(
-							faultyMessage, fault, fac, wsdl);
-					fault.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
-							+ ":" + faultyMessage.getName(), null);
-					fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(),
-							null);
-					WSDLSerializationUtil.addWSAWActionAttribute(fault,
-							axisOperation.getFaultAction(faultyMessage
-									.getName()), wsaw);
-					// TODO add policies for fault messages
-					operation.addChild(fault);
-				}
+                for (Object faultMessage : faultMessages) {
+                    AxisMessage faultyMessage = (AxisMessage)faultMessage;
+                    OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+                    WSDLSerializationUtil.addWSDLDocumentationElement(faultyMessage,
+                                                                      fault,
+                                                                      fac,
+                                                                      wsdl);
+                    fault.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
+                                                           + ":" + faultyMessage.getName(), null);
+                    fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(), null);
+                    WSDLSerializationUtil.addWSAWActionAttribute(fault,
+                                                                 axisOperation.getFaultAction(
+                                                                         faultyMessage.getName()),
+                                                                 wsaw);
+                    // TODO add policies for fault messages
+                    operation.addChild(fault);
+                }
 			}
 
 		}
@@ -483,8 +456,9 @@
 	 * @throws Exception
 	 *             if there's a problem
 	 */
-	public void generateService(OMFactory fac, OMElement defintions,
-			boolean disableREST, boolean disableSOAP12 , boolean  disableSOAP11) throws Exception {
+	public void generateService(OMFactory fac, OMElement defintions, boolean disableREST,
+                                boolean disableSOAP12, boolean disableSOAP11)
+            throws Exception {
 		OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl);
 		defintions.addChild(service);
 		service.addAttribute(ATTRIBUTE_NAME, serviceName, null);
@@ -499,8 +473,8 @@
 		}
 
 
-        addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService
-				.getPolicyInclude(), service);
+        addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService.getPolicyInclude(),
+                              service);
 		// addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY, axisService.
 		// getPolicyInclude(), service);
 
@@ -561,56 +535,54 @@
 			OMElement parentElement) throws Exception {
 		ArrayList elementList = policyInclude.getPolicyElements(type);
 
-		for (Iterator iterator = elementList.iterator(); iterator.hasNext();) {
-			Object policyElement = iterator.next();
-
-			if (policyElement instanceof Policy) {
-				OMElement child = PolicyUtil.getPolicyComponentAsOMElement(
-						(PolicyComponent) policyElement, serializer);
-
-				OMNode firstChildElem = parentElement.getFirstElement();
-
-				// if (firstChildElem == null) {
-				// parentElement.addChild(child);
-				// } else {
-				// firstChildElem.insertSiblingBefore(child);
-				// }
-				// there is a problem with the OM insertSiblingBefore element
-				// with
-				// drops the already exists elements.
-				// since there is no any techical problem of adding policy
-				// elements after other
-				// children temporaliy fix this as it is.
-				// one OM fix this issue we can revert this change.
-				parentElement.addChild(child);
-
-			} else if (policyElement instanceof PolicyReference) {
-				OMElement child = PolicyUtil
-						.getPolicyComponentAsOMElement((PolicyComponent) policyElement);
-				OMElement firstChildElem = parentElement.getFirstElement();
-
-				if (firstChildElem == null) {
-					parentElement.addChild(child);
-				} else {
-					firstChildElem.insertSiblingBefore(child);
-				}
-
-				PolicyRegistry reg = policyInclude.getPolicyRegistry();
-				String key = ((PolicyReference) policyElement).getURI();
-
-				if (key.startsWith("#")) {
-					key = key.substring(key.indexOf("#") + 1);
-				}
-
-				Policy p = reg.lookup(key);
-
-				if (p == null) {
-					throw new Exception("Policy not found for uri : " + key);
-				}
-
-				addPolicyToDefinitionElement(key, p);
-			}
-		}
+        for (Object policyElement : elementList) {
+            if (policyElement instanceof Policy) {
+                OMElement child = PolicyUtil.getPolicyComponentAsOMElement(
+                        (PolicyComponent)policyElement, serializer);
+
+//                OMNode firstChildElem = parentElement.getFirstElement();
+
+                // if (firstChildElem == null) {
+                // parentElement.addChild(child);
+                // } else {
+                // firstChildElem.insertSiblingBefore(child);
+                // }
+                // there is a problem with the OM insertSiblingBefore element
+                // with
+                // drops the already exists elements.
+                // since there is no any techical problem of adding policy
+                // elements after other
+                // children temporaliy fix this as it is.
+                // one OM fix this issue we can revert this change.
+                parentElement.addChild(child);
+
+            } else if (policyElement instanceof PolicyReference) {
+                OMElement child = PolicyUtil
+                        .getPolicyComponentAsOMElement((PolicyComponent)policyElement);
+                OMElement firstChildElem = parentElement.getFirstElement();
+
+                if (firstChildElem == null) {
+                    parentElement.addChild(child);
+                } else {
+                    firstChildElem.insertSiblingBefore(child);
+                }
+
+                PolicyRegistry reg = policyInclude.getPolicyRegistry();
+                String key = ((PolicyReference)policyElement).getURI();
+
+                if (key.startsWith("#")) {
+                    key = key.substring(key.indexOf("#") + 1);
+                }
+
+                Policy p = reg.lookup(key);
+
+                if (p == null) {
+                    throw new Exception("Policy not found for uri : " + key);
+                }
+
+                addPolicyToDefinitionElement(key, p);
+            }
+        }
 	}
 
 	private void addPoliciesToDefinitionElement(Iterator iterator,
@@ -655,8 +627,8 @@
 	private void generateSoap11Port(OMFactory fac, OMElement definition,
 			OMElement service) throws Exception {
 		Iterator iterator = axisService.getEndpoints().values().iterator();
-		AxisEndpoint axisEndpoint = null;
-		AxisBinding axisBinding = null;
+		AxisEndpoint axisEndpoint;
+		AxisBinding axisBinding;
 		for (; iterator.hasNext();) {
 			axisEndpoint = (AxisEndpoint) iterator.next();
 			/*
@@ -696,8 +668,8 @@
 
 		// /////////////////// FIXME //////////////////////////////////////////
 		Iterator iterator = axisService.getEndpoints().values().iterator();
-		AxisEndpoint axisEndpoint = null;
-		AxisBinding axisBinding = null;
+		AxisEndpoint axisEndpoint;
+		AxisBinding axisBinding;
 		for (; iterator.hasNext();) {
 			axisEndpoint = (AxisEndpoint) iterator.next();
 			/*
@@ -738,8 +710,8 @@
 
 		// /////////////////// FIXME //////////////////////////////////////////
 		Iterator iterator = axisService.getEndpoints().values().iterator();
-		AxisEndpoint axisEndpoint = null;
-		AxisBinding axisBinding = null;
+		AxisEndpoint axisEndpoint;
+		AxisBinding axisBinding;
 		for (; iterator.hasNext();) {
 			axisEndpoint = (AxisEndpoint) iterator.next();
 			/*
@@ -889,27 +861,23 @@
 			// generate fault Messages
 			ArrayList faultyMessages = axisBindingOperation.getFaults();
 			if (faultyMessages != null) {
-				for (int i = 0; i < faultyMessages.size(); i++) {
-					AxisBindingMessage bindingFaultyMessage = (AxisBindingMessage) faultyMessages
-							.get(i);
-					if (bindingFaultyMessage != null) {
-						AxisMessage faultyMessage = bindingFaultyMessage
-								.getAxisMessage();
-
-						OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
-								wsdl);
-
-						addPolicyAsExtElement(bindingFaultyMessage, fault);
-						addExtensionElement(fac, fault, FAULT_LOCAL_NAME,
-								SOAP_USE, use, ATTRIBUTE_NAME, faultyMessage
-										.getName(), soap);
-						fault.addAttribute(ATTRIBUTE_NAME, faultyMessage
-								.getName(), null);
-						// add policies for fault messages
-						operation.addChild(fault);
-						writeSoapHeaders(faultyMessage, fac, fault, soap);
-					}
-				}
+                for (Object faultyMessage1 : faultyMessages) {
+                    AxisBindingMessage bindingFaultyMessage = (AxisBindingMessage)faultyMessage1;
+                    if (bindingFaultyMessage != null) {
+                        AxisMessage faultyMessage = bindingFaultyMessage.getAxisMessage();
+
+                        OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+
+                        addPolicyAsExtElement(bindingFaultyMessage, fault);
+                        addExtensionElement(fac, fault, FAULT_LOCAL_NAME,
+                                            SOAP_USE, use, ATTRIBUTE_NAME,
+                                            faultyMessage.getName(), soap);
+                        fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(), null);
+                        // add policies for fault messages
+                        operation.addChild(fault);
+                        writeSoapHeaders(faultyMessage, fac, fault, soap);
+                    }
+                }
 			}
 		}
 	}
@@ -1032,25 +1000,24 @@
 			// generate fault Messages
 			ArrayList faultyMessages = axisBindingOperation.getFaults();
 			if (faultyMessages != null) {
-				for (int i = 0; i < faultyMessages.size(); i++) {
-					AxisBindingMessage bindingFaultyMessage = (AxisBindingMessage) faultyMessages
-							.get(i);
-					if (bindingFaultyMessage != null) {
-						AxisMessage faultyMessage = bindingFaultyMessage
-								.getAxisMessage();
-						OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
-								wsdl);
-						addPolicyAsExtElement(bindingFaultyMessage, fault);
-						addExtensionElement(fac, fault, FAULT_LOCAL_NAME,
-								SOAP_USE, use, ATTRIBUTE_NAME, faultyMessage
-										.getName(), soap12);
-						fault.addAttribute(ATTRIBUTE_NAME, faultyMessage
-								.getName(), null);
-						// add policies for fault messages
-						operation.addChild(fault);
-						writeSoapHeaders(faultyMessage, fac, fault, soap12);
-					}
-				}
+                for (Object faultyMessage1 : faultyMessages) {
+                    AxisBindingMessage bindingFaultyMessage = (AxisBindingMessage)faultyMessage1;
+                    if (bindingFaultyMessage != null) {
+                        AxisMessage faultyMessage = bindingFaultyMessage
+                                .getAxisMessage();
+                        OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
+                                                              wsdl);
+                        addPolicyAsExtElement(bindingFaultyMessage, fault);
+                        addExtensionElement(fac, fault, FAULT_LOCAL_NAME,
+                                            SOAP_USE, use, ATTRIBUTE_NAME, faultyMessage
+                                .getName(), soap12);
+                        fault.addAttribute(ATTRIBUTE_NAME, faultyMessage
+                                .getName(), null);
+                        // add policies for fault messages
+                        operation.addChild(fault);
+                        writeSoapHeaders(faultyMessage, fac, fault, soap12);
+                    }
+                }
 			}
 		}
 	}
@@ -1158,54 +1125,51 @@
 		Collection attachPolicyComponents = policySubject
 				.getAttachedPolicyComponents();
 
-		for (Iterator iterator = attachPolicyComponents.iterator(); iterator
-				.hasNext();) {
-			Object policyElement = iterator.next();
-
-			if (policyElement instanceof Policy) {
-				PolicyReference policyReference = PolicyUtil
-						.createPolicyReference((Policy) policyElement);
-				OMElement policyRefElement = PolicyUtil
-						.getPolicyComponentAsOMElement(
-								(PolicyComponent) policyReference, serializer);
-
-				OMNode firstChildElem = wsdlElement.getFirstElement();
-				if (firstChildElem == null) {
-					wsdlElement.addChild(policyRefElement);
-				} else {
-					firstChildElem.insertSiblingBefore(policyRefElement);
-				}
-				String key = ((PolicyReference) policyReference).getURI();
-				if (key.startsWith("#")) {
-					key = key.substring(key.indexOf("#") + 1);
-				}
-				addPolicyToDefinitionElement(key, (Policy) policyElement);
-
-			} else if (policyElement instanceof PolicyReference) {
-				OMElement child = PolicyUtil.getPolicyComponentAsOMElement(
-						(PolicyComponent) policyElement, serializer);
-				OMElement firstChildElem = wsdlElement.getFirstElement();
-
-				if (firstChildElem == null) {
-					wsdlElement.addChild(child);
-				} else {
-					firstChildElem.insertSiblingBefore(child);
-				}
-
-				String key = ((PolicyReference) policyElement).getURI();
-				if (key.startsWith("#")) {
-					key = key.substring(key.indexOf("#") + 1);
-				}
-
-				PolicyLocator locator = new PolicyLocator(axisService);
-				Policy p = locator.lookup(key);
-
-				if (p == null) {
-					throw new Exception("Policy not found for uri : " + key);
-				}
-				addPolicyToDefinitionElement(key, p);
-			}
-		}
+        for (Object policyElement : attachPolicyComponents) {
+            if (policyElement instanceof Policy) {
+                PolicyReference policyReference =
+                        PolicyUtil.createPolicyReference((Policy)policyElement);
+                OMElement policyRefElement =
+                        PolicyUtil.getPolicyComponentAsOMElement(policyReference, serializer);
+
+                OMNode firstChildElem = wsdlElement.getFirstElement();
+                if (firstChildElem == null) {
+                    wsdlElement.addChild(policyRefElement);
+                } else {
+                    firstChildElem.insertSiblingBefore(policyRefElement);
+                }
+                String key = policyReference.getURI();
+                if (key.startsWith("#")) {
+                    key = key.substring(key.indexOf("#") + 1);
+                }
+                addPolicyToDefinitionElement(key, (Policy)policyElement);
+
+            } else if (policyElement instanceof PolicyReference) {
+                OMElement child =
+                        PolicyUtil.getPolicyComponentAsOMElement((PolicyComponent)policyElement,
+                                                                 serializer);
+                OMElement firstChildElem = wsdlElement.getFirstElement();
+
+                if (firstChildElem == null) {
+                    wsdlElement.addChild(child);
+                } else {
+                    firstChildElem.insertSiblingBefore(child);
+                }
+
+                String key = ((PolicyReference)policyElement).getURI();
+                if (key.startsWith("#")) {
+                    key = key.substring(key.indexOf("#") + 1);
+                }
+
+                PolicyLocator locator = new PolicyLocator(axisService);
+                Policy p = locator.lookup(key);
+
+                if (p == null) {
+                    throw new Exception("Policy not found for uri : " + key);
+                }
+                addPolicyToDefinitionElement(key, p);
+            }
+        }
 	}
 
 	private void addPolicyAsExtAttribute(AxisDescription axisDescription,
@@ -1214,44 +1178,41 @@
 		PolicySubject policySubject = axisDescription.getPolicySubject();
 		ArrayList policyURIs = new ArrayList();
 
-		for (Iterator iterator = policySubject.getAttachedPolicyComponents()
-				.iterator(); iterator.hasNext();) {
-			Object policyElement = iterator.next();
-			String key;
-
-			if (policyElement instanceof Policy) {
-				Policy p = (Policy) policyElement;
-
-				if (p.getId() != null) {
-					key = "#" + p.getId();
-				} else if (p.getName() != null) {
-					key = p.getName();
-				} else {
-					throw new RuntimeException(
-							"Can't add the Policy as an extensibility attribute since it doesn't have a id or a name attribute");
-				}
+        for (Object policyElement : policySubject.getAttachedPolicyComponents()) {
+            String key;
 
-				policyURIs.add(key);
-				addPolicyToDefinitionElement(key, p);
+            if (policyElement instanceof Policy) {
+                Policy p = (Policy)policyElement;
 
-			} else {
-				String uri = ((PolicyReference) policyElement).getURI();
-				PolicyLocator locator = new PolicyLocator(axisService);
-				if (uri.startsWith("#")) {
-					key = uri.substring(uri.indexOf('#') + 1);
-				} else {
-					key = uri;
-				}
-
-				Policy p = locator.lookup(key);
-
-				if (p == null) {
-					throw new RuntimeException("Cannot resolve " + uri
-							+ " to a Policy");
-				}
-				addPolicyToDefinitionElement(key, p);
-			}
-		}
+                if (p.getId() != null) {
+                    key = "#" + p.getId();
+                } else if (p.getName() != null) {
+                    key = p.getName();
+                } else {
+                    throw new RuntimeException(
+                            "Can't add the Policy as an extensibility attribute since it doesn't have a id or a name attribute");
+                }
+
+                policyURIs.add(key);
+                addPolicyToDefinitionElement(key, p);
+            } else {
+                String uri = ((PolicyReference)policyElement).getURI();
+                PolicyLocator locator = new PolicyLocator(axisService);
+                if (uri.startsWith("#")) {
+                    key = uri.substring(uri.indexOf('#') + 1);
+                } else {
+                    key = uri;
+                }
+
+                Policy p = locator.lookup(key);
+
+                if (p == null) {
+                    throw new RuntimeException("Cannot resolve " + uri
+                                               + " to a Policy");
+                }
+                addPolicyToDefinitionElement(key, p);
+            }
+        }
 
 		if (!policyURIs.isEmpty()) {
 			String value = null;
@@ -1260,10 +1221,10 @@
 			 * We need to create a String that is like 'uri1 uri2 .." to set as
 			 * the value of the wsp:PolicyURIs attribute.
 			 */
-			for (Iterator iterator = policyURIs.iterator(); iterator.hasNext();) {
-				String uri = (String) iterator.next();
-				value = (value == null) ? uri : value + " " + uri;
-			}
+            for (Object policyURI : policyURIs) {
+                String uri = (String)policyURI;
+                value = (value == null) ? uri : value + " " + uri;
+            }
 
 			OMNamespace ns = factory.createOMNamespace(
 					org.apache.neethi.Constants.URI_POLICY_NS,
@@ -1291,23 +1252,22 @@
 	}
 	
 	private String getEndpointURL(AxisEndpoint axisEndpoint) {
-		Parameter modifyAddressParam = axisService
-				.getParameter("modifyUserWSDLPortAddress");
-		if (modifyAddressParam != null) {
-			if (!Boolean.parseBoolean((String) modifyAddressParam.getValue())) {
-				return axisEndpoint.getEndpointURL();
-			} 
-		}
-		String hostIP = WSDLSerializationUtil.extractHostIP(axisService.getEndpointURL());
-		//TODO This is to prevent problems when JAVA2WSDL tool is used where there is no  
+		Parameter modifyAddressParam = axisService.getParameter("modifyUserWSDLPortAddress");
+        String endpointURL = axisEndpoint.getEndpointURL();
+        if (modifyAddressParam != null &&
+            !Boolean.parseBoolean((String)modifyAddressParam.getValue())) {
+            return endpointURL;
+        }
+
+        String hostIP = WSDLSerializationUtil.extractHostIP(axisService.getEndpointURL());
+
+		//TODO This is to prevent problems when JAVA2WSDL tool is used where there is no
 		//Axis server running. calculateEndpointURL fails in this scenario, refer to 
 		// SimpleHTTPServer#getEPRsForService()
 		if (hostIP != null) {
 		    return axisEndpoint.calculateEndpointURL(hostIP);
 		} else {
-		    return axisEndpoint.getEndpointURL();
+		    return endpointURL;
 		}
 	}
-	
-	
 }
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOnlyAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOnlyAxisOperation.java?rev=690515&r1=690514&r2=690515&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOnlyAxisOperation.java Sat Aug 30 07:30:37 2008
@@ -21,8 +21,11 @@
 
 import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.wsdl.WSDLConstants;
 
@@ -54,6 +57,11 @@
         setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
     }
 
+    public OperationClient createClient(ServiceContext sc, Options options) {
+        throw new UnsupportedOperationException(
+                Messages.getMessage("mepnotyetimplemented", mepURI));
+    }
+
     public void addMessage(AxisMessage message, String label) {
         if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(label)) {
 //            inMessage = message;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOutAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOutAxisOperation.java?rev=690515&r1=690514&r2=690515&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOutAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/InOutAxisOperation.java Sat Aug 30 07:30:37 2008
@@ -21,8 +21,11 @@
 
 import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.i18n.Messages;
 
 import javax.xml.namespace.QName;
@@ -41,6 +44,11 @@
         super(name);
     }
 
+    public OperationClient createClient(ServiceContext sc, Options options) {
+        throw new UnsupportedOperationException(
+                Messages.getMessage("mepnotyetimplemented", mepURI));
+    }
+
     public void addMessageContext(MessageContext msgContext, OperationContext opContext)
             throws AxisFault {
         HashMap mep = opContext.getMessageContexts();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DeployableChain.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DeployableChain.java?rev=690515&r1=690514&r2=690515&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DeployableChain.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DeployableChain.java Sat Aug 30 07:30:37 2008
@@ -21,7 +21,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -116,8 +115,8 @@
         }
 
         if (myPredecessors != null) {
-            for (Iterator i = myPredecessors.iterator(); i.hasNext();) {
-                String predecessor = (String)i.next();
+            for (Object myPredecessor : myPredecessors) {
+                String predecessor = (String)myPredecessor;
                 // define relationship for each one
                 addRelationship(predecessor, name);
             }
@@ -157,8 +156,8 @@
         }
 
         int minIndex = -1;
-        for (Iterator i = successors.iterator(); i.hasNext();) {
-            String otherName = (String)i.next();
+        for (Object successor : successors) {
+            String otherName = (String)successor;
             int otherIdx = chain.indexOf(otherName);
             if (otherIdx > -1) {
                 if ((minIndex == -1) || (minIndex > otherIdx)) {
@@ -177,7 +176,7 @@
                     }
                     if (minIndex == -1) {
                         throw new Exception("Trying to put '" + name + "' before '" +
-                                otherName + "' - incompatible constraints!");
+                                            otherName + "' - incompatible constraints!");
                     }
                 }
             }

Modified: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/module1/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/module1/META-INF/module.xml?rev=690515&r1=690514&r2=690515&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/module1/META-INF/module.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/module1/META-INF/module.xml Sat Aug 30 07:30:37 2008
@@ -57,7 +57,11 @@
         <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
         <parameter name="para1" locked="xsd:true">10</parameter>
     </operation>
-    <phase name="NewPhase" before="Dispatch" after="Security" flow="InFlow"/>
+
+    <!-- This checks that phases can be added, that comma-separated flow lists work, -->
+    <!-- and that case-insensitive comparisons are used for flow names.              -->
+    <phase name="NewPhase" before="Dispatch" after="Security" flow="InFlow,oUtFlOw"/>
+
     <phase name="NewPhase" before="Dispatch"  flow="InFaultFlow"/>
     <phase name="Security" flow="InFlow"/> <!-- Make sure duplicates are OK -->
 </module>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/DeploymentTotalTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/DeploymentTotalTest.java?rev=690515&r1=690514&r2=690515&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/DeploymentTotalTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/DeploymentTotalTest.java Sat Aug 30 07:30:37 2008
@@ -63,14 +63,21 @@
         }
 
         inFlow = axisConfig.getInFaultFlowPhases();
+        assertTrue("NewPhase wasn't found in InFaultFlow", isPhaseInFlow(inFlow, "NewPhase"));
+
+        ArrayList outFlow = axisConfig.getInFaultFlowPhases();
+        assertTrue("NewPhase wasn't found in OutFlow", isPhaseInFlow(outFlow, "NewPhase"));        
+    }
+
+    private boolean isPhaseInFlow(ArrayList inFlow, String phaseName) {
         boolean found = false;
-        for (int i = 0; i < inFlow.size(); i++) {
-            Phase phase = (Phase) inFlow.get(i);
-            if (phase.getName().equals("NewPhase")) {
+        for (Object anInFlow : inFlow) {
+            Phase phase = (Phase)anInFlow;
+            if (phase.getName().equals(phaseName)) {
                 found = true;
             }
         }
-        assertTrue("NewPhase wasn't found in InFaultFlow", found);
+        return found;
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?rev=690515&r1=690514&r2=690515&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Sat Aug 30 07:30:37 2008
@@ -58,7 +58,7 @@
 
 
     /**
-     * @deprecated This was used only by the now deprecated processHTTPGetRequest() method. 
+     * @deprecated This was used only by the now deprecated processHTTPGetRequest() method.
      */
     public static SOAPEnvelope createEnvelopeFromGetRequest(String requestUrl,
                                                             Map map, ConfigurationContext configCtx)
@@ -113,7 +113,7 @@
      * message was an MTOM message.
      * </p>
      * 
-     * @param msgContext
+     * @param msgContext the active MessageContext
      * @return true if SwA needs to be enabled
      */
     public static boolean doWriteMTOM(MessageContext msgContext) {
@@ -153,7 +153,7 @@
      * the incoming message was SwA type.
      * </p>
      * 
-     * @param msgContext
+     * @param msgContext the active MessageContext
      * @return true if SwA needs to be enabled
      */
     public static boolean doWriteSwA(MessageContext msgContext) {
@@ -188,8 +188,8 @@
      * MessageContext. If it's not there look in the OpContext. Use the defualt,
      * if it's not given in either contexts.
      *
-     * @param msgContext
-     * @return CharSetEncoding
+     * @param msgContext the active MessageContext
+     * @return String the CharSetEncoding
      */
     public static String getCharSetEncoding(MessageContext msgContext) {
         String charSetEnc = (String) msgContext
@@ -390,14 +390,12 @@
      * <p/>
      * If the request doesnot contain a content type; this will return true.
      *
-     * @param contentType
+     * @param contentType content type to check
      * @return Boolean
      */
     public static boolean isRESTRequest(String contentType) {
-        if (contentType == null) {
-            return false;
-        }
-        return (contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1 ||
+        return contentType != null &&
+               (contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1 ||
                 contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1 ||
                 contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1);
     }