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 ip...@apache.org on 2005/05/07 02:11:37 UTC

cvs commit: ws-fx/addressing/src/org/apache/axis/message/addressing Constants.java EndpointReference.java ReferenceParametersType.java ReferencePropertiesType.java

ips         2005/05/06 17:11:37

  Modified:    addressing/src/org/apache/axis/message/addressing
                        Constants.java EndpointReference.java
                        ReferenceParametersType.java
                        ReferencePropertiesType.java
  Log:
  added support for RefParams to EPR constructors and EPR toDOM() method
  
  Revision  Changes    Path
  1.14      +14 -11    ws-fx/addressing/src/org/apache/axis/message/addressing/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/Constants.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Constants.java	8 Apr 2005 15:57:25 -0000	1.13
  +++ Constants.java	7 May 2005 00:11:37 -0000	1.14
  @@ -47,7 +47,7 @@
           "http://schemas.xmlsoap.org/ws/2004/08/addressing";
   
       /**
  -     * Field NS_URI_ADDRESSING (default)
  +     * Default WSA namespace to use when serializing EPRs or WSA headers.
        */
       public static final String NS_URI_ADDRESSING_DEFAULT =
           NS_URI_ADDRESSING_2004_08;
  @@ -78,27 +78,32 @@
       public static final String ACTION = "Action";
   
       /**
  -     * Field ADDRESS
  +     * The localName of the Address EPR element.
        */
       public static final String ADDRESS = "Address";
   
       /**
  -     * Field REFERENCE_PROPERTIES
  +     * The localName of the ReferenceProperties EPR element.
        */
       public static final String REFERENCE_PROPERTIES = "ReferenceProperties";
   
       /**
  -     * Field SERVICE_NAME
  +     * The localName of the ReferenceParameters EPR element.
  +     */
  +    public static final String REFERENCE_PARAMETERS = "ReferenceParameters";
  +
  +    /**
  +     * The localName of the ServiceName EPR element.
        */
       public static final String SERVICE_NAME = "ServiceName";
   
       /**
  -     * Field PORT_NAME
  +     * The name of the PortName attribute of the ServiceName EPR element.
        */
       public static final String PORT_NAME = "PortName";
   
       /**
  -     * Field PORT_TYPE
  +     * The localName of the PortType EPR element.
        */
       public static final String PORT_TYPE = "PortType";
   
  @@ -164,19 +169,19 @@
           "addressing.namespace.URI";
   
       /**
  -     * Field ENV_ADDRESSING_FROM_URI
  +     * SOAP message context prop with default value for wsa:From header for outgoing request messages.
        */
       public static final String ENV_ADDRESSING_FROM_URI =
           "addressing.from.URI";
   
       /**
  -     * Field ENV_ADDRESSING_REPLYTO_URI
  +     * SOAP message context prop with default value for wsa:ReplyTo header for outgoing request messages.
        */
       public static final String ENV_ADDRESSING_REPLYTO_URI =
           "addressing.replyTo.URI";
       
       /**
  -     * Field ENV_ADDRESSING_FAULTTO_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";
  @@ -199,5 +204,3 @@
       public static final String WSDL_ATTRIB_ACTION = "Action";
   
   }
  -
  -
  
  
  
  1.20      +32 -11    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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- EndpointReference.java	8 Apr 2005 15:57:25 -0000	1.19
  +++ EndpointReference.java	7 May 2005 00:11:37 -0000	1.20
  @@ -83,7 +83,7 @@
        * @param endpoint
        * @throws URI.MalformedURIException
        */
  -    public EndpointReference(final String endpoint)
  +    public EndpointReference(String endpoint)
               throws URI.MalformedURIException {
           setAddress(new Address(new URI(endpoint)));
       }
  @@ -121,11 +121,18 @@
                       ReferencePropertiesType props = 
                           ReferencePropertiesType.fromSOAPElement((SOAPElement)child);
                       setProperties(props);
  +                } else if (Constants.REFERENCE_PARAMETERS.equals(localName)) {
  +                    ReferenceParametersType params =
  +                        ReferenceParametersType.fromSOAPElement((SOAPElement)child);
  +                    setParameters(params);
                   } else {
                       // ignore others
                   }
               } 
           }
  +        if ( getAddress() == null ) {
  +            throw new IllegalArgumentException( "Specified element does not contain the required 'wsa:Address' child element." );
  +        }
       }
   
       /**
  @@ -141,7 +148,7 @@
               Node child = (Node)children.item(i);
               if (child instanceof Element) {
                   if (!AddressingUtils.isAddressingNamespaceURI(child.getNamespaceURI())) {
  -                    // skip now. does not handle extensibiliy elements now
  +                    // skip for now - does not currently handle extensibility elements
                       continue;
                   }
                   String localName = child.getLocalName();
  @@ -150,21 +157,28 @@
                           Address.fromElement((Element)child);
                       setAddress(address);
                   } else if (Constants.PORT_TYPE.equals(localName)) {
  -                    PortType portType = 
  +                    PortType portType =
                           PortType.fromElement((Element)child);
                       setPortType(portType);
                   } else if (Constants.SERVICE_NAME.equals(localName)) {
  -                    ServiceNameType serviceName = 
  +                    ServiceNameType serviceName =
                           ServiceNameType.fromElement((Element)child);
                       setServiceName(serviceName);
                   } else if (Constants.REFERENCE_PROPERTIES.equals(localName)) {
  -                    ReferencePropertiesType props = 
  +                    ReferencePropertiesType props =
                           ReferencePropertiesType.fromElement((Element)child);
                       setProperties(props);
  +                } else if (Constants.REFERENCE_PARAMETERS.equals(localName)) {
  +                    ReferenceParametersType params =
  +                        ReferenceParametersType.fromElement((Element)child);
  +                    setParameters(params);
                   } else {
                       // ignore others
                   }
  -            } 
  +            }
  +        }
  +        if ( getAddress() == null ) {
  +            throw new IllegalArgumentException( "Specified element does not contain the required 'wsa:Address' child element." );
           }
       }
   
  @@ -187,7 +201,7 @@
           if (doc == null) {
               try {
                   doc = XMLUtils.newDocument();
  -            } catch (ParserConfigurationException e) {
  +            } catch (ParserConfigurationException pce) {
                   return null;
               }
           }
  @@ -209,9 +223,9 @@
           if (getServiceName() != null) {
               getServiceName().append(parent, Constants.SERVICE_NAME);
           }
  -        ReferencePropertiesType referenceProperties = getProperties();
  -        if (referenceProperties != null && referenceProperties.size() > 0) {
  -            referenceProperties.append(parent, Constants.REFERENCE_PROPERTIES);
  +        ReferencePropertiesType refProps = getProperties();
  +        if (refProps != null && refProps.size() > 0) {
  +            refProps.append(parent, Constants.REFERENCE_PROPERTIES);
           }
           MessageElement [] any = get_any();
           if (any != null && any.length > 0) {
  @@ -224,6 +238,13 @@
                   }
               }
           }
  +        // 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);
  +            }
  +        }
           return parent;
       }
   
  @@ -239,7 +260,7 @@
                                                       String name)
           throws Exception {
           if (name == null) {
  -            throw new IllegalArgumentException();
  +            throw new IllegalArgumentException("Name parameter must be non-null.");
           }
           if (!(env instanceof org.apache.axis.message.SOAPEnvelope)) {
               throw new Exception("Not supported");
  
  
  
  1.5       +40 -4     ws-fx/addressing/src/org/apache/axis/message/addressing/ReferenceParametersType.java
  
  Index: ReferenceParametersType.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/ReferenceParametersType.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ReferenceParametersType.java	8 Apr 2005 15:57:25 -0000	1.4
  +++ ReferenceParametersType.java	7 May 2005 00:11:37 -0000	1.5
  @@ -25,14 +25,19 @@
   import org.apache.commons.logging.LogFactory;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  +import org.w3c.dom.NodeList;
  +import org.w3c.dom.Node;
   
   import javax.xml.namespace.QName;
  +import javax.xml.soap.SOAPElement;
   import java.io.Serializable;
  +import java.util.Iterator;
   
   /**
  - * Java content class for ReferenceParametersType complex type.
  - * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2004/08/addressing line 62)
  - * <p>
  + * Java content class for the ReferenceParametersType complex type.
  + * <p>The following schema fragment (defined at http://schemas.xmlsoap.org/ws/2004/08/addressing line 62)
  + * specifies the expected content contained within this Java content object:
  + * </p>
    * <pre>
    * &lt;complexType name="ReferenceParametersType">
    *   &lt;complexContent>
  @@ -173,6 +178,38 @@
           parent.appendChild(refProp);
       }
   
  +    public static ReferenceParametersType fromSOAPElement(SOAPElement element)
  +        throws Exception {
  +        ReferenceParametersType params = new ReferenceParametersType();
  +        Iterator iter = element.getChildElements();
  +        while(iter.hasNext()) {
  +            javax.xml.soap.Node child = (javax.xml.soap.Node)iter.next();
  +            if (!(child instanceof SOAPElement)) {
  +                continue;
  +            }
  +            if (child instanceof MessageElement) {
  +                params.add( ((MessageElement)child).getAsDOM() );
  +            } else {
  +                params.add(child);
  +            }
  +        }
  +        return params;
  +    }
  +
  +    public static ReferenceParametersType fromElement(Element element)
  +        throws Exception {
  +        ReferenceParametersType params = new ReferenceParametersType();
  +        NodeList children = element.getChildNodes();
  +        for (int i=0;i<children.getLength();i++) {
  +            Node child = (Node)children.item(i);
  +            if (!(child instanceof Element)) {
  +                continue;
  +            }
  +            params.add(child);
  +        }
  +        return params;
  +    }
  +
       /**
        * Gets the _any value for this ReferenceParametersType.
        * 
  @@ -223,7 +260,6 @@
           return typeDesc;
       }
   
  -
       /**
        * Get Custom Serializer
        */
  
  
  
  1.18      +2 -12     ws-fx/addressing/src/org/apache/axis/message/addressing/ReferencePropertiesType.java
  
  Index: ReferencePropertiesType.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/ReferencePropertiesType.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ReferencePropertiesType.java	8 Apr 2005 15:57:25 -0000	1.17
  +++ ReferencePropertiesType.java	7 May 2005 00:11:37 -0000	1.18
  @@ -143,8 +143,6 @@
           } else {
               throw new IllegalArgumentException();
           }
  -        MessageElement [] newAny = null;
  -
           if (this._any == null) {
               this._any = new MessageElement[] {value};
           } else {
  @@ -183,17 +181,13 @@
   
       public static ReferencePropertiesType fromSOAPElement(SOAPElement element)
           throws Exception {
  -        ReferencePropertiesType props = null;
  +        ReferencePropertiesType props = new ReferencePropertiesType();
           Iterator iter = element.getChildElements();
           while(iter.hasNext()) {
               javax.xml.soap.Node child = (javax.xml.soap.Node)iter.next();
               if (!(child instanceof SOAPElement)) {
                   continue;
               }
  -            if (props == null) {
  -                props = new ReferencePropertiesType();
  -            }
  -
               if (child instanceof MessageElement) {
                   props.add( ((MessageElement)child).getAsDOM() );
               } else {
  @@ -205,17 +199,13 @@
   
       public static ReferencePropertiesType fromElement(Element element)
           throws Exception {
  -        ReferencePropertiesType props = null;
  +        ReferencePropertiesType props = new ReferencePropertiesType();
           NodeList children = element.getChildNodes();
           for (int i=0;i<children.getLength();i++) {
               Node child = (Node)children.item(i);
               if (!(child instanceof Element)) {
                   continue;
               }
  -            if (props == null) {
  -                props = new ReferencePropertiesType();
  -            }
  -
               props.add(child);
           }
           return props;