ws-addressing-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r375639 - in /webservices/addressing/trunk: src/org/apache/axis/message/addressing/ src/org/apache/axis/message/addressing/handler/ test/org/apache/ws/addressing/handler/
Date Tue, 07 Feb 2006 16:24:24 GMT
Author: gdaniels
Date: Tue Feb  7 08:24:22 2006
New Revision: 375639

URL: http://svn.apache.org/viewcvs?rev=375639&view=rev
Log:
Fix relates-to processing for W3C version (it's an IRI, not a QName).

NOTE: THIS CHANGE ALTERS THE BEHAVIOR OF "new RelatesTo(String, String)"


Modified:
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/RelatesTo.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/Relationship.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
    webservices/addressing/trunk/test/org/apache/ws/addressing/handler/ServerSideAddressingHandlerTestCase.java

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java?rev=375639&r1=375638&r2=375639&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
(original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
Tue Feb  7 08:24:22 2006
@@ -553,6 +553,18 @@
     }
 
     /**
+     * Method addRelatesTo
+     *
+     * @param uri
+     * @param type an IRI indicating the relationship type
+     * @throws URI.MalformedURIException
+     */
+    public void addRelatesTo(String uri, String type)
+            throws URI.MalformedURIException {
+        relatesTo.add(new RelatesTo(uri, type));
+    }
+
+    /**
      * Method setTo
      * 
      * @param uri

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java?rev=375639&r1=375638&r2=375639&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java (original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/Constants.java Tue
Feb  7 08:24:22 2006
@@ -69,6 +69,9 @@
     public static final String URI_NONE_W3C_CR =
             "http://www.w3.org/2005/08/addressing/none";
 
+    public static final String URI_REPLY =
+            "http://www.w3.org/2005/08/addressing/reply";
+
     /**
      * Field ENDPOINT_REFERENCE
      */

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/RelatesTo.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/RelatesTo.java?rev=375639&r1=375638&r2=375639&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/RelatesTo.java (original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/RelatesTo.java Tue
Feb  7 08:24:22 2006
@@ -82,16 +82,25 @@
     public RelatesTo(SOAPElement element)
         throws Exception {
         super();
+
+        boolean usingIRIs =
+                AddressingUtils.isW3CAddressingNamespaceURI(
+                        element.getNamespaceURI());
+
         setURI(new URI(TextExtractor.getText(element)));
         String value = element.getAttribute(Constants.RELATIONSHIP_TYPE);
         if (value != null && value.length() > 0) {
-            int pos = value.indexOf(':');
-            if (pos == -1) {
-                setType(new QName(value));
+            if (usingIRIs) {
+                setTypeIRI(value);
             } else {
-                String namespace =
-                    element.getNamespaceURI(value.substring(0, pos));
-                setType(new QName(namespace, value.substring(pos+1)));
+                int pos = value.indexOf(':');
+                if (pos == -1) {
+                    setType(new QName(value));
+                } else {
+                    String namespace =
+                            element.getNamespaceURI(value.substring(0, pos));
+                    setType(new QName(namespace, value.substring(pos+1)));
+                }
             }
         } else {
             setType(AddressingUtils.getResponseRelationshipType());
@@ -113,9 +122,14 @@
             (SOAPHeaderElement)header.addHeaderElement(nm);
         headerElement.setActor(actorURI);
 
+        String typeIRI = getTypeIRI();
         QName type = getType();
 
-        if (type != null) {
+        if (typeIRI != null) {
+            headerElement.addAttribute("",
+                                       Constants.RELATIONSHIP_TYPE,
+                                       typeIRI);
+        } else if (type != null) {
             headerElement.addAttribute("", Constants.RELATIONSHIP_TYPE, type);
         }
         

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/Relationship.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/Relationship.java?rev=375639&r1=375638&r2=375639&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/Relationship.java
(original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/Relationship.java
Tue Feb  7 08:24:22 2006
@@ -49,6 +49,9 @@
      */
     private QName type;
 
+    /** Relationship type as per W3C CR version */
+    private String typeIRI;
+
     /**
      * Constructor Relationship
      * 
@@ -58,7 +61,8 @@
      */
     public Relationship(String uri, String type) 
         throws URI.MalformedURIException {
-        this(new URI(uri), new QName(type));
+        this.typeIRI = type;
+        this.uri = new URI(uri);
     }
 
     /**
@@ -114,6 +118,14 @@
      */
     public void setURI(URI uri) {
         this.uri = uri;
+    }
+
+    public String getTypeIRI() {
+        return typeIRI;
+    }
+
+    public void setTypeIRI(String typeIRI) {
+        this.typeIRI = typeIRI;
     }
 }
 

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java?rev=375639&r1=375638&r2=375639&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
(original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
Tue Feb  7 08:24:22 2006
@@ -185,8 +185,12 @@
         // process RelatesTo
         MessageID msgID = reqHeaders.getMessageID();
         if (msgID != null) {
-            resHeaders.addRelatesTo(msgID.toString(),
-                                    AddressingUtils.getResponseRelationshipType());
+            if (reqHeaders.isW3CVersion) {
+                resHeaders.addRelatesTo(msgID.toString(), Constants.URI_REPLY);
+            } else {
+                resHeaders.addRelatesTo(msgID.toString(),
+                                        AddressingUtils.getResponseRelationshipType());
+            }
         }
 
         // process MessageID
@@ -531,8 +535,12 @@
         // process RelatesTo
         MessageID msgID = reqHeaders.getMessageID();
         if (msgID != null) {
-            resHeaders.addRelatesTo(msgID.toString(),
-                                    AddressingUtils.getResponseRelationshipType());
+            if (reqHeaders.isW3CVersion) {
+                resHeaders.addRelatesTo(msgID.toString(), Constants.URI_REPLY);
+            } else {
+                resHeaders.addRelatesTo(msgID.toString(),
+                                        AddressingUtils.getResponseRelationshipType());
+            }
         }
 
         // process MessageID

Modified: webservices/addressing/trunk/test/org/apache/ws/addressing/handler/ServerSideAddressingHandlerTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/test/org/apache/ws/addressing/handler/ServerSideAddressingHandlerTestCase.java?rev=375639&r1=375638&r2=375639&view=diff
==============================================================================
--- webservices/addressing/trunk/test/org/apache/ws/addressing/handler/ServerSideAddressingHandlerTestCase.java
(original)
+++ webservices/addressing/trunk/test/org/apache/ws/addressing/handler/ServerSideAddressingHandlerTestCase.java
Tue Feb  7 08:24:22 2006
@@ -71,7 +71,7 @@
         checkMessageIdHeader(addrHeaders, "aaaabbbb-cccc-dddd-eeee-ffffffffffff");
 //        checkRelatesToHeader(addrHeaders, new RelatesTo[]{new RelatesTo("uuid:11112222-3333-4444-5555-666666666666",
"{urn:testNS}testPart"),
 //                                                          new RelatesTo("uuid:11112222-3333-4444-5555-999999999999",
AddressingUtils.getResponseRelationshipType().toString())});
-        checkRelatesToHeader(addrHeaders, new RelatesTo[]{new RelatesTo("uuid:11112222-3333-4444-5555-666666666666",
"{urn:testNS}testPart")});
+        checkRelatesToHeader(addrHeaders, new RelatesTo[]{new RelatesTo("uuid:11112222-3333-4444-5555-666666666666",
new QName("urn:testNS", "testPart"))});
         ReplyTo expectedReplyTo = new ReplyTo(new Address(AddressingUtils.getAnonymousRoleURI()));
         expectedReplyTo.setPortType(new PortType("urn:Foo", "Test"));
         expectedReplyTo.setServiceName(new ServiceNameType("urn:Bar", "Test2"));
@@ -103,7 +103,7 @@
         AddressingHeaders addrHeaders = (AddressingHeaders) prop;
         assertFalse(addrHeaders.isSetMustUnderstand());
         checkMessageIdHeader(addrHeaders, null);
-        checkRelatesToHeader(addrHeaders, new RelatesTo[]{new RelatesTo("uuid:aaaabbbb-cccc-dddd-eeee-ffffffffffff",
AddressingUtils.getResponseRelationshipType().toString())});
+        checkRelatesToHeader(addrHeaders, new RelatesTo[]{new RelatesTo("uuid:aaaabbbb-cccc-dddd-eeee-ffffffffffff",
AddressingUtils.getResponseRelationshipType())});
         checkReplyToHeader(addrHeaders, null);
         checkFaultToHeader(addrHeaders, null);
         checkToHeader(addrHeaders, new To(AddressingUtils.getAnonymousRoleURI()));



---------------------------------------------------------------------
To unsubscribe, e-mail: addressing-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: addressing-dev-help@ws.apache.org


Mime
View raw message