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 Aleksander Slominski <as...@cs.indiana.edu> on 2004/02/18 05:39:03 UTC

WS-FX Addressing API review ...

hi,

i thought i would write some comments about current fx/wsa API. however 
before i proceed one observation: i think it would be good to have an 
example of usage (current tests looks like a beginning ...).

now to the main point: i do not think that basing API on ETTK is good 
idea - it looks like a first attempt and is very messy (in my opinion of 
course!). i would instead try to make it as simple as possible to limit 
number of non essential classes and cognitive space when using API - see 
below.

so here are more specific comments

* it seems to me that EndpointReference, RelatesTo, AddressingHeader aka 
MessageInformationHeaders (class to encapsulate MIH i.e. that provides 
transfer between WS-Addressing and SOAP headers) would be enough? to 
give a concrete example i attach such 3 classes that i think implement 
whole WSA (to compile XML Infoset API from XPP3 is required).

* there is lot of classes but it is not clear if all are needed? i think 
most of *Type classes is not needed and
i could not see use for To/ReplyTo/etc classes that encapsulate simply 
EndpointReference (and there is no check that To class is actually  
representing <wsa:To> ...)


* ReferencePropertiesType seems to be just List<Element> that is on 
demand added to parent message? this means it does not really help with 
reference properties DOM children management?

* it seems to me that there is a problem with PortType(String qname)
    public PortType(String qname) {
        this(new QName(qname));
    }
as it calls QName(String localPart) constructor so namespace and prefix 
will be lost?

i think that real test of API is how easy is to use so here is an 
example of what i think about is easy:

void describeEp(WsaEndpointReference ep) {
        System.out.println("\nEndpoint Reference "+ep.getName());
        System.out.println("address URI="+ep.getAddress());
        XmlElement props = ep.getReferenceProperties();
        if(props != null) {
            for(Iterator i = props.requiredElementContent(); 
i.hasNext(); ) {
                System.out.println("reference 
property="+builder.serializeToString(i.next()));
            }
        } else {
            System.out.println("no reference properties");
        }
        System.out.println("selected port-type="+ep.getPortType());
        System.out.println("service name="+ep.getServiceName());
        System.out.println("service-port name="+ep.getServicePortName());
        int pos = 1;
        for(Iterator i = ep.getPolicy().iterator(); i.hasNext(); ++pos) {
            XmlElement policy = (XmlElement) i.next();
            
System.out.println("policy["+pos+"]="+builder.serializeToString(policy));
        }
    }

anyway this is what i currently think and i am interested to hear what 
Dims and other people think about it.

thanks,

alek

ps. IMHO maven generated site is hard to navigate and hard to see what 
is the real content and what is boilerplate - wouldn't it be simpler to 
put all information on one web page - just my 2c...

-- 
The best way to predict the future is to invent it - Alan Kay


Re: WS-FX Addressing API review ...

Posted by Davanum Srinivas <di...@yahoo.com>.
- The test case would be  TestSerDeser.java
- Yes its easy, that's why i asked about WS-Eventing and NOT WS-Notification :)
- Regarding Licenses....Let's code first. Folks will let us know if we cross the line. Am sure
many people are tracking the WS-FX work. (we can always pull back/move to sf.net etc...)

thanks,
dims

--- Aleksander Slominski <as...@cs.indiana.edu> wrote:
> Davanum Srinivas wrote:
> 
> >Looks good though I really do want to keep the current classes :)
> >
> >#1 - How do i hook up the Axis' SOAP Message with the MessageInformationHeaders? 
> >
> it needs to be populated from AXIS Message and exploded into AXIS 
> message to populate back changes.
> 
> >can you please
> >post a snippet? (basically reimplement the test case with your code).
> >  
> >
> what is the test case? i thin it is TestSerDeser and not TextExtractor - 
> the latter does not look right?
> 
> >#2 - Do you want to take a stab at WS-Eventing? that is pretty simple too.
> >  
> >
> isnt it *too* easy :-) WS-Notification looks like a bigger challenge and 
> is closer to real MOM :-)
> 
> however is it legal to implement it under APL? i could not find any 
> licensing info about it (is it RF?):
> 
> from 
>
http://msdn.microsoft.com/webservices/understanding/specs/default.aspx?pull=/library/en-us/dnglobspec/html/ws-eventing.asp
> 
> (...)BEA Systems, Microsoft, and TIBCO Software (collectively, the 
> "Authors") hereby *grant you permission to copy and display this 
> specification *(the "Specification"), in any medium without fee or 
> royalty (...)
> (...)
> *No other rights are granted by implication, estoppel or otherwise.*(...)
> 
> >PS: Am re-thinking jump starting the WS-Commons proposal for hosting the Infoset code.
> >  
> >
> great!
> 
> alek
> 
> -- 
> The best way to predict the future is to invent it - Alan Kay
> 
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

