axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r451905 [1/3] - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/template/java/ integration/test/org/apache/axis2/async/ kernel/src/org/apache/axis2/client/ kernel/src/org/apache/axis2/deployment/ kernel/src/org/a...
Date Mon, 02 Oct 2006 08:02:09 GMT
Author: sanka
Date: Mon Oct  2 01:02:06 2006
New Revision: 451905

URL: http://svn.apache.org/viewvc?view=rev&rev=451905
Log:

Added a mechamism where one can declear the policy assertions (in module.xml)  that the system should not exposed 
to outside. 

Implemented the serialization method of the Trust10.

Minor fixed for policy hadling mechanism in the generated stubs.



Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/async/AsyncServiceTest.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Stub.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisModule.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml
    webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Trust10.java
    webservices/axis2/trunk/java/modules/security/src/META-INF/module.xml
    webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/CryptoConfig.java

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?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- 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 Mon Oct  2 01:02:06 2006
@@ -50,9 +50,9 @@
      _service = new org.apache.axis2.description.AxisService("<xsl:value-of select="@servicename"/>" + this.hashCode());
      
     <xsl:if test="@policy">     
-     java.lang.String _service_policy_string = "<xsl:value-of select="@policy"/>";
-     org.apache.neethi.Policy _endpoint_policy = getPolicy(_service_policy_string);
-     _service.applyPolicy(_endpoint_policy);
+     java.lang.String _endpoint_policy_string = "<xsl:value-of select="@policy"/>";
+     org.apache.neethi.Policy _endpoint_policy = getPolicy(_endpoint_policy_string);
+     ((org.apache.axis2.description.PolicyInclude) _service.getPolicyInclude()).setPolicy(_endpoint_policy);
     </xsl:if>
 
         //creating the operations
@@ -74,16 +74,33 @@
             </xsl:choose>
 
             __operation.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@name"/>"));
-
+	
+	<!--
         <xsl:if test="@policy">
-        __operation_policy_string = "<xsl:value-of select="@policy"/>";
-	org.apache.neethi.Policy __operation_policy =  getPolicyFromString(__operation_policy_string);
-	__operation.applyPolicy(__operation_policy);
-
+        __operation_policy_string = "<xsl:value-of select="@policy"/>";	
+        org.apache.neethi.Policy __operation_policy =  getPolicy(__operation_policy_string);
+        ((org.apache.axis2.description.PolicyInclude) __operation.getPolicyInclude()).setPolicy(__operation_policy);
         </xsl:if>
+	-->
 
             _operations[<xsl:value-of select="position()-1"/>]=__operation;
-            _service.addOperation(__operation);
+            
+        <xsl:choose>
+		<xsl:when test="@policy">
+	    __operation_policy_string = "<xsl:value-of select="@policy"/>";	
+	    org.apache.neethi.Policy __operation_policy =  getPolicyFromString(__operation_policy_string);
+		
+	    _service.addOperation(__operation);
+	    __operation.applyPolicy(__operation_policy);
+		</xsl:when>
+		<xsl:otherwise>
+	    _service.addOperation(__operation);
+	    __operation.applyPolicy(new org.apache.neethi.Policy());
+		</xsl:otherwise>
+	</xsl:choose>
+            
+            
+            
         </xsl:for-each>
         }
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/async/AsyncServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/async/AsyncServiceTest.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/async/AsyncServiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/async/AsyncServiceTest.java Mon Oct  2 01:02:06 2006
@@ -1,8 +1,10 @@
 package org.apache.axis2.async;
 
-import junit.framework.TestCase;
+import javax.xml.namespace.QName;
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
+
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
@@ -27,8 +29,6 @@
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
 *

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Mon Oct  2 01:02:06 2006
@@ -125,9 +125,12 @@
             this.axisService.setClientSide(true);
             this.axisConfig.addService(this.axisService);
         } else {
-            throw new AxisFault(Messages.getMessage(
-                    "twoservicecannothavesamename",
-                    this.axisService.getName()));
+            
+            // FIXME we should throw an error only if the AxisConfigurations are different ..
+            
+//            throw new AxisFault(Messages.getMessage(
+//                    "twoservicecannothavesamename",
+//                    this.axisService.getName()));
         }
         AxisServiceGroup axisServiceGroup = (AxisServiceGroup) this.axisService.getParent();
         ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Stub.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Stub.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Stub.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Stub.java Mon Oct  2 01:02:06 2006
