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 gd...@apache.org on 2006/03/06 19:36:02 UTC

svn commit: r383613 - in /webservices/addressing/trunk/src/org/apache/axis/message/addressing: AddressingHeaderFault.java AddressingHeaders.java AddressingVersion.java AttributedURI.java handler/AddressingHandler.java

Author: gdaniels
Date: Mon Mar  6 10:35:57 2006
New Revision: 383613

URL: http://svn.apache.org/viewcvs?rev=383613&view=rev
Log:
More fixes for W3C CR version + test suite.

Added:
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaderFault.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingVersion.java
Modified:
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/AttributedURI.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java

Added: webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaderFault.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaderFault.java?rev=383613&view=auto
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaderFault.java (added)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaderFault.java Mon Mar  6 10:35:57 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.axis.message.addressing;
+
+import org.apache.axis.AxisFault;
+
+import javax.xml.namespace.QName;
+
+public class AddressingHeaderFault extends AxisFault {
+    private static QName INVALID_ADDRESSING_HEADER =
+            new QName(Constants.NS_URI_ADDRESSING_2005_08,
+                      "InvalidAddressingHeader");
+
+    public static QName INVALID_ADDRESS =
+            new QName(Constants.NS_URI_ADDRESSING_2005_08,
+                      "InvalidAddress");
+    public static QName INVALID_EPR =
+            new QName(Constants.NS_URI_ADDRESSING_2005_08,
+                      "InvalidEPR");
+    public static QName MISSING_ADDRESS =
+            new QName(Constants.NS_URI_ADDRESSING_2005_08,
+                      "MissingAddressInEPR");
+    public static QName DUPLICATE_MSGID =
+            new QName(Constants.NS_URI_ADDRESSING_2005_08,
+                      "DuplicateMessageID");
+    public static QName ACTION_MISMATCH =
+            new QName(Constants.NS_URI_ADDRESSING_2005_08,
+                      "ActionMismatch");
+
+    public AddressingHeaderFault(QName subCode, String faultString) {
+        super(org.apache.axis.Constants.FAULT_SOAP12_SENDER,
+              new QName [] { INVALID_ADDRESSING_HEADER, subCode },
+              faultString,
+              null, null, null);
+    }
+
+    public AddressingHeaderFault(String faultString) {
+        super(org.apache.axis.Constants.FAULT_SOAP12_SENDER,
+              new QName [] { INVALID_ADDRESSING_HEADER },
+              faultString,
+              null, null, null);
+    }
+}

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=383613&r1=383612&r2=383613&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 Mon Mar  6 10:35:57 2006
@@ -101,6 +101,11 @@
     private boolean setMustUnderstand = false;
 
     /**
+     * If there is a fault while building the headers, it gets put here.
+     */
+    private AddressingHeaderFault addrHeaderFault = null;
+
+    /**
      * Constructor AddressingHeaders
      */
     public AddressingHeaders() {
@@ -242,9 +247,10 @@
                     messageID = new MessageID(headerElement);
                 } else if (localName.equals(Constants.TO)) {
                     if (to != null) {
-                        throw new AxisFault("Client.duplicateToHeader",
-                                            "duplicate To header",
-                                            null, null);
+                        addrHeaderFault =
+                                new AddressingHeaderFault(
+                                        "duplicate To header"
+                                );
                     }
                     to = new To(headerElement);
                 } else if (localName.equals(Constants.ACTION)) {
@@ -260,33 +266,36 @@
                     }
 
                     if (action != null) {
-                        throw new AxisFault("Client.duplicateActionHeader",
-                                            "duplicate Action header",
-                                            null, null);
+                        addrHeaderFault =
+                                new AddressingHeaderFault(
+                                        "duplicate Action header"
+                                );
                     }