Re: WS-FX Addressing API review ...

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
Davanum Srinivas wrote:

>Looks good though I really do want to keep the current classes :)
>
>#1 - How do i hook up the Axis' SOAP Message with the MessageInformationHeaders? 
>
it needs to be populated from AXIS Message and exploded into AXIS 
message to populate back changes.

>can you please
>post a snippet? (basically reimplement the test case with your code).
>  
>
what is the test case? i thin it is TestSerDeser and not TextExtractor - 
the latter does not look right?

>#2 - Do you want to take a stab at WS-Eventing? that is pretty simple too.
>  
>
isnt it *too* easy :-) WS-Notification looks like a bigger challenge and 
is closer to real MOM :-)

however is it legal to implement it under APL? i could not find any 
licensing info about it (is it RF?):

from 
http://msdn.microsoft.com/webservices/understanding/specs/default.aspx?pull=/library/en-us/dnglobspec/html/ws-eventing.asp

(...)BEA Systems, Microsoft, and TIBCO Software (collectively, the 
"Authors") hereby *grant you permission to copy and display this 
specification *(the "Specification"), in any medium without fee or 
royalty (...)
(...)
*No other rights are granted by implication, estoppel or otherwise.*(...)

>PS: Am re-thinking jump starting the WS-Commons proposal for hosting the Infoset code.
>  
>
great!

alek

-- 
The best way to predict the future is to invent it - Alan Kay


Re: WS-FX Addressing API review ...

Posted by Davanum Srinivas <di...@yahoo.com>.
Looks good though I really do want to keep the current classes :)

#1 - How do i hook up the Axis' SOAP Message with the MessageInformationHeaders? can you please
post a snippet? (basically reimplement the test case with your code).
#2 - Do you want to take a stab at WS-Eventing? that is pretty simple too.

thanks,
dims

PS: Am re-thinking jump starting the WS-Commons proposal for hosting the Infoset code.

--- Aleksander Slominski <as...@cs.indiana.edu> wrote:
> Davanum Srinivas wrote:
> 
> >I wanted to faithfully represent the Schema in the Java classes. I used JAXB, XMLBeans, JaxMe
> etc
> >to see what they generate and came up with the Java classes. 
> >  
> >
> i think WSA is very simple spec (and that *is* great!) that may become a
> fundamental utility to other specs so machine generated binding classes
> may not be the best choice - after all there is more to WSA than XML
> Schema data binding such as interfacing it with AXIS ...
> 
> >Notes:
> >-  Yes, we need to add checks for say "(and there is no check that To class is actually 
> >representing <wsa:To> ...)".
> >  
> >
> OK
> 
> >- We need solution for JDK1.3/1.4, can't wait for 1.5 to go on production systems.
> >  
> >
> the same for me: right now i am stuck waiting before it starts happening
> for next few months ...
> 
> >- Yes the constructors need fixing to not drop the prefix / namespace.
> >  
> >
> OK
> 
> >- I do like the xml load / save stuff that you have in "XML Infoset API from XPP3"
> >- Can we reimplement current classes using your API?
> >  
> >
> yes.
> 
> >- What's the license for "XML Infoset API from XPP3"?
> >  
> >
> it is Apache compatible - my lab license is
> http://www.extreme.indiana.edu/LICENSE.txt
> 
> >- Is it available as a separate dist/jar?
> >  
> >
> as it is easy to extract as those are interfaces (they were _designed_
> to make it easy) so i am attaching ZIP file with fully working version
> adapted to org.apache.axis.message.infoset package (refactoring tools!)/
> source code should be compatible with any JDK 1.3+ (or even JDK 1.2 ...)
> 
> download it from:
> http://www.extreme.indiana.edu/~aslom/addressing_proposal_2004_02_08.zip
> 
> to compile and make it work download XmlPull compatible parser such as
> XPP3 (http://www.extreme.indiana.edu/xgws/xsoap/xpp/mxp1/ and JAR file from:
> http://www.extreme.indiana.edu/dist/java-repository/xpp3/jars/)
> 
> in future it should be easy to adapt it to StAX, SAX, DOM builders or
> whatnot.
> 
> i am eager to hear comments about it.
> 
> thanks,
> 
> alek
> 
> -- 
> The best way to predict the future is to invent it - Alan Kay
> 
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

Re: WS-FX Addressing API review ...

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
Davanum Srinivas wrote:

>I wanted to faithfully represent the Schema in the Java classes. I used JAXB, XMLBeans, JaxMe etc
>to see what they generate and came up with the Java classes. 
>  
>
i think WSA is very simple spec (and that *is* great!) that may become a
fundamental utility to other specs so machine generated binding classes
may not be the best choice - after all there is more to WSA than XML
Schema data binding such as interfacing it with AXIS ...

>Notes:
>-  Yes, we need to add checks for say "(and there is no check that To class is actually 
>representing <wsa:To> ...)".
>  
>
OK

