You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by di...@apache.org on 2004/03/08 23:04:10 UTC

cvs commit: ws-fx/addressing/test/addressing TestSerDeser.java

dims        2004/03/08 14:04:10

  Modified:    addressing/src/org/apache/axis/message/addressing
                        Action.java AddressingHeaders.java
                        AttributedQName.java AttributedURI.java
                        EndpointReference.java FaultTo.java From.java
                        MessageID.java PortType.java Recipient.java
                        RelatesTo.java Relationship.java ReplyTo.java
                        ServiceNameType.java To.java
               addressing/src/org/apache/axis/message/addressing/util
                        TextExtractor.java
               addressing/test/addressing TestSerDeser.java
  Log:
  Patches from "Jarek Gawor" <ga...@mcs.anl.gov>
  
  1) Modified the code so that it exposes and uses standard JAX-RPC
  SOAPElement API whenever it can.
  2) Fixed To.java to extend from AttributedURI instead of EndpointReference
  3) Added support for actors
  4) Modified the code to accept and return SOAPHeaderElements so that it is
  easier to control actors and mustUnderstand attributes and also so that
  parsing/generating of the elements is done by the end classes.
  5) Fixed some serialization/deserialization bugs with PortType,
  ServiceNameType, RelatesTo (things that dealt with QName).
  6) Also, added better tests.
  
  Revision  Changes    Path
  1.4       +22 -0     ws-fx/addressing/src/org/apache/axis/message/addressing/Action.java
  
  Index: Action.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/Action.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Action.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ Action.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -19,6 +19,11 @@
   
   import org.apache.axis.types.URI;
   
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPHeaderElement;
  +
  +import org.w3c.dom.Element;
  +
   /**
    * Java content class for Action element declaration.
    * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2003/03/addressing/ line 79)
  @@ -39,6 +44,23 @@
       public Action(URI uri) {
           super(uri);
       }
  +
  +    /**
  +     * Constructor Action
  +     * 
  +     * @param el 
  +     * @throws Exception 
  +     */
  +    public Action(SOAPHeaderElement el) 
  +        throws Exception {
  +        super(el);
  +    }
  +
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.ACTION);
  +    }
  +    
   }
   
   
  
  
  
  1.4       +107 -97   ws-fx/addressing/src/org/apache/axis/message/addressing/AddressingHeaders.java
  
  Index: AddressingHeaders.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/AddressingHeaders.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AddressingHeaders.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ AddressingHeaders.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -17,8 +17,11 @@
   
   package org.apache.axis.message.addressing;
   
  -import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeaderElement;
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.SOAPHeader;
  +import javax.xml.soap.Name;
  +
   import org.apache.axis.message.addressing.util.TextExtractor;
   import org.apache.axis.types.URI;
   import org.w3c.dom.Document;
  @@ -28,9 +31,13 @@
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
   import javax.xml.soap.SOAPException;
  +
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.List;
  +import java.util.Iterator;
  +
  +import javax.xml.namespace.QName;
   
   /**
    * Class AddressingHeaders
  @@ -91,7 +98,7 @@
        * @throws Exception 
        */
       public AddressingHeaders(SOAPEnvelope env) throws Exception {
  -        this(env, true, true);
  +        this(env, null, true, true);
       }
   
       /**
  @@ -102,74 +109,77 @@
        * @param remove  
        * @throws Exception 
        */
  -    public AddressingHeaders(SOAPEnvelope env, boolean process, boolean remove)
  +    public AddressingHeaders(SOAPEnvelope env, 
  +                             boolean process, 
  +                             boolean remove)
               throws Exception {
  -
  -        URI uri = extract(env, Constants.MESSAGE_ID, process, remove);
  -        if (uri != null) {
  -            messageID = new MessageID(uri);
  -        }
  -        uri = extract(env, Constants.TO, process, remove);
  -        if (uri != null) {
  -            to = new To(uri);
  -        }
  -        uri = extract(env, Constants.ACTION, process, remove);
  -        if (uri != null) {
  -            action = new Action(uri);
  -        }
  -        uri = extract(env, Constants.FROM, process, remove);
  -        if (uri != null) {
  -            from = new From(uri);
  -        }
  -        uri = extract(env, Constants.REPLY_TO, process, remove);
  -        if (uri != null) {
  -            replyTo = new ReplyTo(uri);
  -        }
  -        uri = extract(env, Constants.FAULT_TO, process, remove);
  -        if (uri != null) {
  -            faultTo = new FaultTo(uri);
  -        }
  -        uri = extract(env, Constants.RECIPIENT, process, remove);
  -        if (uri != null) {
  -            recipient = new Recipient(uri);
  +        this(env, null, process, remove);
           }
   
  -        Enumeration enum = env.getHeadersByName(Constants.NS_URI_ADDRESSING,
  -                Constants.RELATES_TO);
  -        if (enum.hasMoreElements()) {
  -            while (enum.hasMoreElements()) {
  -                SOAPHeaderElement header = (SOAPHeaderElement) enum.nextElement();
  +    /**
  +     * Constructor AddressingHeaders
  +     * 
  +     * @param env     
  +     * @param actionURI
  +     * @param process 
  +     * @param remove  
  +     * @throws Exception 
  +     */
  +    public AddressingHeaders(SOAPEnvelope env, 
  +                             String actorURI,
  +                             boolean process, 
  +                             boolean remove)
  +        throws Exception {
  +
  +        SOAPHeader header = env.getHeader();
  +        if (header == null) {
  +            return;
  +        }
  +        
  +        Iterator iter = header.examineHeaderElements(actorURI);
  +        
  +        while(iter.hasNext()) {
  +            SOAPHeaderElement headerElement = 
  +                (SOAPHeaderElement)iter.next();
  +            
  +            Name name = headerElement.getElementName();
   
  -                String type = header.getAttributeValue(Constants.RELATIONSHIP_TYPE);
  -                String uri2 = header.getValue();
  +            if (!name.getURI().equals(Constants.NS_URI_ADDRESSING)) {
  +                continue;
  +            }
   
  -                relatesTo.add(new RelatesTo(uri2, type));
  +            String localName = name.getLocalName();
   
  -                if (process) {
  -                    header.setProcessed(true);
  +            if (localName.equals(Constants.MESSAGE_ID)) {
  +                messageID = new MessageID(headerElement);
  +            } else if (localName.equals(Constants.TO)) {
  +                to = new To(headerElement);
  +            } else if (localName.equals(Constants.ACTION)) {
  +                action = new Action(headerElement);
  +            } else if (localName.equals(Constants.FROM)) {
  +                from = new From(headerElement);
  +            } else if (localName.equals(Constants.REPLY_TO)) {
  +                replyTo = new ReplyTo(headerElement);
  +            } else if (localName.equals(Constants.FAULT_TO)) {
  +                faultTo = new FaultTo(headerElement);
  +            } else if (localName.equals(Constants.RECIPIENT)) {
  +                recipient = new Recipient(headerElement);
  +            } else if (localName.equals(Constants.RELATES_TO)) {
  +                relatesTo.add(new RelatesTo(headerElement));
  +            } else {
  +                continue;
                   }
   
  +            // must have found one
                   if (remove) {
  -                    env.removeHeader(header);
  -                }
  -            }
  +                headerElement.detachNode();
           }
  -    }
  +            // axis specific call
  +            if (process && headerElement instanceof org.apache.axis.message.SOAPHeaderElement) {
  +                ((org.apache.axis.message.SOAPHeaderElement)headerElement).setProcessed(true);
   
  -    public URI extract(SOAPEnvelope env, String name, boolean process, boolean remove) throws Exception {
  -        URI uri = null;
  -        SOAPHeaderElement header = env.getHeaderByName(Constants.NS_URI_ADDRESSING, name);
  -
  -        if (header != null) {
  -            uri = new URI(TextExtractor.getText(header.getAsDOM()));
  -            if (process) {
  -                header.setProcessed(true);
  -            }
  -            if (remove) {
  -                env.removeHeader(header);
               }
           }
  -        return uri;
       }
   
       /**
  @@ -225,76 +235,76 @@
        * @throws ParserConfigurationException 
        */
       public void toEnvelope(SOAPEnvelope env)
  -            throws SOAPException, ParserConfigurationException {
  +        throws Exception {
  +        toEnvelope(env, null);
  +    }
   
  -        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  -        dbf.setNamespaceAware(true);
  -        dbf.setValidating(false);
  -        DocumentBuilder db = dbf.newDocumentBuilder();
  -        Document doc = db.newDocument();
  +
  +    /**
  +     * Method toEnvelope
  +     * 
  +     * @param env 
  +     * @throws SOAPException                
  +     * @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, Constants.NS_URI_ADDRESSING);
  +            env.addNamespaceDeclaration(Constants.NS_PREFIX_ADDRESSING, 
  +                                        Constants.NS_URI_ADDRESSING);
           }
   
  +        SOAPHeaderElement header = null;
  +        
           if (messageID != null) {
  -            SOAPHeaderElement header = new SOAPHeaderElement(Constants.NS_URI_ADDRESSING,
  -                    Constants.MESSAGE_ID);
  -            header.addTextNode(messageID.toString());
  +            header = messageID.toSOAPHeaderElement(env);
  +            header.setActor(actorURI);
               header.setMustUnderstand(true);
  -            env.addHeader(header);
           }
   
           if (to != null) {
  -            SOAPHeaderElement header = new SOAPHeaderElement(Constants.NS_URI_ADDRESSING, Constants.TO);
  -            header.addTextNode(to.getAddress().toString());
  +            header = to.toSOAPHeaderElement(env);
  +            header.setActor(actorURI);
               header.setMustUnderstand(true);
  -            env.addHeader(header);
  -
  -            ReferencePropertiesType properties = to.getProperties();
  -            if (properties != null && properties.size() > 0) {
  -                for (int i = 0; i < properties.size(); i++) {
  -                    Element elem = (Element) properties.get(i);
  -                    env.addHeader(new SOAPHeaderElement(elem));
  -                }
  -            }
           }
   
           if (action != null) {
  -            SOAPHeaderElement header = new SOAPHeaderElement(Constants.NS_URI_ADDRESSING,
  -                    Constants.ACTION);
  -            header.addTextNode(action.toString());
  +            header = action.toSOAPHeaderElement(env);
  +            header.setActor(actorURI);
               header.setMustUnderstand(true);
  -            env.addHeader(header);
           }
   
           if (from != null) {
  -            from.toEnvelope(env, doc);
  +            header = from.toSOAPHeaderElement(env);
  +            header.setActor(actorURI);
  +            header.setMustUnderstand(true);
           }
   
           if (replyTo != null) {
  -            replyTo.toEnvelope(env, doc);
  +            header = replyTo.toSOAPHeaderElement(env);
  +            header.setActor(actorURI);
  +            header.setMustUnderstand(true);
           }
   
           if (faultTo != null) {
  -            faultTo.toEnvelope(env, doc);
  +            header = faultTo.toSOAPHeaderElement(env);
  +            header.setActor(actorURI);
  +            header.setMustUnderstand(true);       
           }
   
           if (recipient != null) {
  -            recipient.toEnvelope(env, doc);
  +            header = recipient.toSOAPHeaderElement(env);
  +            header.setActor(actorURI);
  +            header.setMustUnderstand(true);    
           }
   
           if (relatesTo != null) {
               for (int i = 0; i < relatesTo.size(); i++) {
                   RelatesTo rtp = (RelatesTo) relatesTo.get(i);
  -                SOAPHeaderElement header = new SOAPHeaderElement(Constants.NS_URI_ADDRESSING,
  -                        Constants.RELATES_TO);
  -                header.setAttribute(Constants.NS_URI_ADDRESSING,
  -                        Constants.RELATIONSHIP_TYPE,
  -                        rtp.getType().toString());
  -                header.addTextNode(rtp.getURI().toString());
  +                header = rtp.toSOAPHeaderElement(env);
  +                header.setActor(actorURI);
                   header.setMustUnderstand(true);
  -                env.addHeader(header);
               }
           }
       }
  @@ -345,8 +355,8 @@
        * 
        * @param ref 
        */
  -    public void setTo(EndpointReference ref) {
  -        to = new To(ref);
  +    public void setTo(AttributedURI uri) {
  +        to = new To(uri);
       }
   
       /**
  
  
  
  1.4       +4 -1      ws-fx/addressing/src/org/apache/axis/message/addressing/AttributedQName.java
  
  Index: AttributedQName.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/AttributedQName.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AttributedQName.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ AttributedQName.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -42,8 +42,11 @@
        * @param qname 
        */
       public AttributedQName(QName qname) {
  -        super(qname.getNamespaceURI(), qname.getLocalPart(), qname.getPrefix());
  +        super(qname.getNamespaceURI(), 
  +              qname.getLocalPart(), 
  +              qname.getPrefix());
       }
  +            
   }
   
   
  
  
  
  1.4       +34 -0     ws-fx/addressing/src/org/apache/axis/message/addressing/AttributedURI.java
  
  Index: AttributedURI.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/AttributedURI.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AttributedURI.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ AttributedURI.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -17,8 +17,18 @@
   
   package org.apache.axis.message.addressing;
   
  +import org.apache.axis.message.addressing.util.TextExtractor;
  +
   import org.apache.axis.types.URI;
   
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPHeader;
  +import javax.xml.soap.SOAPElement;
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.Name;
  +
  +import org.w3c.dom.Element;
  +
   /**
    * Java content class for AttributedURI complex type.
    * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2003/03/addressing/ line 105)
  @@ -50,6 +60,30 @@
        */
       public AttributedURI() {
       }
  +
  +    /**
  +     * Constructor AttributedURI
  +     * 
  +     * @param el 
  +     * @throws Exception 
  +     */
  +    public AttributedURI(SOAPHeaderElement el) 
  +        throws Exception {
  +        super(new URI(TextExtractor.getText(el)));
  +    }
  +
  +    protected SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env,
  +                                                    String name) 
  +        throws Exception {
  +        Name nm = env.createName(name, 
  +                                 Constants.NS_PREFIX_ADDRESSING,
  +                                 Constants.NS_URI_ADDRESSING);
  +        SOAPHeader header = env.getHeader();
  +        SOAPHeaderElement headerElement = header.addHeaderElement(nm);
  +        headerElement.addTextNode(toString());
  +        return headerElement;
  +    }
  +    
   }
   
   
  
  
  
  1.4       +73 -24    ws-fx/addressing/src/org/apache/axis/message/addressing/EndpointReference.java
  
  Index: EndpointReference.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/EndpointReference.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EndpointReference.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ EndpointReference.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -17,15 +17,25 @@
   
   package org.apache.axis.message.addressing;
   
  -import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeaderElement;
  -import org.apache.axis.message.addressing.util.TextExtractor;
   import org.apache.axis.types.URI;
  +import org.apache.axis.utils.XMLUtils;
  +
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPElement;
  +import javax.xml.soap.SOAPHeaderElement;
  +
  +import org.apache.axis.message.addressing.util.TextExtractor;
  +
  +import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.DocumentBuilderFactory;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   
  +import javax.xml.namespace.QName;
  +
   /**
    * Java content class for EndpointReference element declaration.
    * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2003/03/addressing/ line 45)
  @@ -80,33 +90,57 @@
        * Constructor EndpointReference
        * 
        * @param el 
  -     * @throws URI.MalformedURIException 
  +     * @throws Exception 
  +     */
  +    public EndpointReference(SOAPElement el)
  +        throws Exception {
  +        this(TextExtractor.toDOM(el));
  +    }
  +
  +    /**
  +     * Constructor EndpointReference
  +     * 
  +     * @param el 
  +     * @throws Exception 
        */
       public EndpointReference(final Element el)
  -            throws URI.MalformedURIException {
  +        throws Exception {
   
           NodeList list = el.getElementsByTagNameNS(Constants.NS_URI_ADDRESSING,
                   Constants.ADDRESS);
   
           if (list.getLength() > 0) {
  -            setAddress(new Address(TextExtractor.getText((Element) list.item(0))));
  +            // TODO: should move it to Address class
  +            Element node = (Element) list.item(0);
  +            setAddress(new Address(TextExtractor.getText(node)));
           }
   
  -        list = el.getElementsByTagNameNS(Constants.NS_URI_ADDRESSING, Constants.PORT_TYPE);
  +        list = el.getElementsByTagNameNS(Constants.NS_URI_ADDRESSING, 
  +                                         Constants.PORT_TYPE);
   
           if (list.getLength() > 0) {
  -            setPortType(new PortType(TextExtractor.getText((Element) list.item(0))));
  +            // TODO: should move it to PortType class
  +            Element node = (Element) list.item(0);
  +            String value = TextExtractor.getText(node);
  +            QName qname = XMLUtils.getQNameFromString(value, node);
  +            if (qname != null) {
  +                setPortType(new PortType(qname));
  +            }
           }
   
           list = el.getElementsByTagNameNS(Constants.NS_URI_ADDRESSING,
                   Constants.SERVICE_NAME);
   
           if (list.getLength() > 0) {
  +            // TODO: should move it to ServiceNameType class
               Element child = (Element) list.item(0);
  +            String value = TextExtractor.getText(child);
  +            QName qname = XMLUtils.getQNameFromString(value, child);
               String portName =
  -                    child.getAttributeNS(Constants.NS_URI_ADDRESSING, Constants.PORT_NAME);
  -            ServiceNameType serviceName = new ServiceNameType(TextExtractor.getText(child),
  -                    portName);
  +                    child.getAttributeNS(Constants.NS_URI_ADDRESSING, 
  +                                         Constants.PORT_NAME);
  +            ServiceNameType serviceName = 
  +                new ServiceNameType(qname, portName);
               setServiceName(serviceName);
           }
   
  @@ -141,8 +175,9 @@
        * @param doc  
        * @param name 
        */
  -    public Element toDOM(Document doc, String name) {
  -        Element parent = doc.createElementNS(Constants.NS_URI_ADDRESSING, name);
  +    protected Element toDOM(Document doc, String name) {
  +        Element parent = doc.createElementNS(Constants.NS_URI_ADDRESSING, 
  +                                             name);
           if (doc.getDocumentElement() == null) {
               doc.appendChild(parent);
           } else {
  @@ -165,18 +200,32 @@
           return parent;
       }
   
  -    /**
  -     * Method toEnvelope
  -     * 
  -     * @param env 
  -     * @param doc 
  -     */
  -    public void toEnvelope(SOAPEnvelope env, Document doc) {
  -        SOAPHeaderElement header =
  -                new SOAPHeaderElement(toDOM(doc));
  -        header.setMustUnderstand(true);
  -        env.addHeader(header);
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.ENDPOINT_REFERENCE);
  +    }
  +
  +    protected SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env,  
  +                                                    String name)
  +        throws Exception {
  +        
  +        if (!(env instanceof org.apache.axis.message.SOAPEnvelope)) {
  +            throw new Exception("Not supported");
  +        }
  +        
  +        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  +        dbf.setNamespaceAware(true);
  +        dbf.setValidating(false);
  +        DocumentBuilder db = dbf.newDocumentBuilder();
  +        Document doc = db.newDocument();
  +        
  +        org.apache.axis.message.SOAPHeaderElement header =
  +            new org.apache.axis.message.SOAPHeaderElement(toDOM(doc, name));
  +        ((org.apache.axis.message.SOAPEnvelope)env).addHeader(header);
  +
  +        return header;
       }
  +    
   }
   
   
  
  
  
  1.4       +20 -0     ws-fx/addressing/src/org/apache/axis/message/addressing/FaultTo.java
  
  Index: FaultTo.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/FaultTo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FaultTo.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ FaultTo.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -18,6 +18,10 @@
   package org.apache.axis.message.addressing;
   
   import org.apache.axis.types.URI;
  +
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.SOAPEnvelope;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -57,6 +61,22 @@
        */
       public FaultTo(EndpointReferenceType endpoint) {
           super(endpoint);
  +    }
  +
  +    /**
  +     * Constructor FaultTo
  +     * 
  +     * @param element
  +     * @throws Exception 
  +     */
  +    public FaultTo(SOAPHeaderElement element)
  +        throws Exception {
  +        super(element);
  +    }
  +
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.FAULT_TO);
       }
   
       /**
  
  
  
  1.4       +20 -0     ws-fx/addressing/src/org/apache/axis/message/addressing/From.java
  
  Index: From.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/From.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- From.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ From.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -18,6 +18,10 @@
   package org.apache.axis.message.addressing;
   
   import org.apache.axis.types.URI;
  +
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.SOAPEnvelope;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -57,6 +61,22 @@
        */
       public From(EndpointReferenceType endpoint) {
           super(endpoint);
  +    }
  +
  +    /**
  +     * Constructor From
  +     * 
  +     * @param element
  +     * @throws Exception 
  +     */
  +    public From(SOAPHeaderElement element)
  +        throws Exception {
  +        super(element);
  +    }
  +
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.FROM);
       }
   
       /**
  
  
  
  1.4       +23 -0     ws-fx/addressing/src/org/apache/axis/message/addressing/MessageID.java
  
  Index: MessageID.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/MessageID.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MessageID.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ MessageID.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -19,6 +19,11 @@
   
   import org.apache.axis.types.URI;
   
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPHeaderElement;
  +
  +import org.w3c.dom.Element;
  +
   /**
    * Java content class for MessageID element declaration.
    * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2003/03/addressing/ line 76)
  @@ -44,6 +49,24 @@
        */
       public MessageID() {
       }
  +
  +    /**
  +     * Constructor MessageID
  +     * 
  +     * @param el 
  +     * @throws Exception 
  +     */
  +    public MessageID(SOAPHeaderElement el) 
  +        throws Exception {
  +        super(el);
  +    }
  +
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.MESSAGE_ID);
  +    }
  +
   }
  +
   
   
  
  
  
  1.3       +8 -3      ws-fx/addressing/src/org/apache/axis/message/addressing/PortType.java
  
  Index: PortType.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/PortType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortType.java	10 Feb 2004 19:18:35 -0000	1.2
  +++ PortType.java	8 Mar 2004 22:04:10 -0000	1.3
  @@ -17,6 +17,8 @@
   
   package org.apache.axis.message.addressing;
   
  +import org.apache.axis.utils.XMLUtils;
  +
   import org.w3c.dom.Element;
   
   import javax.xml.namespace.QName;
  @@ -51,9 +53,12 @@
        * @param parent 
        */
       public void append(Element parent) {
  -        Element pt = parent.getOwnerDocument().createElementNS(Constants.NS_URI_ADDRESSING,
  -                Constants.PORT_TYPE);
  -        pt.appendChild(parent.getOwnerDocument().createTextNode(toString()));
  +        Element pt = parent.getOwnerDocument().createElementNS(
  +                         Constants.NS_URI_ADDRESSING,
  +                         Constants.PORT_TYPE
  +                     );
  +        String value = XMLUtils.getStringForQName(this, pt);
  +        pt.appendChild(parent.getOwnerDocument().createTextNode(value));
           parent.appendChild(pt);
       }
   }
  
  
  
  1.4       +20 -0     ws-fx/addressing/src/org/apache/axis/message/addressing/Recipient.java
  
  Index: Recipient.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/Recipient.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Recipient.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ Recipient.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -18,6 +18,10 @@
   package org.apache.axis.message.addressing;
   
   import org.apache.axis.types.URI;
  +
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.SOAPEnvelope;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -48,6 +52,22 @@
        */
       public Recipient(URI uri) {
           super(uri);
  +    }
  +
  +    /**
  +     * Constructor Recipient
  +     * 
  +     * @param element
  +     * @throws Exception 
  +     */
  +    public Recipient(SOAPHeaderElement element)
  +        throws Exception {
  +        super(element);
  +    }
  +    
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.RECIPIENT);
       }
   
       /**
  
  
  
  1.4       +69 -11    ws-fx/addressing/src/org/apache/axis/message/addressing/RelatesTo.java
  
  Index: RelatesTo.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/RelatesTo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RelatesTo.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ RelatesTo.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -17,7 +17,18 @@
   
   package org.apache.axis.message.addressing;
   
  +import org.apache.axis.message.addressing.util.TextExtractor;
  +
   import org.apache.axis.types.URI;
  +import org.apache.axis.utils.XMLUtils;
  +
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPHeader;
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.SOAPElement;
  +import javax.xml.soap.Name;
  +
  +import org.w3c.dom.Element;
   
   import javax.xml.namespace.QName;
   
  @@ -32,15 +43,6 @@
    * @author Davanum Srinivas (dims@yahoo.com)
    */
   public class RelatesTo extends Relationship {
  -    /**
  -     * Field type
  -     */
  -    private URI uri;
  -
  -    /**
  -     * Field type
  -     */
  -    private QName type;
   
       /**
        * Constructor RelatesTo
  @@ -49,7 +51,8 @@
        * @param type 
        * @throws URI.MalformedURIException 
        */
  -    public RelatesTo(String uri, String type) throws URI.MalformedURIException {
  +    public RelatesTo(String uri, String type) 
  +        throws URI.MalformedURIException {
           super(uri, type);
       }
   
  @@ -62,6 +65,61 @@
       public RelatesTo(URI uri, QName type) {
           super(uri, type);
       }
  -}
   
  +    /**
  +     * Constructor RelatesTo
  +     * 
  +     * @param el 
  +     * @throws Exception
  +     */
  +    public RelatesTo(SOAPElement el) 
  +        throws Exception {
  +        super();
  +        setURI(new URI(TextExtractor.getText(el)));
  +        String value = el.getAttribute(Constants.RELATIONSHIP_TYPE);
  +        if (value != null && value.length() > 0) {
  +            int pos = value.indexOf(':');
  +            if (pos == -1) {
  +                setType(new QName(value));
  +            } else {
  +                String namespace = 
  +                    el.getNamespaceURI(value.substring(0, pos));
  +                setType(new QName(namespace, value.substring(pos+1)));
  +            }
  +        }
  +}
   
  +    protected SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        Name nm = env.createName(Constants.RELATES_TO,
  +                                 Constants.NS_PREFIX_ADDRESSING,
  +                                 Constants.NS_URI_ADDRESSING);
  +        SOAPHeader header = env.getHeader();
  +        SOAPHeaderElement headerElement = header.addHeaderElement(nm);
  +
  +        QName type = getType();
  +
  +        if (type != null) {
  +            nm = env.createName(Constants.RELATIONSHIP_TYPE,
  +                                null,
  +                                null);
  +            
  +            int i = 0;
  +            String prefix = "ns" + i;
  +            while (headerElement.getNamespaceURI(prefix) != null) {
  +                prefix = "ns" + i++;
  +            }
  +            
  +            headerElement.addNamespaceDeclaration(prefix, 
  +                                                  type.getNamespaceURI());
  +
  +            headerElement.addAttribute(nm, 
  +                                       prefix + ":" + type.getLocalPart());
  +        }
  +        
  +        headerElement.addTextNode(getURI().toString());
  +        
  +        return headerElement;
  +    }
  +    
  +}
  
  
  
  1.2       +9 -3      ws-fx/addressing/src/org/apache/axis/message/addressing/Relationship.java
  
  Index: Relationship.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/Relationship.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Relationship.java	11 Feb 2004 15:06:04 -0000	1.1
  +++ Relationship.java	8 Mar 2004 22:04:10 -0000	1.2
  @@ -55,8 +55,8 @@
        * @param type 
        * @throws URI.MalformedURIException 
        */
  -    public Relationship(String uri, String type) throws URI.MalformedURIException {
  -
  +    public Relationship(String uri, String type) 
  +        throws URI.MalformedURIException {
           this.uri = new URI(uri);
           this.type = (type == null)
                   ? Constants.QNAME_RESPONSE
  @@ -70,11 +70,17 @@
        * @param type 
        */
       public Relationship(URI uri, QName type) {
  -
           this.uri = uri;
           this.type = (type == null)
                   ? Constants.QNAME_RESPONSE
                   : type;
  +    }
  +
  +    /**
  +     * Constructor RelatesTo
  +     * 
  +     */
  +    public Relationship() {
       }
   
       /**
  
  
  
  1.4       +22 -1     ws-fx/addressing/src/org/apache/axis/message/addressing/ReplyTo.java
  
  Index: ReplyTo.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/ReplyTo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ReplyTo.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ ReplyTo.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -18,6 +18,10 @@
   package org.apache.axis.message.addressing;
   
   import org.apache.axis.types.URI;
  +
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.SOAPEnvelope;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -51,7 +55,7 @@
       }
   
       /**
  -     * Constructor FaultTo
  +     * Constructor ReplyTo
        * 
        * @param endpoint 
        */
  @@ -60,6 +64,22 @@
       }
   
       /**
  +     * Constructor ReplyTo
  +     * 
  +     * @param element
  +     * @throws Exception 
  +     */
  +    public ReplyTo(SOAPHeaderElement element)
  +        throws Exception {
  +        super(element);
  +    }
  +
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.REPLY_TO);
  +    }
  +
  +    /**
        * Method toDOM.
        * 
        * @param doc 
  @@ -67,6 +87,7 @@
       public Element toDOM(Document doc) {
           return toDOM(doc, Constants.REPLY_TO);
       }
  +    
   }
   
   
  
  
  
  1.2       +9 -8      ws-fx/addressing/src/org/apache/axis/message/addressing/ServiceNameType.java
  
  Index: ServiceNameType.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/ServiceNameType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceNameType.java	11 Feb 2004 15:06:04 -0000	1.1
  +++ ServiceNameType.java	8 Mar 2004 22:04:10 -0000	1.2
  @@ -17,6 +17,8 @@
   
   package org.apache.axis.message.addressing;
   
  +import org.apache.axis.utils.XMLUtils;
  +
   import org.w3c.dom.Attr;
   import org.w3c.dom.Element;
   
  @@ -89,15 +91,14 @@
        * @param parent 
        */
       public void append(Element parent) {
  -        Element sn = parent.getOwnerDocument().createElementNS(Constants.NS_URI_ADDRESSING,
  -                Constants.SERVICE_NAME);
  -        sn.appendChild(parent.getOwnerDocument().createTextNode(toString()));
  +        Element sn = parent.getOwnerDocument().createElementNS(
  +                           Constants.NS_URI_ADDRESSING,
  +                           Constants.SERVICE_NAME
  +                     );
  +        String value = XMLUtils.getStringForQName(this, sn);
  +        sn.appendChild(parent.getOwnerDocument().createTextNode(value));
           if (getPort() != null) {
  -            Attr attr =
  -                    parent.getOwnerDocument().createAttributeNS(Constants.NS_URI_ADDRESSING,
  -                            Constants.PORT_NAME);
  -            attr.setValue(getPort());
  -            sn.appendChild(attr);
  +            sn.setAttribute(Constants.PORT_NAME, getPort());
           }
           parent.appendChild(sn);
       }
  
  
  
  1.4       +21 -17    ws-fx/addressing/src/org/apache/axis/message/addressing/To.java
  
  Index: To.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/To.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- To.java	11 Feb 2004 15:06:04 -0000	1.3
  +++ To.java	8 Mar 2004 22:04:10 -0000	1.4
  @@ -17,7 +17,10 @@
   package org.apache.axis.message.addressing;
   
   import org.apache.axis.types.URI;
  -import org.w3c.dom.Document;
  +
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPHeaderElement;
  +
   import org.w3c.dom.Element;
   
   /**
  @@ -30,15 +33,7 @@
    * 
    * @author Davanum Srinivas (dims@yahoo.com)
    */
  -public class To extends EndpointReference {
  -    /**
  -     * Constructor To
  -     * 
  -     * @param uri 
  -     */
  -    public To(AttributedURI uri) {
  -        super(uri);
  -    }
  +public class To extends AttributedURI {
   
       /**
        * Constructor To
  @@ -59,22 +54,31 @@
       }
   
       /**
  -     * Constructor To
  +     * Copy constructor to
        * 
        * @param endpoint 
        */
  -    public To(EndpointReferenceType endpoint) {
  -        super(endpoint);
  +    public To(To address) {
  +        super(address);
       }
   
       /**
  -     * Method toDOM.
  +     * Constructor To
        * 
  -     * @param doc 
  +     * @param el 
  +     * @throws Exception 
        */
  -    public Element toDOM(Document doc) {
  -        return toDOM(doc, Constants.TO);
  +    public To(SOAPHeaderElement el) 
  +        throws Exception {
  +        super(el);
  +    }
  +
  +    public SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env) 
  +        throws Exception {
  +        return toSOAPHeaderElement(env, Constants.TO);
       }
  +    
  +    
   }
   
   
  
  
  
  1.2       +26 -1     ws-fx/addressing/src/org/apache/axis/message/addressing/util/TextExtractor.java
  
  Index: TextExtractor.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/util/TextExtractor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextExtractor.java	10 Feb 2004 19:18:35 -0000	1.1
  +++ TextExtractor.java	8 Mar 2004 22:04:10 -0000	1.2
  @@ -17,8 +17,15 @@
   
   package org.apache.axis.message.addressing.util;
   
  +import org.apache.axis.message.MessageElement;
  +
  +import javax.xml.soap.SOAPElement;
  +
   import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +import org.w3c.dom.NodeList;
  +import org.w3c.dom.Text;
   import org.w3c.dom.traversal.DocumentTraversal;
   import org.w3c.dom.traversal.NodeFilter;
   import org.w3c.dom.traversal.NodeIterator;
  @@ -29,6 +36,7 @@
    * @author Davanum Srinivas (dims@yahoo.com)
    */
   public class TextExtractor {
  +
       public static String getText(Node node) {
           if (node == null) return "";
           // Set up the iterator
  @@ -45,6 +53,23 @@
           while ((current = iterator.nextNode()) != null) {
               result.append(current.getNodeValue());
           }
  -        return result.toString();
  +        return result.toString().trim();
  +    }
  +
  +    public static String getText(SOAPElement element) 
  +        throws Exception {
  +        Element node = toDOM(element);
  +        return getText(node);
  +    }
  +    
  +    // Not a best place for it
  +    // As a side effect of this conversion - namescapes
  +    // defined in the parent nodes are not copied
  +    public static Element toDOM(SOAPElement el)
  +        throws Exception {
  +        if (el instanceof MessageElement) {
  +            return ((MessageElement)el).getAsDOM();
  +        }
  +        throw new Exception("Unable to convert");
       }
   }
  
  
  
  1.2       +131 -2    ws-fx/addressing/test/addressing/TestSerDeser.java
  
  Index: TestSerDeser.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/test/addressing/TestSerDeser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSerDeser.java	10 Feb 2004 19:18:35 -0000	1.1
  +++ TestSerDeser.java	8 Mar 2004 22:04:10 -0000	1.2
  @@ -24,13 +24,16 @@
   
   import java.io.ByteArrayInputStream;
   
  +import javax.xml.namespace.QName;
  +
   /**
    * Class ReplyTo
    * 
    * @author Davanum Srinivas (dims@yahoo.com)
    */
   public class TestSerDeser extends TestCase {
  -    String xml = "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
  +    String xml = 
  +        "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
               "  xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2003/03/addressing\"\n" +
               "  xmlns:f123=\"http://www.fabrikam123.com/svc53\" \n" +
               ">\n" +
  @@ -55,13 +58,43 @@
               "  </S:Body>\n" +
               "</S:Envelope>";
   
  +    String xml2 = 
  +        "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
  +        "  xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2003/03/addressing\"\n" +
  +        "  xmlns:f123=\"http://www.fabrikam123.com/svc53\" \n" +
  +        ">\n" +
  +        "  <S:Header>\n" +
  +        "    <wsa:MessageID S:actor=\"A1\">uuid:aaaabbbb-cccc-dddd-eeee-ffffffffffff\n" +
  +        "    </wsa:MessageID>\n" +
  +        "    <wsa:RelatesTo S:actor=\"A1\" xmlns:ws=\"testNS\" RelationshipType=\"ws:testPart\">uuid:11112222-3333-4444-5555-666666666666\n" +
  +        "    </wsa:RelatesTo>\n" +
  +        "    <wsa:ReplyTo S:actor=\"A1\">\n" +
  +        "      <wsa:Address>http://business456.com/client1</wsa:Address>\n" +
  +        "      <wsa:PortType xmlns:ns1=\"Foo\">ns1:Test</wsa:PortType>\n" +
  +        "      <wsa:ServiceName xmlns:ns1=\"Bar\">ns1:Test2</wsa:ServiceName>\n" +
  +        "    </wsa:ReplyTo>\n" +
  +        "    <wsa:FaultTo S:actor=\"A1\">\n" +
  +        "      <wsa:Address>http://business456.com/deadletters</wsa:Address>\n" +
  +        "    </wsa:FaultTo>\n" +
  +        "    <wsa:To S:actor=\"A1\" S:mustUnderstand=\"1\">mailto:joe@fabrikam123.com</wsa:To>\n" +
  +        "    <wsa:Action S:actor=\"A2\">http://foo.com/mail#Get</wsa:Action>\n" +
  +        "    <wsa:To S:actor=\"A2\" S:mustUnderstand=\"1\">mailto:mike@foo.com</wsa:To>\n" +
  +        "    <wsa:Action S:actor=\"A1\">http://fabrikam123.com/mail#Delete</wsa:Action>\n" +
  +        "  </S:Header>\n" +
  +        "  <S:Body>\n" +
  +        "    <f123:Delete>\n" +
  +        "      <maxCount>42</maxCount>\n" +
  +        "    </f123:Delete>\n" +
  +        "  </S:Body>\n" +
  +        "</S:Envelope>";
  +
       public void testSOAPEnvelope() throws Exception {
           Message msg = new Message(new ByteArrayInputStream(xml.getBytes()));
           AddressingHeaders headers = new AddressingHeaders(msg.getSOAPEnvelope());
           System.out.println("Header/MessageID       : " + headers.getMessageID());
           System.out.println("Header/Action          : " + headers.getAction());
   
  -        System.out.println("Header/To              : " + headers.getTo().getAddress());
  +        System.out.println("Header/To              : " + headers.getTo());
           System.out.println("Header/RelatesTo       : " + ((RelatesTo) headers.getRelatesTo().get(0)).getURI());
           System.out.println("Header/FaultTo/Address : " + headers.getFaultTo().getAddress());
   
  @@ -75,4 +108,100 @@
           System.out.println(msg.getSOAPPartAsString());
           System.out.println("=================================");
       }
  +
  +    public void testHeaders() 
  +        throws Exception {
  +        Message msg = new Message(new ByteArrayInputStream(xml2.getBytes()));
  +
  +        AddressingHeaders headers = null;
  +
  +        headers = new AddressingHeaders(msg.getSOAPEnvelope(),
  +                                        "A1",
  +                                        true,
  +                                        true);
  +        checkHeaders(headers);
  +
  +        org.apache.axis.message.SOAPEnvelope env = 
  +            new org.apache.axis.message.SOAPEnvelope();
  +
  +        headers.toEnvelope(env, "A1");
  +
  +        headers = new AddressingHeaders(env, 
  +                                        "A1",
  +                                        true,
  +                                        true);
  +        
  +        checkHeaders(headers);
  +    }
  +
  +    private void checkHeaders(AddressingHeaders headers) 
  +        throws Exception {
  +
  +        assertEquals("uuid:aaaabbbb-cccc-dddd-eeee-ffffffffffff",
  +                     headers.getMessageID().toString());
  +
  +        assertEquals("http://fabrikam123.com/mail#Delete",
  +                     headers.getAction().toString());
  +
  +        assertEquals("mailto:joe@fabrikam123.com",
  +                     headers.getTo().toString());
  +
  +        assertEquals("uuid:11112222-3333-4444-5555-666666666666",
  +                     ((RelatesTo) headers.getRelatesTo().get(0)).getURI().toString());
  +
  +        assertEquals(new QName("testNS", "testPart"),
  +                     ((RelatesTo) headers.getRelatesTo().get(0)).getType());
  +
  +        assertEquals("http://business456.com/deadletters",
  +                     headers.getFaultTo().getAddress().toString());
  +
  +        assertEquals(null, 
  +                     headers.getFaultTo().getPortType());
  +
  +        assertEquals("http://business456.com/client1",
  +                     headers.getReplyTo().getAddress().toString());
  +
  +        assertEquals(new QName("Foo", "Test"),
  +                     headers.getReplyTo().getPortType());
  +
  +        assertEquals(new QName("Bar", "Test2"),
  +                     headers.getReplyTo().getServiceName());
  +        
  +    }
  +
  +    public void testParseHeadersActor() 
  +        throws Exception {
  +        Message msg = new Message(new ByteArrayInputStream(xml2.getBytes()));
  +
  +        AddressingHeaders headers = null;
  +
  +        headers = new AddressingHeaders(msg.getSOAPEnvelope(),
  +                                        "A2",
  +                                        true,
  +                                        true);
  +
  +        checkHeadersActor(headers);
  +
  +        org.apache.axis.message.SOAPEnvelope env = 
  +            new org.apache.axis.message.SOAPEnvelope();
  +
  +        headers.toEnvelope(env, "A2");
  +
  +        headers = new AddressingHeaders(env, 
  +                                        "A2",
  +                                        true,
  +                                        true);
  +        
  +        checkHeadersActor(headers);
  +    }
  +
  +    private void checkHeadersActor(AddressingHeaders headers)
  +        throws Exception {
  +        assertEquals("http://foo.com/mail#Get",
  +                     headers.getAction().toString());
  +        
  +        assertEquals("mailto:mike@foo.com",
  +                     headers.getTo().toString());
  +    }
  +
   }