Author: gdaniels
Date: Wed Jan 11 20:52:02 2006
New Revision: 368265

URL: http://svn.apache.org/viewcvs?rev=368265&view=rev
Log:
Begin roughing in support for W3C version of WS-Addressing.

Needs some serious cleanup (tomorrow).  Tests all pass, will start adding W3C 
version tests tomorrow too.

Modified:
    
webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
    
webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java
    
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
    
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReferenceType.java
    
webservices/addressing/trunk/src/org/apache/axis/message/addressing/util/AddressingUtils.java
    webservices/addressing/trunk/test/addressing/TestEPR.java

Modified: 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
URL: 
http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java?rev=368265&r1=368264&r2=368265&view=diff
==============================================================================
--- 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
 (original)
+++ 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
 Wed Jan 11 20:52:02 2006
@@ -23,6 +23,7 @@
 import org.apache.axis.types.URI;
 import org.apache.axis.AxisEngine;
 import org.apache.axis.MessageContext;
+import org.apache.axis.utils.ArrayUtil;
 import org.w3c.dom.Element;
 
 import javax.xml.namespace.QName;
@@ -44,6 +45,11 @@
 public class AddressingHeaders {
 
     /**
+     * Are we using the W3C spec rules? (no ref props, etc...)
+     */
+    boolean isW3CVersion = false;
+
+    /**
      * Field action
      */
     private Action action = null;
@@ -82,13 +88,15 @@
      * Field relatesTo
      */
     private ArrayList relatesTo = new ArrayList();
-    
+
     /**
      * Field ReferenceProperties
      */
-    private ReferencePropertiesType referenceProperties = 
+    private ReferencePropertiesType referenceProperties =
         new ReferencePropertiesType();
 
+    private List referenceParameters;
+
     /**
      * Option to set mustUnderstand="true" on the headers or not
      */
@@ -103,13 +111,14 @@
     public AddressingHeaders(EndpointReference epr) {
         this.to = new To(epr.getAddress());
         this.referenceProperties = epr.getProperties();
+        this.referenceParameters = epr.getParameters();
     }
 
     /**
      * Constructor AddressingHeaders
      * 
-     * @param env 
-     * @throws Exception 
+     * @param env
+     * @throws Exception
      */
     public AddressingHeaders(SOAPEnvelope env) throws Exception {
         this(env, null, true, false, true, new ArrayList(0));
@@ -118,13 +127,13 @@
     /**
      * Constructor AddressingHeaders
      * 
-     * @param env     
-     * @param process 
+     * @param env
+     * @param process
      * @param remove
-     * @throws Exception 
+     * @throws Exception
      */
-    public AddressingHeaders(SOAPEnvelope env, 
-                             boolean process, 
+    public AddressingHeaders(SOAPEnvelope env,
+                             boolean process,
                              boolean remove)
             throws Exception {
         this(env, null, process, remove, true,  new ArrayList(0));
@@ -133,14 +142,14 @@
     /**
      * Constructor AddressingHeaders
      * 
-     * @param env     
+     * @param env
      * @param actorURI
-     * @param process 
-     * @throws Exception 
+     * @param process
+     * @throws Exception
      */
-    public AddressingHeaders(SOAPEnvelope env, 
+    public AddressingHeaders(SOAPEnvelope env,
                              String actorURI,
-                             boolean process, 
+                             boolean process,
                              boolean remove)
         throws Exception {
         this(env, actorURI, process, remove, true, new ArrayList(0));
@@ -162,17 +171,16 @@
      *                       then only headers matching the qname in the list
      *                       will be added as reference properties.
      * 
-     * @throws Exception 
+     * @throws Exception
      */
-    public AddressingHeaders(SOAPEnvelope env, 
-            String actorURI,
-            boolean process, 
-            boolean remove,
-            boolean setMustUnderstand,
-            List refPropsQNames)
-throws Exception {
-       
this(env,actorURI,process,remove,setMustUnderstand,false,refPropsQNames);
-       
+    public AddressingHeaders(SOAPEnvelope env,
+                             String actorURI,
+                             boolean process,
+                             boolean remove,
+                             boolean setMustUnderstand,
+                             List refPropsQNames)
+            throws Exception {
+        
this(env,actorURI,process,remove,setMustUnderstand,false,refPropsQNames);
     }
     /**
      * Constructor AddressingHeaders.
@@ -191,11 +199,11 @@
      *                       then only headers matching the qname in the list
      *                       will be added as reference properties.
      * 
-     * @throws Exception 
+     * @throws Exception
      */
-    public AddressingHeaders(SOAPEnvelope env, 
+    public AddressingHeaders(SOAPEnvelope env,
                              String actorURI,
-                             boolean process, 
+                             boolean process,
                              boolean remove,
                              boolean setMustUnderstand,
                              boolean permitParseNonSpecificAction,
@@ -216,7 +224,19 @@
                 (SOAPHeaderElement)iter.next();
 
             Name name = headerElement.getElementName();
-            if (AddressingUtils.isAddressingNamespaceURI(name.getURI())) {
+
+            // NOTE : This might want to check consistent use of a single
+            // namespace instead of allowing multiple versions....?
+            boolean isAddressingHeader = false;
+
+            if (AddressingUtils.isW3CAddressingNamespaceURI(name.getURI())) {
+                isW3CVersion = true;
+                isAddressingHeader = true;
+            } else if 
(AddressingUtils.isAddressingNamespaceURI(name.getURI())) {
+                isAddressingHeader = true;
+            }
+
+            if (isAddressingHeader) {
                 // it's a WSA header
                 String localName = name.getLocalName();
 
@@ -274,8 +294,6 @@
 
     /**
      * Method getAction
-     * 
-     * @return 
      */
     public Action getAction() {
         return action;
@@ -284,7 +302,7 @@
     /**
      * Method setAction
      * 
-     * @param action 
+     * @param action
      */
     public void setAction(Action action) {
         this.action = action;
@@ -296,8 +314,6 @@
 
     /**
      * Method getTo
-     * 
-     * @return 
      */
     public To getTo() {
         return to;
@@ -306,7 +322,7 @@
     /**
      * Method setTo
      * 
-     * @param to 
+     * @param to
      */
     public void setTo(To to) {
         this.to = to;
@@ -315,12 +331,12 @@
     /**
      * Method setMessageID
      * 
-     * @param messageID 
+     * @param messageID
      */
     public void setMessageID(MessageID messageID) {
         this.messageID = messageID;
     }
-    
+
     /**
      * Method setReferenceProperties
      * 
@@ -329,7 +345,7 @@
     public void setReferenceProperties(ReferencePropertiesType refProps) {
         this.referenceProperties = refProps;
     }
-    
+
     /**
      * Method getReferenceProperties
      * 
@@ -338,7 +354,22 @@
     public ReferencePropertiesType getReferenceProperties() {
         return referenceProperties;
     }
-    
+
+    /**
+     * Get the reference parameters
+     * @return a List of reference parameters (MessageElements)
+     */
+    public List getReferenceParameters() {
+        return referenceParameters;
+    }
+
+    public void addReferenceParameter(MessageElement refP) {
+        if (referenceParameters == null) {
+            referenceParameters = new ArrayList();
+        }
+        referenceParameters.add(refP);
+    }
+
     /**
      * Method addReferenceProperty : Adds an XML element
      * to the referencePropeties collection
@@ -348,7 +379,7 @@
     public void addReferenceProperty(Element refProp) {
         referenceProperties.add(refProp);
     }
-        
+
     public void addReferenceProperty(MessageElement refProp) {
         referenceProperties.add(refProp);
     }
@@ -356,7 +387,7 @@
     /**
      * Adds these addressing headers to the specified SOAP envelope.
      * 
-     * @param env 
+     * @param env
      * @throws Exception
      */
     public void toEnvelope(SOAPEnvelope env)
@@ -368,22 +399,22 @@
     /**
      * Adds these addressing headers to the specified SOAP envelope.
      * 
-     * @param env 
+     * @param env
      * @throws javax.xml.soap.SOAPException
-     * @throws ParserConfigurationException 
+     * @throws ParserConfigurationException
      */
     public void toEnvelope(SOAPEnvelope env, String actorURI)
         throws Exception {
 
         if (env.getNamespaceURI(Constants.NS_PREFIX_ADDRESSING) == null) {
-            env.addNamespaceDeclaration(Constants.NS_PREFIX_ADDRESSING, 
+            env.addNamespaceDeclaration(Constants.NS_PREFIX_ADDRESSING,
                                         
AddressingUtils.getAddressingNamespaceURI());
         }
 
         AddressingUtils.removeHeaders(env.getHeader(), actorURI);
 
-        SOAPHeaderElement header = null;
-        
+        SOAPHeaderElement header;
+
         if (messageID != null) {
             header = messageID.toSOAPHeaderElement(env, actorURI);
             header.setMustUnderstand(setMustUnderstand);
@@ -426,15 +457,27 @@
                 header.setMustUnderstand(setMustUnderstand);
             }
         }
-        
-        serializeReferenceProperties(env, actorURI);
+
+        serializeReferenceProperties(env,
+                                     referenceProperties.get_any(),
+                                     actorURI,
+                                     false);
+        if (referenceParameters != null && !referenceParameters.isEmpty()) {
+            MessageElement [] refParams =
+                    (MessageElement []) ArrayUtil.convertObjectToArray(
+                            referenceParameters,
+                            MessageElement [].class);
+            serializeReferenceProperties(env,
+                                         refParams,
+                                         actorURI,
+                                         isW3CVersion);
+        }
     }
-    
+
 
     /**
      * Method getMessageID
      * 
-     * @return 
      */
     public MessageID getMessageID() {
         return messageID;
@@ -443,7 +486,6 @@
     /**
      * Method getRelatesTo
      * 
-     * @return 
      */
     public List getRelatesTo() {
         return relatesTo;
@@ -463,9 +505,9 @@
     /**
      * Method addRelatesTo
      * 
-     * @param uri  
-     * @param type 
-     * @throws URI.MalformedURIException 
+     * @param uri
+     * @param type
+     * @throws URI.MalformedURIException
      */
     public void addRelatesTo(String uri, QName type)
             throws URI.MalformedURIException {
@@ -484,7 +526,6 @@
     /**
      * Method getFrom
      * 
-     * @return 
      */
     public EndpointReference getFrom() {
         return from;
@@ -493,7 +534,7 @@
     /**
      * Method setFrom
      * 
-     * @param ref 
+     * @param ref
      */
     public void setFrom(EndpointReference ref) {
         from = new From(ref);
@@ -502,7 +543,6 @@
     /**
      * Method getReplyTo
      * 
-     * @return 
      */
     public EndpointReference getReplyTo() {
         return replyTo;
@@ -511,7 +551,7 @@
     /**
      * Method setReplyTo
      * 
-     * @param ref 
+     * @param ref
      */
     public void setReplyTo(EndpointReference ref) {
         replyTo = new ReplyTo(ref);
@@ -520,7 +560,6 @@
     /**
      * Method getFaultTo
      * 
-     * @return 
      */
     public EndpointReference getFaultTo() {
         return faultTo;
@@ -529,24 +568,24 @@
     /**
      * Method setFaultTo
      * 
-     * @param epr 
+     * @param epr
      */
     public void setFaultTo(EndpointReference epr) {
         this.faultTo = new FaultTo(epr);
     }
-    
+
     /**
      * Add the reference property to the reference properties collection
      * 
      * @param headerElement
      * @throws Exception
      */
-    private boolean processReferenceProperty(SOAPHeaderElement headerElement, 
-                                             List refPropQNames) 
+    private boolean processReferenceProperty(SOAPHeaderElement headerElement,
+                                             List refPropQNames)
         throws Exception {
         Name name = headerElement.getElementName();
         QName elementName = new QName(name.getURI(), name.getLocalName());
-        
+
         // if we got to this point, the user wants deserialization of ref 
props.
         // if refPropQNames was a null, it is treated as a '*' or process all 
headers
         // otherwise we check to see if the element name was specified by the 
user
@@ -557,7 +596,7 @@
             return false;
         }
     }
-        
+
     /**
      * Serialize the reference properties in the SOAP Header
      * 
@@ -565,37 +604,50 @@
      * @param actorURI
      */
     private void serializeReferenceProperties(SOAPEnvelope env,
-                                              String actorURI) 
+                                              MessageElement [] refPs,
+                                              String actorURI,
+                                              boolean addAttribute)
         throws Exception {
         // If no referenceProps are available, we are done
-        if (referenceProperties == null) { return; }
-        
-        SOAPHeaderElement element = null;
+        if (refPs == null) { return; }
+
+        SOAPHeaderElement element;
+        SOAPHeader header = env.getHeader();
+        if (header == null) { header = env.addHeader(); }
+
         // Add each ref property to SOAP Header
-        for (int i = 0; i < referenceProperties.size(); i++) {
-            Object refProp = referenceProperties.get(i);
-            
-            if (refProp instanceof SOAPHeaderElement) {
-                // already a SOAPHeaderElement
-                element = (SOAPHeaderElement)refProp;
-            } else if (refProp instanceof 
org.apache.axis.message.MessageElement) {
-                // conversion from MessageElement to SOAPHeaderElement
-                org.apache.axis.message.MessageElement msgElement = 
-                    (org.apache.axis.message.MessageElement)refProp;
-                element = new 
org.apache.axis.message.SOAPHeaderElement(msgElement.getAsDOM());
-            } else if (refProp instanceof Element) {
-                Element refPropElement = (Element) refProp;
-                // conversion from DOM Element
-                element = new 
org.apache.axis.message.SOAPHeaderElement(refPropElement);
-            } else {
-                throw new Exception(refProp.getClass().getName());
-            }
-            
-            SOAPHeader header = env.getHeader();
-            if (header == null) { header = env.addHeader(); }
+        for (int i = 0; i < refPs.length; i++) {
+            MessageElement refProp = refPs[i];
+
+            element = makeSOAPHeader(refProp);
             element.setActor(actorURI);
+
+            // If we're supposed to mark this as a refP, do so (W3C version)
+            if (addAttribute) {
+                element.addAttribute(Constants.ATTR_REFP, "true");
+            }
             header.addChildElement(element);
         }
+    }
+
+    private SOAPHeaderElement makeSOAPHeader(Object refP) throws Exception {
+        SOAPHeaderElement element;
+        if (refP instanceof SOAPHeaderElement) {
+            // already a SOAPHeaderElement
+            element = (SOAPHeaderElement)refP;
+        } else if (refP instanceof MessageElement) {
+            // conversion from MessageElement to SOAPHeaderElement
+            MessageElement msgElement =
+                (MessageElement)refP;
+            element = new 
org.apache.axis.message.SOAPHeaderElement(msgElement.getAsDOM());
+        } else if (refP instanceof Element) {
+            Element refPropElement = (Element) refP;
+            // conversion from DOM Element
+            element = new 
org.apache.axis.message.SOAPHeaderElement(refPropElement);
+        } else {
+            throw new Exception(refP.getClass().getName());
+        }
+        return element;
     }
 
     public boolean isSetMustUnderstand() {

Modified: 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java
URL: 
http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java?rev=368265&r1=368264&r2=368265&view=diff
==============================================================================
--- 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java
 (original)
+++ 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java
 Wed Jan 11 20:52:02 2006
@@ -16,6 +16,11 @@
  */
 package org.apache.axis.message.addressing;
 
+import org.apache.axis.message.PrefixedQName;
+
+import javax.xml.soap.Name;
+import javax.xml.namespace.QName;
+
 /**
  * WS-Addressing constants.
  * 
@@ -44,7 +49,13 @@
      * Namespace for 2004/08 revision of WSA schema.
      */
     public static final String NS_URI_ADDRESSING_2004_08 =
-        "http://schemas.xmlsoap.org/ws/2004/08/addressing";;
+            "http://schemas.xmlsoap.org/ws/2004/08/addressing";;
+
+    /**
+     * Namespace for 2005/08 revision of WSA schema (CR version too)
+     */
+    public static final String NS_URI_ADDRESSING_2005_08 =
+            "http://www.w3.org/2005/08/addressing";;
 
     /**
      * Default WSA namespace to use when serializing EPRs or WSA headers.
@@ -52,6 +63,9 @@
     public static final String NS_URI_ADDRESSING_DEFAULT =
         NS_URI_ADDRESSING_2004_08;
 
+    public static final String URI_ANONYMOUS_W3C =
+            "http://www.w3.org/2005/08/addressing/anonymous";;
+
     /**
      * Field ENDPOINT_REFERENCE
      */
@@ -179,28 +193,34 @@
      */
     public static final String ENV_ADDRESSING_REPLYTO_URI =
         "addressing.replyTo.URI";
-    
+
     /**
      * SOAP message context prop with default value for wsa:FaultTo header for 
outgoing request messages.
      */
     public static final String ENV_ADDRESSING_FAULTTO_URI =
         "addressing.faultTo.URI";
-    
+
     /**
      * SOAP message context prop that expects a value of "true" or "false".
      */
     public static final String ENV_ADDRESSING_SET_MUST_UNDERSTAND =
         "addressing.setMustUnderstand";
-    
+
     /**
      * SOAP message context prop that expects a value of "true" or "false".
      */
     public static final String ENV_ADDRESSING_SEND_REPLYTO =
-        "addressing.sendReplyTo";      
+        "addressing.sendReplyTo";
 
     /**
      * Field QNAME_ACTION
      */
     public static final String WSDL_ATTRIB_ACTION = "Action";
 
+    public static final QName QN_ATTR_REFP =
+            new QName(NS_URI_ADDRESSING_2005_08, "IsReferenceParameter");
+    /**
+     * IsReferenceParameter attribute Name
+     */
+    public static final Name ATTR_REFP = new PrefixedQName(QN_ATTR_REFP);
 }

Modified: 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
URL: 
http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java?rev=368265&r1=368264&r2=368265&view=diff
==============================================================================
--- 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
 (original)
+++ 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
 Wed Jan 11 20:52:02 2006
@@ -34,6 +34,8 @@
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPHeaderElement;
 import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Java content class for EndpointReference element declaration.
@@ -46,7 +48,7 @@
  * @author Davanum Srinivas ([EMAIL PROTECTED])
  */
 public class EndpointReference extends EndpointReferenceType {
-    
+
     private static Log log =
         LogFactory.getLog(EndpointReference.class.getName());
 
@@ -100,7 +102,9 @@
         while(iter.hasNext()) {
             javax.xml.soap.Node child = (javax.xml.soap.Node)iter.next();
             if (child instanceof SOAPElement) {
-                if 
(!AddressingUtils.isAddressingNamespaceURI(child.getNamespaceURI())) {
+                String namespaceURI = child.getNamespaceURI();
+                if (!(AddressingUtils.isAddressingNamespaceURI(namespaceURI) ||
+                    
AddressingUtils.isW3CAddressingNamespaceURI(namespaceURI))) {
                     // skip for now - does not currently handle extensibility 
elements
                     continue;
                 }
@@ -110,25 +114,30 @@
                         Address.fromSOAPElement((SOAPElement)child);
                     setAddress(address);
                 } else if (Constants.PORT_TYPE.equals(localName)) {
-                    PortType portType = 
+                    PortType portType =
                         PortType.fromSOAPElement((SOAPElement)child);
                     setPortType(portType);
                 } else if (Constants.SERVICE_NAME.equals(localName)) {
-                    ServiceNameType serviceName = 
+                    ServiceNameType serviceName =
                         ServiceNameType.fromSOAPElement((SOAPElement)child);
                     setServiceName(serviceName);
                 } else if (Constants.REFERENCE_PROPERTIES.equals(localName)) {
-                    ReferencePropertiesType props = 
+                    ReferencePropertiesType props =
                         
ReferencePropertiesType.fromSOAPElement((SOAPElement)child);
                     setProperties(props);
                 } else if (Constants.REFERENCE_PARAMETERS.equals(localName)) {
-                    ReferenceParametersType params =
-                        
ReferenceParametersType.fromSOAPElement((SOAPElement)child);
+                    ArrayList params = null;
+                    Iterator refPs = ((SOAPElement)child).getChildElements();
+                    while (refPs.hasNext()) {
+                        SOAPElement param = (SOAPElement) refPs.next();
+                        if (params == null) params = new ArrayList();
+                        params.add(new MessageElement(param));
+                    }
                     setParameters(params);
                 } else {
                     // ignore others
                 }
-            } 
+            }
         }
         if ( getAddress() == null ) {
             throw new IllegalArgumentException( "Specified element does not 
contain the required 'wsa:Address' child element." );
@@ -169,9 +178,14 @@
                         ReferencePropertiesType.fromElement((Element)child);
                     setProperties(props);
                 } else if (Constants.REFERENCE_PARAMETERS.equals(localName)) {
-                    ReferenceParametersType params =
-                        ReferenceParametersType.fromElement((Element)child);
-                    setParameters(params);
+                    NodeList paramNodes = child.getChildNodes();
+                    for (int idx=0; idx < children.getLength(); idx++) {
+                        Node param = paramNodes.item(i);
+                        if (!(param instanceof Element)) {
+                            continue;
+                        }
+                        addReferenceParameter(new 
MessageElement((Element)param));
+                    }
                 } else {
                     // ignore others
                 }
@@ -183,6 +197,16 @@
     }
 
     /**
+     * Insert a new reference parameter
+     *
+     * @param param XML rep of referenceParameter (MessageElement)
+     */
+    private void addReferenceParameter(MessageElement param) {
+        if (m_parameters == null) m_parameters = new ArrayList();
+        m_parameters.add(param);
+    }
+
+    /**
      * Method toDOM.
      *
      * @param doc
@@ -213,7 +237,7 @@
         int ix = elementName.indexOf(":");
         String prefix = "";
         if (ix != -1) {
-               prefix = elementName.substring(0, ix);
+            prefix = elementName.substring(0, ix);
         }
 
         String ns = AddressingUtils.getAddressingNamespaceURI();
@@ -253,18 +277,32 @@
         if (any != null && any.length > 0) {
             for (int i = 0; i < any.length; i++) {
                 try {
-                    parent.appendChild(doc.importNode(any[i].getAsDOM(), 
+                    parent.appendChild(doc.importNode(any[i].getAsDOM(),
                                                       true));
                 } catch (Exception e) {
                     log.debug("", e);
                 }
             }
         }
+
         // NOTE: ReferenceParameters were not part of the EPR type until WSA 
2004/08.
-        if 
(AddressingUtils.getAddressingNamespaceURI().equals(Constants.NS_URI_ADDRESSING_2004_08))
 {
-            ReferenceParametersType refParams = getParameters();
-            if (refParams  != null && refParams.size() > 0) {
-                refParams.append(parent, Constants.REFERENCE_PARAMETERS);
+        if (AddressingUtils.getAddressingNamespaceURI().equals(
+                Constants.NS_URI_ADDRESSING_2004_08)) {
+            List refParams = getParameters();
+            if (refParams != null && !refParams.isEmpty()) {
+                Element refProp = doc.createElementNS(
+                        AddressingUtils.getAddressingNamespaceURI(),
+                        Constants.REFERENCE_PARAMETERS);
+                for (int i = 0; i < any.length; i++) {
+                    MessageElement param = (MessageElement)refParams.get(i);
+                    try {
+                        refProp.appendChild(doc.importNode(param.getAsDOM(),
+                                                           true));
+                    } catch (Exception e) {
+                        log.warn(e);
+                    }
+                }
+                parent.appendChild(refProp);
             }
         }
         return parent;
@@ -273,7 +311,7 @@
     public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env,
                                                  String actorURI)
         throws Exception {
-        return toSOAPHeaderElement(env, actorURI, 
+        return toSOAPHeaderElement(env, actorURI,
                                    Constants.ENDPOINT_REFERENCE);
     }
 

Modified: 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReferenceType.java
URL: 
http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReferenceType.java?rev=368265&r1=368264&r2=368265&view=diff
==============================================================================
--- 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReferenceType.java
 (original)
+++ 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReferenceType.java
 Wed Jan 11 20:52:02 2006
@@ -25,6 +25,8 @@
 
 import javax.xml.namespace.QName;
 import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
 
 /**
  * Java content class for EndpointReferenceType complex type.
@@ -73,7 +75,7 @@
     /**
      * Field parameters
      */
-    private ReferenceParametersType m_parameters = new 
ReferenceParametersType();
+    protected List m_parameters;
 
     /*
      * Field extensibility elements
@@ -89,7 +91,7 @@
     /**
      * Constructor EndpointReferenceType
      * 
-     * @param address 
+     * @param address
      */
     public EndpointReferenceType(URI address) {
         this.m_address = new AttributedURI(address);
@@ -98,7 +100,7 @@
     /**
      * Constructor EndpointReferenceType
      * 
-     * @param address 
+     * @param address
      */
     public EndpointReferenceType(Address address) {
         this.m_address = address;
@@ -107,7 +109,7 @@
     /**
      * Constructor EndpointReferenceType (performs shallow copy)
      * 
-     * @param endpoint 
+     * @param endpoint
      */
     public EndpointReferenceType(EndpointReferenceType endpoint) {
         this(endpoint, false);
@@ -116,7 +118,7 @@
     /**
      * Constructor EndpointReferenceType
      * 
-     * @param endpoint 
+     * @param endpoint
      * @param deepCopy
      */
     public EndpointReferenceType(EndpointReferenceType endpoint,
@@ -127,7 +129,7 @@
             shallowCopy(endpoint);
         }
     }
-    
+
     private void shallowCopy(EndpointReferenceType endpoint) {
         setAddress(endpoint.getAddress());
         setPortType(endpoint.getPortType());
@@ -136,9 +138,9 @@
         if (properties != null) {
             setProperties(new ReferencePropertiesType(properties, false));
         }
-        ReferenceParametersType parameters = endpoint.getParameters();
+        List parameters = endpoint.getParameters();
         if (parameters != null) {
-            setParameters(new ReferenceParametersType(parameters, false));
+            setParameters(parameters);
         }
         // handle extensibility
         MessageElement [] any = endpoint.get_any();
@@ -166,12 +168,12 @@
         if (properties != null) {
             setProperties(new ReferencePropertiesType(properties, true));
         }
-        ReferenceParametersType parameters = endpoint.getParameters();
+        List parameters = endpoint.getParameters();
         if (parameters != null) {
-            setParameters(new ReferenceParametersType(parameters, true));
+            setParameters(parameters);
         }
         // handle extensibility
-        MessageElement elem = null;
+        MessageElement elem;
         MessageElement [] any = endpoint.get_any();
         if (any != null) {
             MessageElement [] newAny = new MessageElement[any.length];
@@ -187,11 +189,10 @@
             set_any(newAny);
         }
     }
-    
+
     /**
      * Method getAddress
      * 
-     * @return 
      */
     public AttributedURI getAddress() {
         return m_address;
@@ -200,7 +201,7 @@
     /**
      * Method setAddress
      * 
-     * @param address 
+     * @param address
      */
     public void setAddress(AttributedURI address) {
         this.m_address = address;
@@ -209,7 +210,6 @@
     /**
      * Method getPortType
      * 
-     * @return 
      */
     public AttributedQName getPortType() {
         return m_portType;
@@ -218,7 +218,7 @@
     /**
      * Method setPortType
      * 
-     * @param portType 
+     * @param portType
      */
     public void setPortType(AttributedQName portType) {
         this.m_portType = portType;
@@ -227,7 +227,6 @@
     /**
      * Method getProperties
      * 
-     * @return 
      */
     public ReferencePropertiesType getProperties() {
         return m_properties;
@@ -236,7 +235,7 @@
     /**
      * Method setProperties
      * 
-     * @param properties 
+     * @param properties
      */
     public void setProperties(ReferencePropertiesType properties) {
         this.m_properties = properties;
@@ -244,26 +243,23 @@
 
     /**
      * Method getParameters
-     * 
-     * @return 
      */
-    public ReferenceParametersType getParameters() {
+    public List getParameters() {
         return m_parameters;
     }
 
     /**
      * Method setParameters
      * 
-     * @param parameters 
+     * @param parameters
      */
-    public void setParameters(ReferenceParametersType parameters) {
+    public void setParameters(List parameters) {
         this.m_parameters = parameters;
     }
 
     /**
      * Method getServiceName
      * 
-     * @return 
      */
     public ServiceNameType getServiceName() {
         return m_serviceName;
@@ -272,7 +268,7 @@
     /**
      * Method setServiceName
      * 
-     * @param serviceName 
+     * @param serviceName
      */
     public void setServiceName(ServiceNameType serviceName) {
         this.m_serviceName = serviceName;
@@ -280,12 +276,11 @@
 
     /**
      * Method get_any
-     * @return
      */
     public MessageElement[] get_any() {
         return m_any;
     }
-    
+
     /**
      * Method set_any
      * @param _any
@@ -293,22 +288,22 @@
     public void set_any(MessageElement[] _any) {
         this.m_any = _any;
     }
-    
+
     public String toString() {
         StringBuffer buf = new StringBuffer();
         if (this.m_address != null) {
-            buf.append("Address: " + this.m_address);
+            buf.append("Address: ").append(this.m_address);
             buf.append("\n");
         }
         if (this.m_portType != null) {
-            buf.append("Port Type: " + this.m_portType);
+            buf.append("Port Type: ").append(this.m_portType);
             buf.append("\n");
         }
         if (this.m_serviceName != null) {
-            buf.append("Service Name: " + this.m_serviceName);
+            buf.append("Service Name: ").append(this.m_serviceName);
             buf.append("\n");
             if (this.m_serviceName.getPort() != null) {
-                buf.append("Port Name: " + this.m_serviceName.getPort());
+                buf.append("Port Name: ").append(this.m_serviceName.getPort());
                 buf.append("\n");
             }
         }
@@ -317,11 +312,11 @@
         }
         if (this.m_any != null) {
             for (int i=0;i<this.m_any.length;i++) {
-                buf.append("Extensibility Element[" + i + "]:\n");
+                buf.append("Extensibility Element[").append(i).append("]:\n");
                 try {
                     
buf.append(XMLUtils.ElementToString(this.m_any[i].getAsDOM()));
                 } catch (Exception e) {
-                    buf.append("<error converting: " + e.getMessage() + ">");
+                    buf.append("<error converting: 
").append(e.getMessage()).append(">");
                 }
                 buf.append("\n");
             }
@@ -330,7 +325,7 @@
     }
 
     // Axis bits to serialize/deserialize the fields correctly
-    
+
     // Type metadata
     private static org.apache.axis.description.TypeDesc typeDesc =
         new org.apache.axis.description.TypeDesc(EndpointReferenceType.class, 
true);
@@ -380,10 +375,10 @@
      * Get Custom Serializer
      */
     public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
+           java.lang.String mechType,
+           java.lang.Class _javaType,
            javax.xml.namespace.QName _xmlType) {
-        return 
+        return
           new  org.apache.axis.encoding.ser.BeanSerializer(
             _javaType, _xmlType, typeDesc);
     }
@@ -392,10 +387,10 @@
      * Get Custom Deserializer
      */
     public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType, 
-           java.lang.Class _javaType,  
+           java.lang.String mechType,
+           java.lang.Class _javaType,
            javax.xml.namespace.QName _xmlType) {
-        return 
+        return
           new  org.apache.axis.encoding.ser.BeanDeserializer(
             _javaType, _xmlType, typeDesc);
     }

Modified: 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/util/AddressingUtils.java
URL: 
http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/util/AddressingUtils.java?rev=368265&r1=368264&r2=368265&view=diff
==============================================================================
--- 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/util/AddressingUtils.java
 (original)
+++ 
webservices/addressing/trunk/src/org/apache/axis/message/addressing/util/AddressingUtils.java
 Wed Jan 11 20:52:02 2006
@@ -52,10 +52,13 @@
      * WSA that we support.
      */
     private static final Set ADDRESSING_NS_URI_SET = new HashSet();
+    private static final Set W3C_ADDRESSING_NS_URI_SET = new HashSet();
     static {
         ADDRESSING_NS_URI_SET.add( Constants.NS_URI_ADDRESSING_2003_03 );
         ADDRESSING_NS_URI_SET.add( Constants.NS_URI_ADDRESSING_2004_03 );
         ADDRESSING_NS_URI_SET.add( Constants.NS_URI_ADDRESSING_2004_08 );
+
+        W3C_ADDRESSING_NS_URI_SET.add( Constants.NS_URI_ADDRESSING_2005_08 );
     }
     
     /**
@@ -95,6 +98,17 @@
     }
 
     /**
+     * Returns true if the specified URI is corresponds to the namespace URI
+     * of a supported version of the WSA specification using the W3C specs,
+     * or false otherwise.
+     *
+     * @param uri a URI
+     */
+    public static boolean isW3CAddressingNamespaceURI( String uri ) {
+        return W3C_ADDRESSING_NS_URI_SET.contains( uri );
+    }
+
+    /**
      * Removes all instances of all WSA headers for a given actor.
      */
     public static void removeHeaders(SOAPHeader soapHeader, 
@@ -181,8 +195,8 @@
             throw new IllegalArgumentException("Null parameters are not 
allowed.");
         }
         Iterator iter = element.getVisibleNamespacePrefixes();
-        String prefix = null;
-        String ns = null;
+        String prefix;
+        String ns;
         while(iter.hasNext()) {
             prefix = (String)iter.next();
             ns = element.getNamespaceURI(prefix);
@@ -216,7 +230,7 @@
         }
         if ( nsURI == null  )
         {
-            nsURI = (String) System.getProperty( 
Constants.ENV_ADDRESSING_NAMESPACE_URI );
+            nsURI = System.getProperty( Constants.ENV_ADDRESSING_NAMESPACE_URI 
);
         }
         if ( nsURI == null  )
         {

Modified: webservices/addressing/trunk/test/addressing/TestEPR.java
URL: 
http://svn.apache.org/viewcvs/webservices/addressing/trunk/test/addressing/TestEPR.java?rev=368265&r1=368264&r2=368265&view=diff
==============================================================================
--- webservices/addressing/trunk/test/addressing/TestEPR.java (original)
+++ webservices/addressing/trunk/test/addressing/TestEPR.java Wed Jan 11 
20:52:02 2006
@@ -97,6 +97,13 @@
         
         EndpointReference epr2 = new 
EndpointReference(epr1.toDOM(XMLUtils.newDocument()));
         checkBasicEPR(epr2);
+
+        Element element = epr1.toDOM(XMLUtils.newDocument(), "element");
+//        DOMSource ds = new DOMSource(element);
+//        Transformer trans = 
TransformerFactory.newInstance().newTransformer();
+//        trans.transform(ds, new StreamResult(System.out));
+        epr2 = new EndpointReference(element);
+        checkBasicEPR(epr2);
     }
 
     private EndpointReferenceType getEPR() throws Exception {
@@ -140,8 +147,7 @@
         DocumentBuilder builder = dbf.newDocumentBuilder();
         ByteArrayInputStream bais = new 
ByteArrayInputStream(xmlString.getBytes());
         Document d = builder.parse(bais);
-        Element xmlRoot = d.getDocumentElement();
-        return xmlRoot;
+        return d.getDocumentElement();
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to