>- We need solution for JDK1.3/1.4, can't wait for 1.5 to go on production systems.
>  
>
the same for me: right now i am stuck waiting before it starts happening
for next few months ...

>- Yes the constructors need fixing to not drop the prefix / namespace.
>  
>
OK

>- I do like the xml load / save stuff that you have in "XML Infoset API from XPP3"
>- Can we reimplement current classes using your API?
>  
>
yes.

>- What's the license for "XML Infoset API from XPP3"?
>  
>
it is Apache compatible - my lab license is
http://www.extreme.indiana.edu/LICENSE.txt

>- Is it available as a separate dist/jar?
>  
>
as it is easy to extract as those are interfaces (they were _designed_
to make it easy) so i am attaching ZIP file with fully working version
adapted to org.apache.axis.message.infoset package (refactoring tools!)/
source code should be compatible with any JDK 1.3+ (or even JDK 1.2 ...)

download it from:
http://www.extreme.indiana.edu/~aslom/addressing_proposal_2004_02_08.zip

to compile and make it work download XmlPull compatible parser such as
XPP3 (http://www.extreme.indiana.edu/xgws/xsoap/xpp/mxp1/ and JAR file from:
http://www.extreme.indiana.edu/dist/java-repository/xpp3/jars/)

in future it should be easy to adapt it to StAX, SAX, DOM builders or
whatnot.

i am eager to hear comments about it.

thanks,

alek

-- 
The best way to predict the future is to invent it - Alan Kay



Re: WS-FX Addressing API review ...

Posted by Davanum Srinivas <di...@yahoo.com>.
Alek,

I wanted to faithfully represent the Schema in the Java classes. I used JAXB, XMLBeans, JaxMe etc
to see what they generate and came up with the Java classes. 

Notes:
-  Yes, we need to add checks for say "(and there is no check that To class is actually 
representing <wsa:To> ...)".
- We need solution for JDK1.3/1.4, can't wait for 1.5 to go on production systems.
- Yes the constructors need fixing to not drop the prefix / namespace.
- I do like the xml load / save stuff that you have in "XML Infoset API from XPP3"
- Can we reimplement current classes using your API?
- What's the license for "XML Infoset API from XPP3"?
- Is it available as a separate dist/jar?

Thanks,
dims