@@ -32,6 +32,7 @@
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 
 /**
@@ -43,6 +44,7 @@
  */
 public abstract class Stub {
 
+    protected AxisConfiguration _cofiguration;
     protected AxisService _service;
     protected ArrayList modules = new ArrayList();
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java Mon Oct  2 01:02:06 2006
@@ -229,6 +229,27 @@
         }
         return null;
     }
+    
+    protected QName[] getLocalPolicyAssertionNames(OMElement localPolicyAssertionsElement) {
+        
+        Iterator iterator = localPolicyAssertionsElement.getChildElements();
+        if (! iterator.hasNext()) {
+            return null;            
+        }
+                
+        ArrayList qnames = new ArrayList();
+        OMElement childElement;
+        
+        for (; iterator.hasNext();) {
+            childElement = (OMElement) iterator.next();
+            qnames.add(childElement.getQName());
+        }
+        
+        QName[] buffer = new QName[qnames.size()];
+        System.arraycopy(qnames.toArray(), 0, buffer, 0, qnames.size());
+        return buffer;
+         
+    }
 
     /**
      * Processes Handler element.

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java Mon Oct  2 01:02:06 2006
@@ -153,6 +153,18 @@
             if (supportedPolicyNamespaces != null) {
                 module.setSupportedPolicyNamespaces(processSupportedPolicyNamespaces(supportedPolicyNamespaces));
             }
+            
+            
+            /*
+             * Module description should contain a list of QName of the assertions that are local to the system.
+             * These assertions are not exposed to the outside.
+             */
+            OMElement localPolicyAssertionElement = moduleElement.getFirstChildWithName(new QName("local-policy-assertions"));
+            
+            if (localPolicyAssertionElement != null) {
+                module.setLocalPolicyAssertions(getLocalPolicyAssertionNames(localPolicyAssertionElement));
+            }
+            
 
             // processing Operations
             Iterator op_itr = moduleElement.getChildrenWithName(new QName(TAG_OPERATION));

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java Mon Oct  2 01:02:06 2006
@@ -43,10 +43,10 @@
     private PolicyInclude policyInclude = null;
 
     private HashMap children;
-    
-    // creating a logger instance 
+
+    // creating a logger instance
     private Log log = LogFactory.getLog(this.getClass());