-            	    URI unspecified = new org.apache.axis.types.URI(
+
+                    URI unspecified = new org.apache.axis.types.URI(
                             TextExtractor.getText(headerElement),
                             permitParseNonSpecificAction);
             	    action = new Action(new URI(unspecified));
                 } else if (localName.equals(Constants.FROM)) {
                     if (from != null) {
-                        throw new AxisFault("Client.duplicateFromHeader",
-                                            "duplicate From header",
-                                            null, null);
+                        addrHeaderFault =
+                                new AddressingHeaderFault(
+                                        "duplicate From header"
+                                );
                     }
                     from = new From(headerElement);
                 } else if (localName.equals(Constants.REPLY_TO)) {
                     if (replyTo != null) {
-                        throw new AxisFault("Client.duplicateReplyToHeader",
-                                            "duplicate ReplyTo header",
-                                            null, null);
+                        addrHeaderFault =
+                                new AddressingHeaderFault(
+                                        "duplicate ReplyTo header"
+                                );
                     }
                     replyTo = new ReplyTo(headerElement);
                 } else if (localName.equals(Constants.FAULT_TO)) {
                     if (faultTo != null) {
-                        throw new AxisFault("Client.duplicateFaultToHeader",
-                                            "more than one FaultTo header",
-                                            null, null);
+                        addrHeaderFault = new AddressingHeaderFault(
+                                "more than one FaultTo header");
                     }
                     faultTo = new FaultTo(headerElement);
                 } else if (localName.equals(Constants.RECIPIENT)) {
@@ -451,7 +460,7 @@
                                         AddressingUtils.getAddressingNamespaceURI());
         }
 
-        AddressingUtils.removeHeaders(env.getHeader(), actorURI);
+//        AddressingUtils.removeHeaders(env.getHeader(), actorURI);
 
         SOAPHeaderElement header;
 
@@ -708,5 +717,9 @@
 
     public void setSetMustUnderstand(boolean setMustUnderstand) {
         this.setMustUnderstand = setMustUnderstand;
+    }
+
+    public AxisFault getAddrHeaderFault() {
+        return addrHeaderFault;
     }
 }

Added: webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingVersion.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingVersion.java?rev=383613&view=auto
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingVersion.java (added)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingVersion.java Mon Mar  6 10:35:57 2006
@@ -0,0 +1,23 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.axis.message.addressing;
+
+public interface AddressingVersion {
+    public String getAnonymousURI();
+    public String getNamespace();
+}

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/AttributedURI.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/AttributedURI.java?rev=383613&r1=383612&r2=383613&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/AttributedURI.java (original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/AttributedURI.java Mon Mar  6 10:35:57 2006
@@ -61,7 +61,7 @@
      * @throws MalformedURIException 
      */
     public AttributedURI(String uri) throws MalformedURIException {
-        this(new URI(uri));
+        this(new URI(uri.trim()));
     }
 
     /**
@@ -78,7 +78,7 @@
      */
     public AttributedURI(SOAPHeaderElement el) 
         throws Exception {
-        super(new URI(TextExtractor.getText(el)));
+        super(new URI(TextExtractor.getText(el).trim()));
     }
 
     /**

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=383613&r1=383612&r2=383613&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 Mon Mar  6 10:35:57 2006
@@ -222,14 +222,14 @@
                 if (uri != null &&
                         !uri.equals(AddressingUtils.getAnonymousRoleURI())) {
                     // send the msg to fault to
-                    forwardMessage(faultTo, msg);
+                    if (!uri.equals(Constants.URI_NONE_W3C_CR)) {
+                        forwardMessage(faultTo, msg);
+                    }
                     // Somehow make the response empty, or create a new empty
                     // response
                     /** Fix Sonic00027691 avoid NullPointerException with msgContext.setCurrentMessage(null)*/
-                    if (msgContext.getPastPivot())
-                        msgContext.setResponseMessage(null);
-                    else
-                        msgContext.setRequestMessage(null);
+                    msgContext.setResponseMessage(null);
+                    msgContext.setProperty("axis.DontEmitFault", Boolean.TRUE);
                     return;
                 }
             }
@@ -391,6 +391,8 @@
                                   this.allowNonSpecificActions,
                                   this.refPropQNames);
 
+        AxisFault fault = headers.getAddrHeaderFault();
+
         if (headers.getAction()==null)
         {
             // should we throw a SOAPFaultException here?
@@ -399,6 +401,10 @@
 
         msgContext.setProperty(Constants.ENV_ADDRESSING_REQUEST_HEADERS,
                                headers);
+
+        if (fault != null) {
+            throw fault;
+        }
 
         // set the target service based on To header if it hasn't already
         // been determined.  NOTE: May want to add an option to override



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