--- Aleksander Slominski <as...@cs.indiana.edu> wrote:
> hi,
> 
> i thought i would write some comments about current fx/wsa API. however 
> before i proceed one observation: i think it would be good to have an 
> example of usage (current tests looks like a beginning ...).
> 
> now to the main point: i do not think that basing API on ETTK is good 
> idea - it looks like a first attempt and is very messy (in my opinion of 
> course!). i would instead try to make it as simple as possible to limit 
> number of non essential classes and cognitive space when using API - see 
> below.
> 
> so here are more specific comments
> 
> * it seems to me that EndpointReference, RelatesTo, AddressingHeader aka 
> MessageInformationHeaders (class to encapsulate MIH i.e. that provides 
> transfer between WS-Addressing and SOAP headers) would be enough? to 
> give a concrete example i attach such 3 classes that i think implement 
> whole WSA (to compile XML Infoset API from XPP3 is required).
> 
> * there is lot of classes but it is not clear if all are needed? i think 
> most of *Type classes is not needed and
> i could not see use for To/ReplyTo/etc classes that encapsulate simply 
> EndpointReference (and there is no check that To class is actually  
> representing <wsa:To> ...)
> 
> 
> * ReferencePropertiesType seems to be just List<Element> that is on 
> demand added to parent message? this means it does not really help with 
> reference properties DOM children management?
> 
> * it seems to me that there is a problem with PortType(String qname)
>     public PortType(String qname) {
>         this(new QName(qname));
>     }
> as it calls QName(String localPart) constructor so namespace and prefix 
> will be lost?
> 
> i think that real test of API is how easy is to use so here is an 
> example of what i think about is easy:
> 
> void describeEp(WsaEndpointReference ep) {
>         System.out.println("\nEndpoint Reference "+ep.getName());
>         System.out.println("address URI="+ep.getAddress());
>         XmlElement props = ep.getReferenceProperties();
>         if(props != null) {
>             for(Iterator i = props.requiredElementContent(); 
> i.hasNext(); ) {
>                 System.out.println("reference 
> property="+builder.serializeToString(i.next()));
>             }
>         } else {
>             System.out.println("no reference properties");
>         }
>         System.out.println("selected port-type="+ep.getPortType());
>         System.out.println("service name="+ep.getServiceName());
>         System.out.println("service-port name="+ep.getServicePortName());
>         int pos = 1;
>         for(Iterator i = ep.getPolicy().iterator(); i.hasNext(); ++pos) {
>             XmlElement policy = (XmlElement) i.next();
>             
> System.out.println("policy["+pos+"]="+builder.serializeToString(policy));
>         }
>     }
> 
> anyway this is what i currently think and i am interested to hear what 
> Dims and other people think about it.
> 
> thanks,
> 
> alek
> 
> ps. IMHO maven generated site is hard to navigate and hard to see what 
> is the real content and what is boilerplate - wouldn't it be simpler to 
> put all information on one web page - just my 2c...
> 
> -- 
> The best way to predict the future is to invent it - Alan Kay
> 
> > /* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- 
> //------100-columns-wide------>|*/
> /*
>  * Copyright (c) 2004 Extreme! Lab, Indiana University. All rights reserved.
>  *
>  * This software is open source. See the bottom of this file for the licence.
>  *
>  * $Id: WsaEndpointReference.java,v 1.5 2004/02/07 05:49:10 aslom Exp $
>  */
> 
> package xsul.ws_addressing;
> 
> import java.net.URI;
> import javax.xml.namespace.QName;
> import org.xmlpull.v1.builder.Iterable;
> import org.xmlpull.v1.builder.XmlAttribute;
> import org.xmlpull.v1.builder.XmlElement;
> import org.xmlpull.v1.builder.XmlNamespace;
> import org.xmlpull.v1.builder.XmlPullBuilder;
> import org.xmlpull.v1.builder.adapter.XmlElementAdapter;
> import xsul.DataValidation;
> import xsul.DataValidationException;
> import xsul.MLogger;
> import xsul.util.Util;
> 
> //TODO: need clone() operaiton!
> /*WsaEndpointReference extends WsaEndpointReferenceReadOnly  {
>  target.setReadOnly(false)
>  //pass through setReadOnly
>  }
>  */
> 
> 
> //<wsa:EndpointReference>
> //   <wsa:Address>xs:anyURI</wsa:Address>
> //   <wsa:ReferenceProperties> ... </wsa:ReferenceProperties> ?
> //  <wsa:PortType>xs:QName</wsa:PortType> ?
> //  <wsa:ServiceName PortName="xs:NCName"?>xs:QName</wsa:ServiceName> ?
> //  <wsp:Policy/> *
> //</wsa:EndpointReference>
> 
> /**
>  * Implementation of
>  * <a
>
href="http://www-106.ibm.com/developerworks/webservices/library/ws-add/#informationmodelforendpointreferences">Endpoint
> Reference</a>
>  * from Web Services Addressing (WS-Addressing)
>  *
>  * @version $Revision: 1.5 $
>  * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
>  */
> public class WsaEndpointReference extends XmlElementAdapter implements DataValidation
> {
>     private final static MLogger logger = MLogger.getLogger();
>     private final static XmlPullBuilder builder = XmlPullBuilder.newInstance();
>     
>     private final static XmlNamespace wsa = WsAddressing.NS;
>     private final static XmlNamespace wsp = WsAddressing.POLICY_NS;
> 
>     public WsaEndpointReference(URI address) {
>         super(builder.newFragment(wsa, "EndpointReference"));
>         setAddress(address);
>         validateData();
>     }
>     
>     public WsaEndpointReference(XmlElement target) {
>         super(target);
>         validateData();
>     }
>     
>     //bloc requireChildrenModel
>     public URI getAddress() {
>         String t = element(wsa, "Address", true).requiredTextContent();
>         if(t != null) {
>             try {
>                 return new URI(t);
>             } catch(Exception e) {
>                 throw new DataValidationException ("wsa:Address mut be of type xs:anyURI
> "+toString(), e);
>             }
>         }
>         throw new DataValidationException ("required wsa:Address was not found in "+toString());
>     }
>     
>     public void setAddress(URI uri) {
>         XmlElement el = element(wsa, "Address", true);
>         el.removeAllChildren();
>         el.addChild(uri.toString());
>     }
> 
>     public XmlElement getReferenceProperties() {
>         return element(wsa, "ReferenceProperties");
>     }
>     
>     //    public List/*<XmlElement>*/ getPolicy() {
>     //      return elements(wsp,"Policy");
>     //    }
>     public Iterable getPolicy() {
>         return elements(wsp, "Policy");
>     }
>     
>     public QName getPortType() {
>         XmlElement el = element(wsa, "PortType");
>         if(el != null) {
>             return Util.getQNameContent(el);
>         } else {
>             return null;
>         }
>     }
>     
>     public QName getServiceName() {
>         // <wsa:ServiceName PortName="xs:NCName"?>xs:QName</wsa:ServiceName> ?
>         XmlElement el = element(wsa,"ServiceName");
>         if(el != null) {
>             return Util.getQNameContent(el);
>         } else {
>             return null;
>         }
>     }
>     
>     public String getServicePortName() {
>         // <wsa:ServiceName PortName="xs:NCName"?>xs:QName</wsa:ServiceName> ?
>         XmlElement el = element(wsa,"ServiceName");
>         if(el != null) {
>             XmlAttribute portNameAttr  = el.attribute("PortName");
>             if(portNameAttr != null) {
>                 return Util.validateNcName(portNameAttr.getValue());
>             }
>         }
>         return null;
>     }
>     
>     
>     
>     public void validateData() throws DataValidationException {
>         if(getAddress() == null) {
>             throw new DataValidationException("wsa:Address is required in "+this);
>         }
>         //      // selected portType one and it is QName!
>         getPortType();
>         // check only one PortType
>         //       elements(wsa,"PortType").size() < 2
>         //service port max one
>         //      elements(wsa,"ServiceName").size() < 2
>         getServiceName();
>         getServicePortName();
>     }
>     
>     public String toString() {
>         return builder.serializeToString(this) ;
>     }
> }
> 
> 
> /*
>  * Indiana University Extreme! Lab Software License, Version 1.2
>  *
>  * Copyright (C) 2004 The Trustees of Indiana University.
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions are
>  * met:
>  *
>  * 1) All redistributions of source code must retain the above
>  *    copyright notice, the list of authors in the original source
>  *    code, this list of conditions and the disclaimer listed in this
>  *    license;
>  *
>  * 2) All redistributions in binary form must reproduce the above
>  *    copyright notice, this list of conditions and the disclaimer
>  *    listed in this license in the documentation and/or other
>  *    materials provided with the distribution;
>  *
>  * 3) Any documentation included with all redistributions must include
>  *    the following acknowledgement:
>  *
>  *      "This product includes software developed by the Indiana
>  *      University Extreme! Lab.  For further information please visit
>  *      http://www.extreme.indiana.edu/"
>  *
>  *    Alternatively, this acknowledgment may appear in the software
>  *    itself, and wherever such third-party acknowledgments normally
>  *    appear.
>  *
>  * 4) The name "Indiana University" or "Indiana University
>  *    Extreme! Lab" shall not be used to endorse or promote
>  *    products derived from this software without prior written
>  *    permission from Indiana University.  For written permission,
>  *    please contact http://www.extreme.indiana.edu/.
>  *
>  * 5) Products derived from this software may not use "Indiana
>  *    University" name nor may "Indiana University" appear in their name,
>  *    without prior written permission of the Indiana University.
>  *
>  * Indiana University provides no reassurances that the source code
>  * provided does not infringe the patent or any other intellectual
>  * property rights of any other entity.  Indiana University disclaims any
>  * liability to any recipient for claims brought by any other entity
>  * based on infringement of intellectual property rights or otherwise.
>  *
> 
=== message truncated ===> /* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- 
> //------100-columns-wide------>|*/
> /*
>  * Copyright (c) 2004 Extreme! Lab, Indiana University. All rights reserved.
>  *
>  * This software is open source. See the bottom of this file for the licence.
>  *
>  * $Id: WsaRelatesTo.java,v 1.1 2004/02/12 04:04:35 aslom Exp $
>  */
> 
> package xsul.ws_addressing;
> 
> import java.net.URI;
> import javax.xml.namespace.QName;
> import org.xmlpull.v1.builder.XmlAttribute;
> import org.xmlpull.v1.builder.XmlElement;
> import org.xmlpull.v1.builder.XmlNamespace;
> import org.xmlpull.v1.builder.XmlPullBuilder;
> import org.xmlpull.v1.builder.adapter.XmlElementAdapter;
> import xsul.DataValidation;
> import xsul.DataValidationException;
> import xsul.MLogger;
> import xsul.util.Util;
> 
> //TODO: need clone() operaiton!
> 
> 
> /*
> /wsa:RelatesTo
> 
>  This optional (repeating) element information item contributes
>  one abstract [relationship] property value, in the form of a (URI, QName) pair.
>  The [children] property of this element (which is of type xs:anyURI) conveys the [message id]
> of the related message
> 
>  */
> 
> /**
>  * Implementation of
>  * <a href="http://www-106.ibm.com/developerworks/webservices/library/ws-add/">RelatesTo</a>
>  * element
>  * from Web Services Addressing (WS-Addressing) used in WSA MessageHeaders
>  *
>  * @version $Revision: 1.1 $
>  * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
>  */
> public class WsaRelatesTo extends XmlElementAdapter implements DataValidation
> {
>     private final static MLogger logger = MLogger.getLogger();
>     private final static XmlPullBuilder builder = XmlPullBuilder.newInstance();
>     
>     private final static XmlNamespace wsa = WsAddressing.NS;
>     private final static XmlNamespace wsp = WsAddressing.POLICY_NS;
>     
>     public WsaRelatesTo(URI relationship) {
>         super(builder.newFragment(wsa, "RelatesTo"));
>         setRelationship(relationship);
>         validateData();
>     }
>     
>     public WsaRelatesTo(XmlElement target) {
>         super(target);
>         validateData();
>     }
>     
>     //bloc requireChildrenModel
>     public URI getRelationship() {
>         String t = requiredTextContent();
>         if(t != null) {
>             try {
>                 return new URI(t.trim());
>             } catch(Exception e) {
>                 throw new DataValidationException ("wsa:RelatesTo content must be of type
> xs:anyURI in "+toString(), e);
>             }
>         }
>         throw new DataValidationException ("wsa:RelatesTo is required to have text content with
> xs:anyUri in "+toString());
>     }
>     
>     public void setRelationship(URI uri) {
>         removeAllChildren();
>         addChild(uri.toString());
>     }
>     
>     /**
>      * Encapsulate /wsa:RelatesTo/@RelationshipType
>      *
>      * This optional attribute (of type xs:QName) conveys the relationship type as a QName.
>      */
>     
>     public QName getRelationshipType() {
>         XmlAttribute relationshipTypeAttr = attribute("RelationshipType");
>         if(relationshipTypeAttr != null) {
>             return null; //Util.validateNcName(portNameAttr.getValue());
>         }
>         return WsAddressing.RESPONSE_RELATIONSHIP_QNAME;
>     }
>         
>     public void validateData() throws DataValidationException {
>         if(getRelationship() == null) {
>             throw new DataValidationException("relationship URI in wsa:RelatesTo is required in
> "+this);
>         }
>         //      // selected portType one and it is QName!
>         getRelationshipType();
>     }
>     
>     
>     public String toString() {
>         return Util.safeXmlToString(this) ;
>     }
> }
> 
> 
> /*
>  * Indiana University Extreme! Lab Software License, Version 1.2
>  *
>  * Copyright (C) 2004 The Trustees of Indiana University.
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions are
>  * met:
>  *
>  * 1) All redistributions of source code must retain the above
>  *    copyright notice, the list of authors in the original source
>  *    code, this list of conditions and the disclaimer listed in this
>  *    license;
>  *
>  * 2) All redistributions in binary form must reproduce the above
>  *    copyright notice, this list of conditions and the disclaimer
>  *    listed in this license in the documentation and/or other
>  *    materials provided with the distribution;
>  *
>  * 3) Any documentation included with all redistributions must include
>  *    the following acknowledgement:
>  *
>  *      "This product includes software developed by the Indiana
>  *      University Extreme! Lab.  For further information please visit
>  *      http://www.extreme.indiana.edu/"
>  *
>  *    Alternatively, this acknowledgment may appear in the software
>  *    itself, and wherever such third-party acknowledgments normally
>  *    appear.
>  *
>  * 4) The name "Indiana University" or "Indiana University
>  *    Extreme! Lab" shall not be used to endorse or promote
>  *    products derived from this software without prior written
>  *    permission from Indiana University.  For written permission,
>  *    please contact http://www.extreme.indiana.edu/.
>  *
>  * 5) Products derived from this software may not use "Indiana
>  *    University" name nor may "Indiana University" appear in their name,
>  *    without prior written permission of the Indiana University.
>  *
>  * Indiana University provides no reassurances that the source code
>  * provided does not infringe the patent or any other intellectual
>  * property rights of any other entity.  Indiana University disclaims any
>  * liability to any recipient for claims brought by any other entity
>  * based on infringement of intellectual property rights or otherwise.
>  *
>  * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH
>  * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA
>  * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT
>  * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR
>  * OTHER PROPRIETARY RIGHTS.  INDIANA UNIVERSITY MAKES NO WARRANTIES THAT
>  * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP
>  * DOORS", "WORMS", OR OTHER HARMFUL CODE.  LICENSEE ASSUMES THE ENTIRE
>  * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
>  * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING
>  * SOFTWARE.
>  */
> 
> 
> 
> 
> 
> > /* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- 
> //------100-columns-wide------>|*/
> /*
>  * Copyright (c) 2004 Extreme! Lab, Indiana University. All rights reserved.
>  *
>  * This software is open source. See the bottom of this file for the licence.
>  *
>  * $Id: WsaMessageInformationHeaders.java,v 1.1 2004/02/12 04:04:35 aslom Exp $
>  */
> 
> package xsul.ws_addressing;
> 
> import java.io.IOException;
> import java.net.URI;
> import java.util.Iterator;
> import javax.xml.namespace.QName;
> import org.xmlpull.v1.XmlSerializer;
> import org.xmlpull.v1.builder.Iterable;
> import org.xmlpull.v1.builder.XmlAttribute;
> import org.xmlpull.v1.builder.XmlElement;
> import org.xmlpull.v1.builder.XmlNamespace;
> import org.xmlpull.v1.builder.XmlPullBuilder;
> import org.xmlpull.v1.builder.XmlSerializable;
> import xsul.DataValidation;
> import xsul.DataValidationException;
> import xsul.MLogger;
> import xsul.XsulException;
> import xsul.util.Util;
> 
> //<wsa:To>xs:anyURI</wsa:To>
> //<wsa:Action>xs:anyURI</wsa:Action>
> //<wsa:MessageID>xs:anyURI</wsa:MessageID>?
> //<wsa:RelatesTo RelationshipType="..."?>xs:anyURI</wsa:RelatesTo>*
> //<wsa:From>endpoint-reference</wsa:From>?
> //<wsa:ReplyTo>endpoint-reference</wsa:ReplyTo>?
> //<wsa:FaultTo>endpoint-reference</wsa:FaultTo>?
> //<wsa:Recipient>endpoint-reference</wsa:Recipient>?
> 
> /**
>  * Implementation of Message Information Headers from
>  * <a
>
href="http://www-106.ibm.com/developerworks/webservices/library/ws-add/#informationmodelforendpointreferences">Endpoint
> Reference</a>
>  * from Web Services Addressing (WS-Addressing)
>  *
>  * @version $Revision: 1.1 $
>  * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
>  */
> public class WsaMessageInformationHeaders implements DataValidation, XmlSerializable
> {
>     private final static MLogger logger = MLogger.getLogger();
>     private final static XmlPullBuilder builder = XmlPullBuilder.newInstance();
>     
>     private final static XmlNamespace wsa = WsAddressing.NS;
>     private final static XmlNamespace wsp = WsAddressing.POLICY_NS;
>     
>     private XmlElement soapHeaders;
>     
>     // TODO require SoapHeader element !
>     public WsaMessageInformationHeaders(XmlElement soapHeaders) {
>         if(soapHeaders == null) throw new IllegalArgumentException();
>         String name = soapHeaders.getName();
>         if(!"Header".equals(name)) {
>             throw new XsulException("expected Header element to reference WS-Addressing
> Headers");
>         }
>         this.soapHeaders = soapHeaders;
>         validateData();
>     }
>     
>     private URI getUri(String name, boolean required) {
>         XmlElement headerEl = soapHeaders.element(wsa, name);
>         
>         if(headerEl != null) {
>             String t = headerEl.requiredTextContent();
>             //String t = element(wsa, name, true).requiredTextContent();
>             if(t != null) {
>                 try {
>                     return new URI(t.trim());
>                 } catch(Exception e) {
>                     throw new DataValidationException (
>                         "wsa:"+name+" mut be of type xs:anyURI "+toString(), e);
>                 }
>             }
>         }
>         if(required) {
>             throw new DataValidationException(
>                 "required wsa:"+name+" was not found in "+toString());
>         } else {
>             return null;
>         }
>     }
>     
>     private void setUri(String name, URI uri) {
>         XmlElement el = soapHeaders.element(wsa, name, true);
>         el.removeAllChildren();
>         el.addChild(uri.toString());
>     }
>     
>     public URI getTo() throws DataValidationException {
>         return getUri("To", false);
>     }
>     
>     //wsa:To is required
>     public URI getToRequired() throws DataValidationException {
>         return getUri("To", true);
>     }
>     
>     public void setTo(URI uri) {
>         setUri("To", uri);
>     }
>     
>     public URI getAction() {
>         return getUri("Action", false);
>     }
>     
>     //wsa:Action is required
>     public URI getActionRequired() {
>         return getUri("Action", true);
>     }
>     
>     public void setAction(URI uri) {
>         setUri("Action", uri);
>     }
>     
>     // /wsa:MessageID This optional element (of type xs:anyURI) conveys the [message id]
> property.
>     public URI getMessageId() {
>         return getUri("MessageID", false);
>     }
>     
>     public void setMessageId(URI uri) {
>         setUri("MessageID", uri);
>     }
>     
>     // /wsa:RelatesTo
>     // This optional (repeating) element information item contributes one abstract
> [relationship] property value,
>     //in the form of a (URI, QName) pair.
>     //The [children] property of this element (which is of type xs:anyURI) conveys the [message
> id] of the related message
>     //Iterable<XmlElement> but maybe //Itrable<WsRelatesTo>
>     ///wsa:RelatesTo/@RelationshipType
>     //JDK15 Iterable<WsaReltatesTo>
>     public Iterable getRelatesTo() {
>         final Iterator it = soapHeaders.elements(wsa, "RelatesTo").iterator();
>         // there si some beauty in deeply nested inner classes ...
>         return new Iterable() {
>             public Iterator iterator() {
>                 return new Iterator() {
>                     public boolean hasNext() {
>                         return it.hasNext();
>                     }
>                     public Object next() {
>                         XmlElement el = (XmlElement) it.next();
>                         if(el instanceof WsaRelatesTo) {
>                             return (WsaRelatesTo) el;
>                         } else {
>                             return new WsaRelatesTo(el);
>                         }
>                     }
>                     public void remove() {
>                         it.remove();
>                     }
>                     
>                 };
>             }
>         };
>     }
>     
>     //<wsa:From>endpoint-reference</wsa:From>?
>     //<wsa:ReplyTo>endpoint-reference</wsa:ReplyTo>?
>     //<wsa:FaultTo>endpoint-reference</wsa:FaultTo>?
>     //<wsa:Recipient>endpoint-reference</wsa:Recipient>?
>     public WsaEndpointReference getEndpointReference(String name) {
>         XmlElement el = soapHeaders.element(wsa, name); //??? should require exactly ONE?
>         if(el == null) {
>             return null;
>         }
>         if(el instanceof WsaEndpointReference) {
>             return (WsaEndpointReference) el;
>         } else {
>             return new WsaEndpointReference(el);
>         }
>     }
>     
>     
>     public WsaEndpointReference getFrom() {
>         return getEndpointReference("From");
>     }
>     
>     public WsaEndpointReference getReplyTo() {
>         return getEndpointReference("ReplyTo");
>     }
>     public WsaEndpointReference getFaultTo() {
>         return getEndpointReference("FaultTo");
>     }
>     public WsaEndpointReference getRecipient() {
>         return getEndpointReference("Recipient");
>     }
>     
> 
=== message truncated ===> /* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- 
> //------100-columns-wide------>|*/
> /*
>  * Copyright (c) 2004 Extreme! Lab, Indiana University. All rights reserved.
>  *
>  * This software is open source. See the bottom of this file for the licence.
>  *
>  * $Id: WsAddressing.java,v 1.2 2004/02/12 04:10:09 aslom Exp $
>  */
> 
> package xsul.ws_addressing;
> 
> import javax.xml.namespace.QName;
> import org.xmlpull.v1.builder.XmlNamespace;
> import org.xmlpull.v1.builder.XmlPullBuilder;
> 
> /**
>  * This package contains implementation of
>  * <a href="http://www-106.ibm.com/developerworks/webservices/library/ws-add/">WS-Addressing</a>
>  * and this class contains some shared constants.
>  *
>  * @version $Revision: 1.2 $
>  * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
>  */
> public class WsAddressing {
>     private final static XmlPullBuilder builder = XmlPullBuilder.newInstance();
>     
>     public final static XmlNamespace NS = builder.newNamespace(
>         "http://schemas.xmlsoap.org/ws/2003/03/addressing");
>     public final static XmlNamespace POLICY_NS = builder.newNamespace(
>         "http://schemas.xmlsoap.org/ws/2002/12/policy");
> 
>     public final static XmlNamespace ROLE_ANONYMOUS_NS = builder.newNamespace(
>         "http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous");
> 
>     public final static QName RESPONSE_RELATIONSHIP_QNAME = new QName(
>         NS.getNamespaceName(), "Response");
> }
> 
> 
> /*
>  * Indiana University Extreme! Lab Software License, Version 1.2
>  *
>  * Copyright (C) 2004 The Trustees of Indiana University.
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions are
>  * met:
>  *
>  * 1) All redistributions of source code must retain the above
>  *    copyright notice, the list of authors in the original source
>  *    code, this list of conditions and the disclaimer listed in this
>  *    license;
>  *
>  * 2) All redistributions in binary form must reproduce the above
>  *    copyright notice, this list of conditions and the disclaimer
>  *    listed in this license in the documentation and/or other
>  *    materials provided with the distribution;
>  *
>  * 3) Any documentation included with all redistributions must include
>  *    the following acknowledgement:
>  *
>  *      "This product includes software developed by the Indiana
>  *      University Extreme! Lab.  For further information please visit
>  *      http://www.extreme.indiana.edu/"
>  *
>  *    Alternatively, this acknowledgment may appear in the software
>  *    itself, and wherever such third-party acknowledgments normally
>  *    appear.
>  *
>  * 4) The name "Indiana University" or "Indiana University
>  *    Extreme! Lab" shall not be used to endorse or promote
>  *    products derived from this software without prior written
>  *    permission from Indiana University.  For written permission,
>  *    please contact http://www.extreme.indiana.edu/.
>  *
>  * 5) Products derived from this software may not use "Indiana
>  *    University" name nor may "Indiana University" appear in their name,
>  *    without prior written permission of the Indiana University.
>  *
>  * Indiana University provides no reassurances that the source code
>  * provided does not infringe the patent or any other intellectual
>  * property rights of any other entity.  Indiana University disclaims any
>  * liability to any recipient for claims brought by any other entity
>  * based on infringement of intellectual property rights or otherwise.
>  *
>  * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH
>  * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA
>  * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT
>  * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR
>  * OTHER PROPRIETARY RIGHTS.  INDIANA UNIVERSITY MAKES NO WARRANTIES THAT
>  * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP
>  * DOORS", "WORMS", OR OTHER HARMFUL CODE.  LICENSEE ASSUMES THE ENTIRE
>  * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
>  * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING
>  * SOFTWARE.
>  */
> 
> 
> 
> 
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/