-    
+
     public AxisDescription() {
         parameterInclude = new ParameterIncludeImpl();
         children = new HashMap();
@@ -163,16 +163,21 @@
      */
     public void applyPolicy(Policy policy) throws AxisFault {
         AxisConfiguration configuration = getAxisConfiguration();
+        
+        if (configuration == null) {
+            // FIXME return or throw an Exception?
+            return;            
+        }
 
         // sets AxisDescription policy
-        this.policyInclude.setPolicy(policy);
+        getPolicyInclude().setPolicy(policy);
 
         /*
          * now we should take the effective one .. it is necessary since
          * AxisDescription.applyPolicy(..) doesn't override policies at the
          * Upper levels.
          */
-        Policy effPolicy = this.policyInclude.getEffectivePolicy();
+        Policy effPolicy = getPolicyInclude().getEffectivePolicy();
 
         /*
          * for the moment we consider policies with only one alternative. If the
@@ -180,71 +185,88 @@
          * be considered.
          */
         Iterator iterator = effPolicy.getAlternatives();
-        if (! iterator.hasNext()) {
-            throw new AxisFault("Policy doesn't contain any policy alternatives");            
+        if (!iterator.hasNext()) {
+            throw new AxisFault(
+                    "Policy doesn't contain any policy alternatives");
         }
-        
+
         List assertionList = (List) iterator.next();
-        
+
         Assertion assertion;
         String namespaceURI;
-        
+
         List moduleList;
-        
+
         List namespaceList = new ArrayList();
         List modulesToEngage = new ArrayList();
-        
-        for (Iterator assertions = assertionList.iterator(); assertions.hasNext();) {
+
+        for (Iterator assertions = assertionList.iterator(); assertions
+                .hasNext();) {
             assertion = (Assertion) assertions.next();
             namespaceURI = assertion.getName().getNamespaceURI();
-            
-            moduleList = configuration.getModulesForPolicyNamesapce(namespaceURI);
-            
+
+            moduleList = configuration
+                    .getModulesForPolicyNamesapce(namespaceURI);
+
             if (moduleList == null) {
-                log.debug("can't find any module to process " + assertion.getName() + " type assertions");
+                log.debug("can't find any module to process "
+                        + assertion.getName() + " type assertions");
                 continue;
             }
-            
-            if (canSupportAssertion(assertion, moduleList)) {
-                throw new AxisFault("atleast one module can't support " + assertion.getName());
+
+            if (!canSupportAssertion(assertion, moduleList)) {
+                throw new AxisFault("atleast one module can't support "
+                        + assertion.getName());
             }
-            
-            if (namespaceList.contains(namespaceURI)) {
+
+            if (!namespaceList.contains(namespaceURI)) {
                 namespaceList.add(namespaceURI);
                 modulesToEngage.addAll(moduleList);
             }
         }
-        
+
+        /*
+         * FIXME We need to disengage any modules that are already engaged *but*
+         * has nothing to do with the policy to apply
+         */
+
         engageModulesToAxisDescription(modulesToEngage, this);
     }
-    
+
     private boolean canSupportAssertion(Assertion assertion, List moduleList) {
-        
+
+        AxisModule axisModule;
         Module module;
-        
+
         for (Iterator iterator = moduleList.iterator(); iterator.hasNext();) {
-            module = (Module) iterator.next();
-             /*
-              * FIXME .. need to add this method to the Module Interface ..
-              */
-//            
-//            if (! module.canSupportAssertion(assertion)) {
-//                log.debug(((AxisModule) module).getName() + " says it can't support " + assertion.getName());              
-//                return false;
-//            }
+            axisModule = (AxisModule) iterator.next();
+            // FIXME is this step really needed ??
+            // Shouldn't axisMoudle.getModule always return not-null value ??
+            module = axisModule.getModule();
+
+            if (!(module == null || module.canSupportAssertion(assertion))) {
+                log.debug(((AxisModule) axisModule).getName()
+                        + " says it can't support " + assertion.getName());
+                return false;
+            }
         }
-        
+
         return true;
     }
-    
-    private void engageModulesToAxisDescription(List moduleList, AxisDescription description) throws AxisFault {
-        
+
+    private void engageModulesToAxisDescription(List moduleList,
+            AxisDescription description) throws AxisFault {
+
         AxisModule axisModule;
-        
-        for (Iterator iterator = moduleList.iterator(); iterator.hasNext(); ) {
+        Module module;
+
+        for (Iterator iterator = moduleList.iterator(); iterator.hasNext();) {
             axisModule = (AxisModule) iterator.next();
-            
-            if (! description.isEngaged(axisModule.getName())) {
+            // FIXME is this step really needed ??
+            // Shouldn't axisMoudle.getModule always return not-null value ??
+            module = axisModule.getModule();
+
+            if (!(module == null || description.isEngaged(axisModule.getName()))) {
                 // engages the module to AxisDescription
                 description.engageModule(axisModule, getAxisConfiguration());
                 // notifies the module about the engagement

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisModule.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisModule.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisModule.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisModule.java Mon Oct  2 01:02:06 2006
@@ -26,7 +26,6 @@
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.net.URI;
 import java.net.URL;
 
 /**
@@ -72,6 +71,8 @@
     private String moduleDescription;
 
     private String[] supportedPolicyNames;
+    
+    private QName[] localPolicyAssertions;
 
     /**
      * Constructor ModuleDescription.
@@ -274,6 +275,14 @@
 
     public void setSupportedPolicyNamespaces(String[] supportedPolicyNamespaces) {
         this.supportedPolicyNames = supportedPolicyNamespaces;
+    }
+    
+    public QName[] getLocalPolicyAssertions() {
+        return localPolicyAssertions;
+    }
+    
+    public void setLocalPolicyAssertions(QName[] localPolicyAssertions) {
+        this.localPolicyAssertions = localPolicyAssertions;
     }
 
     public URL getFileName() {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java?view=diff&rev=451905&r1=451904&r2=451905
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java Mon Oct  2 01:02:06 2006
@@ -21,7 +21,9 @@
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.namespace.Constants;
+import org.apache.axis2.util.ExternalPolicySerializer;
 import org.apache.axis2.util.PolicyUtil;
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
 import org.apache.axis2.wsdl.WSDLConstants;
@@ -82,10 +84,12 @@
 
     private HashMap policiesInDefinitions;
 
+    private ExternalPolicySerializer serializer;
+
     private HashMap messagesMap;
 
     public AxisService2OM(AxisService service, String[] serviceURL,
-                          String style, String use, String servicePath) {
+            String style, String use, String servicePath) {
         this.axisService = service;
         urls = serviceURL;
         if (style == null) {
@@ -100,6 +104,16 @@
         }
         this.servicePath = servicePath;
         this.targetNamespace = service.getTargetNamespace();
+
+        serializer = new ExternalPolicySerializer();
+        // CHECKME check whether service.getAxisConfiguration() return null ???
+
+        AxisConfiguration configuration = service.getAxisConfiguration();
+        if (configuration != null) {
+            serializer.setAssertionsToFilter(configuration
+                    .getLocalPolicyAssertions());
+        }
+
     }
 
     public OMElement generateOM() throws Exception {
@@ -134,10 +148,13 @@
         tns = ele.declareNamespace(axisService.getTargetNamespace(), prefix);
 
         // adding documentation element
-        //<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>
+        // <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>
         String servicedescription = axisService.getServiceDescription();
         if (servicedescription != null && !"".equals(servicedescription)) {
-            OMElement documenentattion = fac.createOMElement("documentation", wsdl);
+            OMElement documenentattion = fac.createOMElement("documentation",
+                    wsdl);
             documenentattion.setText(servicedescription);
             ele.addChild(documenentattion);
         }
@@ -162,9 +179,12 @@
                 schema.write(writer);
                 String schemaString = writer.toString();
                 if (!"".equals(schemaString)) {
-                    XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new StringReader(schemaString));
+                    XMLStreamReader xmlReader = StAXUtils
+                            .createXMLStreamReader(new StringReader(
+                                    schemaString));
 
-                    StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac, xmlReader);
+                    StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac,
+                            xmlReader);
                     wsdlTypes.addChild(staxOMBuilder.getDocumentElement());
                 }
             }
@@ -186,7 +206,8 @@
             }
         }
         generateService(fac, ele);
-        addPoliciesToDefinitionElement(policiesInDefinitions.values().iterator(), definition);
+        addPoliciesToDefinitionElement(policiesInDefinitions.values()
+                .iterator(), definition);
 
         return ele;
     }
@@ -203,11 +224,16 @@
             }
             String MEP = axisOperation.getMessageExchangePattern();
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage inaxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inaxisMessage != null) {
@@ -217,11 +243,16 @@
             }
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage outAxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 if (outAxisMessage != null) {
@@ -247,7 +278,7 @@
     }
 
     private void generateHeaderMessages(AxisMessage axismessage, OMFactory fac,
-                                        OMElement defintions) {
+            OMElement defintions) {
         ArrayList extList = axismessage.getSoapHeaders();
         for (int i = 0; i < extList.size(); i++) {
             SOAPHeaderMessage header = (SOAPHeaderMessage) extList.get(i);
@@ -260,8 +291,9 @@
                     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());
+            if (header.getElement() == null) {
+                throw new RuntimeException(ELEMENT_ATTRIBUTE_NAME
+                        + " is null for " + header.getMessage());
             }
             messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, getPrefix(header
                     .getElement().getNamespaceURI())
@@ -270,18 +302,18 @@
     }
 
     private void writeMessage(AxisMessage axismessage, OMFactory fac,
-                              OMElement defintions) {
+            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);
                 messagePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
                 messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
@@ -322,11 +354,16 @@
 
             String MEP = axisOperation.getMessageExchangePattern();
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage inaxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inaxisMessage != null) {
@@ -336,17 +373,23 @@
                             + ":" + inaxisMessage.getName(), null);
                     addPolicyAsExtElement(PolicyInclude.INPUT_POLICY,
                             inaxisMessage.getPolicyInclude(), input, fac);
-                    addWSAWActionAttribute(input, axisOperation.getInputAction());
+                    addWSAWActionAttribute(input, axisOperation
+                            .getInputAction());
                     operation.addChild(input);
                 }
             }
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage outAxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 if (outAxisMessage != null) {
@@ -356,7 +399,8 @@
                             + ":" + outAxisMessage.getName(), null);
                     addPolicyAsExtElement(PolicyInclude.OUTPUT_POLICY,
                             outAxisMessage.getPolicyInclude(), output, fac);
-                    addWSAWActionAttribute(output, axisOperation.getOutputAction());
+                    addWSAWActionAttribute(output, axisOperation
+                            .getOutputAction());
                     operation.addChild(output);
                 }
             }
@@ -373,7 +417,8 @@
                             + ":" + faultyMessge.getName(), null);
                     fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(),
                             null);
-                    addWSAWActionAttribute(fault, axisOperation.getFaultAction(faultyMessge.getName()));
+                    addWSAWActionAttribute(fault, axisOperation
+                            .getFaultAction(faultyMessge.getName()));
                     // TODO add policies for fault messages
                     operation.addChild(fault);
                 }
@@ -406,14 +451,16 @@
             throws Exception {
         for (int i = 0; i < urls.length; i++) {
             String urlString = urls[i];
-            String protocol = urlString == null ? null : new URI(urlString).getScheme();
+            String protocol = urlString == null ? null : new URI(urlString)
+                    .getScheme();
             if (urlString == null) {
                 urlString = "REPLACE_WITH_ACTUAL_URL";
             }
             OMElement port = fac.createOMElement(PORT, wsdl);
             service.addChild(port);
-            String name = axisService.getName() + SOAP11PORT + ((protocol == null) ? "" : "_" + protocol);
-            if(i > 0) {
+            String name = axisService.getName() + SOAP11PORT
+                    + ((protocol == null) ? "" : "_" + protocol);
+            if (i > 0) {
                 name += i;
             }
             port.addAttribute(ATTRIBUTE_NAME, name, null);
@@ -436,7 +483,7 @@
                 OMElement port = fac.createOMElement(PORT, wsdl);
                 service.addChild(port);
                 String name = axisService.getName() + HTTP_PORT;
-                if(i > 0) {
+                if (i > 0) {
                     name += i;
                 }
                 port.addAttribute(ATTRIBUTE_NAME, name, null);
@@ -454,14 +501,16 @@
             throws Exception {
         for (int i = 0; i < urls.length; i++) {
             String urlString = urls[i];
-            String protocol = urlString == null ? null : new URI(urlString).getScheme();
+            String protocol = urlString == null ? null : new URI(urlString)
+                    .getScheme();
             if (urlString == null) {
                 urlString = "REPLACE_WITH_ACTUAL_URL";
             }
             OMElement port = fac.createOMElement(PORT, wsdl);
             service.addChild(port);
-            String name = axisService.getName() + SOAP12PORT + ((protocol == null) ? "" : "_" + protocol);
-            if(i > 0) {
+            String name = axisService.getName() + SOAP12PORT
+                    + ((protocol == null) ? "" : "_" + protocol);
+            if (i > 0) {
                 name += i;
             }
             port.addAttribute(ATTRIBUTE_NAME, name, null);
@@ -541,11 +590,16 @@
             String MEP = axisOperation.getMessageExchangePattern();
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage inaxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inaxisMessage != null) {
@@ -562,11 +616,16 @@
             }
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage outAxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 if (outAxisMessage != null) {
@@ -668,11 +727,16 @@
             String MEP = axisOperation.getMessageExchangePattern();
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage inaxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inaxisMessage != null) {
@@ -689,11 +753,16 @@
             }
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage outAxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 if (outAxisMessage != null) {
@@ -761,11 +830,16 @@
             String MEP = axisOperation.getMessageExchangePattern();
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage inaxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inaxisMessage != null) {
@@ -781,11 +855,16 @@
             }
 
             if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP)) {
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+                            .equals(MEP)
+                    || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+                            .equals(MEP)) {
                 AxisMessage outAxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 if (outAxisMessage != null) {
@@ -802,7 +881,7 @@
     }
 
     private void writeSoapHeaders(AxisMessage inaxisMessage, OMFactory fac,
-                                  OMElement input, OMNamespace soapNameSpace) throws Exception {
+            OMElement input, OMNamespace soapNameSpace) throws Exception {
         ArrayList extElementList;
         extElementList = inaxisMessage.getSoapHeaders();
         if (extElementList != null) {
@@ -816,8 +895,8 @@
     }
 
     private void addExtensionElemnet(OMFactory fac, OMElement element,
-                                     String name, String att1Name, String att1Value, String att2Name,
-                                     String att2Value, OMNamespace soapNameSpace) {
+            String name, String att1Name, String att1Value, String att2Name,
+            String att2Value, OMNamespace soapNameSpace) {
         OMElement soapbinding = fac.createOMElement(name, soapNameSpace);
         element.addChild(soapbinding);
         soapbinding.addAttribute(att1Name, att1Value, null);
@@ -827,8 +906,8 @@
     }
 
     private void addExtensionElement(OMFactory fac, OMElement element,
-                                     String name, String att1Name, String att1Value,
-                                     OMNamespace soapNameSpace) {
+            String name, String att1Name, String att1Value,
+            OMNamespace soapNameSpace) {
         OMElement extElement = fac.createOMElement(name, soapNameSpace);
         element.addChild(extElement);
         extElement.addAttribute(att1Name, att1Value, null);
@@ -839,7 +918,7 @@
     }
 
     private void addSOAPHeader(OMFactory fac, OMElement element,
-                               SOAPHeaderMessage header, OMNamespace soapNameSpace) {
+            SOAPHeaderMessage header, OMNamespace soapNameSpace) {
         OMElement extElement = fac.createOMElement("header", soapNameSpace);
         element.addChild(extElement);
         String use = header.getUse();
@@ -871,26 +950,30 @@
         if (action == null || action.length() == 0) {
             return;
         }
-        OMNamespace namespace = element.declareNamespace(AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
+        OMNamespace namespace = element.declareNamespace(
+                AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
         element.addAttribute("Action", action, namespace);
     }
 
     private void addPolicyAsExtElement(int type, PolicyInclude policyInclude,
-                                       OMElement element, OMFactory factory) throws Exception {
+            OMElement element, OMFactory factory) throws Exception {
         ArrayList elementList = policyInclude.getPolicyElements(type);
-        
+
         for (Iterator iterator = elementList.iterator(); iterator.hasNext();) {
             Object policyElement = iterator.next();
 
             if (policyElement instanceof Policy) {
-                element.addChild(PolicyUtil.getPolicyComponentAsOMElement((PolicyComponent) policyElement));
-                
+                element.addChild(PolicyUtil.getPolicyComponentAsOMElement(
+                        (PolicyComponent) policyElement, serializer));
+
             } else if (policyElement instanceof PolicyReference) {
-                element.addChild(PolicyUtil.getPolicyComponentAsOMElement((PolicyComponent) policyElement));
-                
+                element
+                        .addChild(PolicyUtil
+                                .getPolicyComponentAsOMElement((PolicyComponent) policyElement));
+
                 PolicyRegistry reg = policyInclude.getPolicyRegistry();
                 String key = ((PolicyReference) policyElement).getURI();
-                
+
                 if (key.startsWith("#")) {
                     key = key.substring(key.indexOf("#") + 1);
                 }
@@ -898,17 +981,16 @@
                 Policy p = reg.lookup(key);
 
                 if (p == null) {
-                    throw new Exception("Policy not found for uri : "
-                            + key);
+                    throw new Exception("Policy not found for uri : " + key);
                 }
-                
+
                 addPolicyToDefinitionElement(key, p);
             }
         }
     }
 
     private void addPolicyAsExtAttribute(int type, PolicyInclude policyInclude,
-                                         OMElement element, OMFactory factory) throws Exception {
+            OMElement element, OMFactory factory) throws Exception {
 
         ArrayList elementList = policyInclude.getPolicyElements(type);
         ArrayList policyURIs = new ArrayList();
@@ -919,7 +1001,7 @@
 
             if (policyElement instanceof Policy) {
                 Policy p = (Policy) policyElement;
-                
+
                 if (p.getId() != null) {
                     key = "#" + p.getId();
                 } else if (p.getName() != null) {
@@ -933,8 +1015,7 @@
                 addPolicyToDefinitionElement(key, p);
 
             } else {
-                String uri = ((PolicyReference) policyElement)
-                        .getURI();
+                String uri = ((PolicyReference) policyElement).getURI();
                 PolicyRegistry registry = policyInclude.getPolicyRegistry();
 
                 if (uri.startsWith("#")) {
@@ -946,7 +1027,8 @@
                 Policy p = registry.lookup(key);
 
                 if (p == null) {
-                    throw new RuntimeException("Cannot resolve " + uri + " to a Policy");
+                    throw new RuntimeException("Cannot resolve " + uri
+                            + " to a Policy");
                 }
                 addPolicyToDefinitionElement(key, p);
             }
@@ -956,8 +1038,8 @@
             String value = null;
 
             /*
-             * We need to create a String that is like 'uri1 uri2 .." to set as the value of 
-             * the wsp:PolicyURIs attribute.
+             * 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();
@@ -974,14 +1056,15 @@
     }
 
     private void addPoliciesToDefinitionElement(Iterator iterator,
-                                                OMElement definitionElement) throws Exception {
+            OMElement definitionElement) throws Exception {
         Policy policy;
         OMElement policyElement;
         OMNode firstChild;
 
         for (; iterator.hasNext();) {
             policy = (Policy) iterator.next();
-            policyElement = PolicyUtil.getPolicyComponentAsOMElement(policy);
+            policyElement = PolicyUtil.getPolicyComponentAsOMElement(policy,
+                    serializer);
 
             firstChild = definition.getFirstOMChild();
 



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