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/04/02 15:37:11 UTC
cvs commit: ws-fx/addressing/test/addressing TestSerDeser.java
dims 2004/04/02 05:37:11
Modified: addressing/src/org/apache/axis/message/addressing
AttributedURI.java
addressing/src/org/apache/axis/message/addressing/handler
AddressingHandler.java
addressing/test/addressing TestSerDeser.java
Log:
2 patches from "SJ" <os...@yahoo.com>
Notes from his email:
- In a previous patch I submitted, a bug was inadvertently issued. Removing existing headers using SOAPHeaderElement.extractHeaderElements(String) does not do what I intended to do. Here is a fix patch (and a test that checks that).
- WS-Addressing handler while processing reply messages, do not set a 'To' header if no Reply-To was specified in the incoming message. This is a violation of the spec since To header elements are mandatory in WS-Addressing messages. The patch fixes this.
Revision Changes Path
1.6 +18 -1 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AttributedURI.java 29 Mar 2004 06:43:02 -0000 1.5
+++ AttributedURI.java 2 Apr 2004 13:37:10 -0000 1.6
@@ -26,6 +26,7 @@
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPHeaderElement;
import javax.xml.soap.Name;
+import java.util.*;
import org.w3c.dom.Element;
@@ -82,7 +83,23 @@
// remove the header elements of this name if they
// already exist
- header.extractHeaderElements(name);
+ Iterator headers = header.getChildElements();
+ List existingElements = new ArrayList();
+ while (headers.hasNext())
+ {
+ SOAPHeaderElement hElement = (SOAPHeaderElement) headers.next();
+ if (hElement.getLocalName().equals(name))
+ {
+ existingElements.add(hElement);
+ }
+
+ }
+ for (int i = 0; i < existingElements.size(); i++)
+ {
+ SOAPHeaderElement el = (SOAPHeaderElement) existingElements.get(i);
+ el.detachNode();
+ }
+
// add the new header element
SOAPHeaderElement headerElement = header.addHeaderElement(nm);
1.6 +5 -0 ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
Index: AddressingHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AddressingHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AddressingHandler.java 26 Mar 2004 16:15:05 -0000 1.5
+++ AddressingHandler.java 2 Apr 2004 13:37:10 -0000 1.6
@@ -172,6 +172,11 @@
// set To
resheaders.setTo(new To(replyToStr));
}
+ else {
+ // if no reply-to was set in incoming message
+ // add a to address that indicates anonymous
+ resheaders.setTo(new To(Constants.NS_URI_ANONYMOUS));
+ }
MessageID msgID = null;
1.6 +11 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestSerDeser.java 29 Mar 2004 06:43:02 -0000 1.5
+++ TestSerDeser.java 2 Apr 2004 13:37:10 -0000 1.6
@@ -233,6 +233,17 @@
}
assertEquals(count, 1);
+
+ headers = env.getHeadersByName(
+ Constants.NS_URI_ADDRESSING, "To", true);
+ count = 0;
+ while (headers.hasMoreElements())
+ {
+ headers.nextElement();
+ count++;
+ }
+
+ assertEquals(count, 1);
}