cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1023809 - in /cxf/branches/2.2.x-fixes: ./ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java
Date Mon, 18 Oct 2010 14:13:21 GMT
Author: dkulp
Date: Mon Oct 18 14:13:20 2010
New Revision: 1023809

URL: http://svn.apache.org/viewvc?rev=1023809&view=rev
Log:
Merged revisions 1021707 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes

........
  r1021707 | ema | 2010-10-12 05:32:38 -0400 (Tue, 12 Oct 2010) | 1 line
  
  [CXF-3060]:Made the AddressingFeature(true,true) work when the wsa policy is not enforced
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1023809&r1=1023808&r2=1023809&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Mon Oct 18 14:13:20 2010
@@ -545,6 +545,38 @@ public class MAPAggregator extends Abstr
                 && !getWSAddressingFeature(message).isAddressingRequired()) {
                 assertAddressing(message);
             }
+            //CXF-3060 :If wsa policy is not enforced, AddressingProperties map is null and
+            // AddressingFeature.isRequired, requestor checks inbound message and throw exception
+            if (null == theMaps
+                && !ContextUtils.isOutbound(message) 
+                && ContextUtils.isRequestor(message)
+                && getWSAddressingFeature(message) != null
+                && getWSAddressingFeature(message).isAddressingRequired()) {
+                boolean missingWsaHeader = false;
+                AssertionInfoMap aim = message.get(AssertionInfoMap.class);
+                if (aim == null || aim.size() == 0) {
+                    missingWsaHeader = true;
+                }
+                if (aim != null && aim.size() > 0) {
+                    missingWsaHeader = true;
+                    QName[] types = new QName[] {
+                        MetadataConstants.ADDRESSING_ASSERTION_QNAME,
+                        MetadataConstants.USING_ADDRESSING_2004_QNAME,
+                        MetadataConstants.USING_ADDRESSING_2005_QNAME,
+                        MetadataConstants.USING_ADDRESSING_2006_QNAME
+                    };
+                    for (QName type : types) {
+                        if (aim.containsKey(type) && aim.get(type).size() > 0)
{
+                            missingWsaHeader = false;
+                        }
+                    }
+                }
+                if (missingWsaHeader) {
+                    String reason = BUNDLE.getString("MISSING_ACTION_MESSAGE");
+                    throw new SoapFault(reason, new QName(Names.WSA_NAMESPACE_NAME,
+                                                          Names.HEADER_REQUIRED_NAME));
+                }
+            }
         }
         return continueProcessing;
     }

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java?rev=1023809&r1=1023808&r2=1023809&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/WSADisableTest.java
Mon Oct 18 14:13:20 2010
@@ -117,6 +117,25 @@ public class WSADisableTest extends Abst
             //expected
         }
     }
+    
+    //CXF-3060
+    @Test
+    public void testDisableServerEnableClientRequired() throws Exception {
+        AddNumbersPortType port = getService().getAddNumbersPort(new AddressingFeature(true,
true));
+
+        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                                                        "http://localhost:" + PORT + "/jaxws/add");
+        try {
+            port.addNumbers(1, 2);
+            fail("Expected missing WSA header exception");
+        } catch (Exception e) {
+            String expected = "A required header representing a Message Addressing"
+                              + " Property is not present";
+            assertTrue("Caught unexpected exception : " + e.getMessage(),
+                       e.getMessage().indexOf(expected) > -1);
+        }
+    }
+    
 
     private AddNumbersService getService() {
         URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");



Mime
View raw message