cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r948155 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/ws-specs/src/test...
Date Tue, 25 May 2010 18:32:15 GMT
Author: dkulp
Date: Tue May 25 18:32:14 2010
New Revision: 948155

URL: http://svn.apache.org/viewvc?rev=948155&view=rev
Log:
Merged revisions 947793 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r947793 | dkulp | 2010-05-24 16:28:52 -0400 (Mon, 24 May 2010) | 2 lines
  
  Add some validation when only anonymous or only non-anonymous addressing
  it required.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
    cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
    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/AddNumberImpl.java
    cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java
    cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java
    cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
    cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Tue May 25 18:32:14 2010
@@ -622,7 +622,6 @@ public class ServiceImpl extends Service
         }
         Dispatch<T> disp = new DispatchImpl<T>(client, mode, type);
         configureObject(disp);
-
         return disp;
     }
     

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
Tue May 25 18:32:14 2010
@@ -278,6 +278,7 @@ public class JaxWsEndpointImpl extends E
                     DescriptionInfo description = new DescriptionInfo();
                     description.setName(bindingInfo.getService().getName());
                     bindingInfo.getService().setDescription(description);
+                    bindingInfo.setDescription(description);
                 }
                 bindingInfo.getService().getDescription().addExtensor(uel);
                 
@@ -354,6 +355,8 @@ public class JaxWsEndpointImpl extends E
             feature.setAddressingRequired(addressing.isRequired());
         } else {
             removeAddressingFeature();
+            getEndpointInfo().setProperty("org.apache.cxf.ws.addressing.MAPAggregator.addressingDisabled",
+                                          Boolean.TRUE);
         }
     }
     

Modified: cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
Tue May 25 18:32:14 2010
@@ -345,6 +345,7 @@ public final class ContextUtils {
     public static void rebaseResponse(EndpointReferenceType reference,
                                       AddressingProperties inMAPs,
                                       final Message inMessage) {
+        
         String namespaceURI = inMAPs.getNamespaceURI();
         if (!retrievePartialResponseSent(inMessage)) {
             storePartialResponseSent(inMessage);

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=948155&r1=948154&r2=948155&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
Tue May 25 18:32:14 2010
@@ -44,6 +44,7 @@ import org.apache.cxf.interceptor.OneWay
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.FaultMode;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -66,6 +67,9 @@ import org.apache.cxf.ws.policy.Assertio
  */
 public class MAPAggregator extends AbstractPhaseInterceptor<Message> {
     public static final String USING_ADDRESSING = MAPAggregator.class.getName() + ".usingAddressing";
+    public static final String ADDRESSING_DISABLED = MAPAggregator.class.getName() + ".addressingDisabled";
+    public static final String DECOUPLED_DESTINATION = MAPAggregator.class.getName() 
+        + ".decoupledDestination";
 
     private static final Logger LOG = 
         LogUtils.getL7dLogger(MAPAggregator.class);
@@ -156,7 +160,29 @@ public class MAPAggregator extends Abstr
      * @param message the current message
      */
     public void handleMessage(Message message) {
-        mediate(message, ContextUtils.isFault(message));
+        if (!MessageUtils.getContextualBoolean(message, ADDRESSING_DISABLED, false)) {
+            mediate(message, ContextUtils.isFault(message));
+        } else {
+            //addressing is completely disabled manually, we need to assert the
+            //assertions as the user is in control of those
+            AssertionInfoMap aim = message.get(AssertionInfoMap.class);
+            if (null == aim) {
+                return;
+            }
+            QName[] types = new QName[] {
+                MetadataConstants.ADDRESSING_ASSERTION_QNAME,
+                MetadataConstants.USING_ADDRESSING_2004_QNAME,
+                MetadataConstants.USING_ADDRESSING_2005_QNAME,
+                MetadataConstants.USING_ADDRESSING_2006_QNAME,
+                MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME,
+                MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME,
+                MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705,
+                MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705
+            };
+            for (QName type : types) {
+                assertAssertion(aim, type);
+            }
+        }
     }
 
     /**
@@ -278,12 +304,21 @@ public class MAPAggregator extends Abstr
      * Policies.
      * @param message the current message
      */
-    private void assertAddressing(Message message, boolean anonymous) {
+    private void assertAddressing(Message message, 
+                                  EndpointReferenceType replyTo, 
+                                  EndpointReferenceType faultTo) {
         AssertionInfoMap aim = message.get(AssertionInfoMap.class);
         if (null == aim) {
             return;
-            
         }
+        if (faultTo == null) {
+            faultTo = replyTo;
+        }
+        boolean anonReply = ContextUtils.isGenericAddress(replyTo);
+        boolean anonFault = ContextUtils.isGenericAddress(faultTo);
+        boolean onlyAnonymous = anonReply && anonFault;
+        boolean hasAnonymous = anonReply || anonFault;
+        
         QName[] types = new QName[] {
             MetadataConstants.ADDRESSING_ASSERTION_QNAME,
             MetadataConstants.USING_ADDRESSING_2004_QNAME,
@@ -294,14 +329,44 @@ public class MAPAggregator extends Abstr
         for (QName type : types) {
             assertAssertion(aim, type);
             if (type.equals(MetadataConstants.ADDRESSING_ASSERTION_QNAME)) {
-                if (anonymous) {
+                if (onlyAnonymous) {
                     assertAssertion(aim, MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
-                } else {
+                } else if (!hasAnonymous) {
                     assertAssertion(aim, MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
                 }        
+            } else if (type.equals(MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705)) {
+                if (onlyAnonymous) {
+                    assertAssertion(aim, MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705);
+                } else if (!hasAnonymous) {
+                    assertAssertion(aim, MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705);
+                }        
+            }
+        }
+        if (!MessageUtils.isRequestor(message) && !MessageUtils.isOutbound(message))
{
+            //need to throw an appropriate fault for these
+            Collection<AssertionInfo> aicNonAnon
+                = aim.getAssertionInfo(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
+            Collection<AssertionInfo> aicNonAnon2
+                = aim.getAssertionInfo(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705);
+            Collection<AssertionInfo> aicAnon
+                = aim.getAssertionInfo(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
+            Collection<AssertionInfo> aicAnon2
+                = aim.getAssertionInfo(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705);
+            boolean hasAnon = (aicAnon != null && !aicAnon.isEmpty()) 
+                        || (aicAnon2 != null && !aicAnon2.isEmpty());
+            boolean hasNonAnon = (aicNonAnon != null && !aicNonAnon.isEmpty()) 
+                        || (aicNonAnon2 != null && !aicNonAnon2.isEmpty());
+                
+            if (hasAnonymous && hasNonAnon && !hasAnon) {
+                throw new SoapFault("Found anonymous address but non-anonymous required",
+                                    new QName(Names.WSA_NAMESPACE_NAME,
+                                              "OnlyNonAnonymousAddressSupported"));
+            } else if (!onlyAnonymous && !hasNonAnon && hasAnon) {
+                throw new SoapFault("Found non-anonymous address but only anonymous supported",
+                                    new QName(Names.WSA_NAMESPACE_NAME,
+                                              "OnlyAnonymousAddressSupported"));
             }
         }
-        
         
     }
 
@@ -343,21 +408,39 @@ public class MAPAggregator extends Abstr
                 // request/response MAPs must be aggregated
                 aggregate(message, isFault);
             }
+            AddressingPropertiesImpl theMaps = 
+                ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
+            if (null != theMaps && ContextUtils.isRequestor(message)) {         
  
+                assertAddressing(message, 
+                                 theMaps.getReplyTo(),
+                                 theMaps.getFaultTo());
+            }
         } else if (!ContextUtils.isRequestor(message)) {            
             //responder validates incoming MAPs
             AddressingPropertiesImpl maps = getMAPs(message, false, false);
+            if (maps != null) {
+                assertAddressing(message, 
+                                 maps.getReplyTo(),
+                                 maps.getFaultTo());
+            }
             boolean isOneway = message.getExchange().isOneWay();
             if (null == maps && !addressingRequired) {
                 return false;
             }
             continueProcessing = validateIncomingMAPs(maps, message);
             if (maps != null) {
+                AddressingPropertiesImpl theMaps = 
+                    ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
+                if (null != theMaps) {            
+                    assertAddressing(message, theMaps.getReplyTo(), theMaps.getFaultTo());
+                }
+
                 if (isOneway
                     || !ContextUtils.isGenericAddress(maps.getReplyTo())) {
                     ContextUtils.rebaseResponse(maps.getReplyTo(),
                                                 maps,
                                                 message);
-                }
+                } 
                 if (!isOneway) {
                     // ensure the inbound MAPs are available in both the full & fault
                     // response messages (used to determine relatesTo etc.)
@@ -377,11 +460,12 @@ public class MAPAggregator extends Abstr
                                     new QName(Names.WSA_NAMESPACE_NAME,
                                               ContextUtils.retrieveMAPFaultName(message)));
             }
-        }
-        AddressingPropertiesImpl theMaps = 
-            ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
-        if (null != theMaps) {            
-            assertAddressing(message, ContextUtils.isGenericAddress(theMaps.getReplyTo()));
+        } else {
+            AddressingPropertiesImpl theMaps = 
+                ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
+            if (null != theMaps) {            
+                assertAddressing(message, theMaps.getReplyTo(), theMaps.getFaultTo());
+            }
         }
         return continueProcessing;
     }

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/AddNumberImpl.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/AddNumberImpl.java?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/AddNumberImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_disable/AddNumberImpl.java
Tue May 25 18:32:14 2010
@@ -35,6 +35,7 @@ import org.apache.cxf.systest.ws.addr_fe
 
 @Addressing(enabled = false)
 @WebService(serviceName = "AddNumbersService",
+            portName = "AddNumbersPort",
             targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/")
 public class AddNumberImpl implements AddNumbersPortType {
     public int addNumbers(int number1, int number2) throws AddNumbersFault_Exception {

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.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_fromwsdl/AddNumberImpl.java?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java
Tue May 25 18:32:14 2010
@@ -32,8 +32,7 @@ import org.apache.cxf.systest.ws.addr_fe
 
 // Jax-WS 2.1 WS-Addressing FromWsdl
 
-@WebService(serviceName = "AddNumbersService",
-            targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/")
+@WebService()
 public class AddNumberImpl implements AddNumbersPortType {
     public int addNumbers(int number1, int number2) throws AddNumbersFault_Exception {
         return execute(number1, number2);

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.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_fromwsdl/Server.java?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/Server.java
Tue May 25 18:32:14 2010
@@ -20,18 +20,60 @@
 package org.apache.cxf.systest.ws.addr_fromwsdl;
 
 
+import javax.jws.WebService;
+
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.ws.addressing.WSAddressingFeature;
 
 public class Server extends AbstractBusTestServerBase {
-
+    @WebService(serviceName = "AddNumbersService",
+                portName = "AddNumbersPort",
+                targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/")
+    public static class AddNumberReg extends AddNumberImpl implements AddNumbersPortType
{
+        
+    }
+    @WebService(serviceName = "AddNumbersService",
+                portName = "AddNumbersNonAnonPort",
+                targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/")
+    public static class AddNumberNonAnon extends AddNumberImpl implements AddNumbersPortType
{
+        
+    }
+    @WebService(serviceName = "AddNumbersService",
+                portName = "AddNumbersOnlyAnonPort",
+                targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/")
+    public static class AddNumberOnlyAnon extends AddNumberImpl implements AddNumbersPortType
{
+        
+    }
     protected void run()  {    
-        Object implementor = new AddNumberImpl();
+        Object implementor = new AddNumberReg();
         String address = "http://localhost:9091/jaxws/add";
+        EndpointImpl ep;
+        ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), 
+                                           implementor, 
+                                           null, 
+                                           getWsdl());
+
+        ep.getFeatures().add(new WSAddressingFeature());
+        ep.publish(address);
+
+        implementor = new AddNumberNonAnon();
+        address = "http://localhost:9091/jaxws/addNonAnon";
+        
+        ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), 
+                                           implementor, 
+                                           null, 
+                                           getWsdl());
+
+        ep.getFeatures().add(new WSAddressingFeature());
+        ep.publish(address);
+
+        implementor = new AddNumberOnlyAnon();
+        address = "http://localhost:9091/jaxws/addAnon";
         
-        EndpointImpl ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), 
+        ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), 
                                            implementor, 
                                            null, 
                                            getWsdl());

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.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_fromwsdl/WSAFromWSDLTest.java?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
Tue May 25 18:32:14 2010
@@ -22,12 +22,18 @@ package org.apache.cxf.systest.ws.addr_f
 import java.io.ByteArrayOutputStream;
 import java.net.URL;
 import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.cxf.systest.ws.AbstractWSATestBase;
 import org.apache.cxf.systest.ws.addr_feature.AddNumbersFault_Exception;
 import org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType;
 import org.apache.cxf.systest.ws.addr_feature.AddNumbersService;
+import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -145,7 +151,43 @@ public class WSAFromWSDLTest extends Abs
         assertTrue(output.toString().indexOf(expectedOut) != -1);
         assertTrue(input.toString().indexOf(expectedIn) != -1);
     }
+    
+    @Test
+    public void testAnonToNonAnon() throws Exception {
+        AddNumbersPortType port = getPort();
+        ((BindingProvider)port).getRequestContext()
+            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                 "http://localhost:9091/jaxws/addNonAnon");
+        try {
+            port.addNumbers3(-1, 2);
+        } catch (SOAPFaultException e) {
+            assertTrue(e.getFault().getFaultCode().contains("OnlyNonAnonymousAddressSupported"));
+        }
+    } 
+    @Test
+    public void testNonAnonToAnon() throws Exception {
+        AddNumbersPortType port = getPort();
+        ((BindingProvider)port).getRequestContext()
+            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                 "http://localhost:9091/jaxws/addAnon");
+        
+        AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
+        EndpointReferenceType ref = new EndpointReferenceType();
+        AttributedURIType add = new AttributedURIType();
+        add.setValue("http://localhost:9095/not/a/real/url");
+        ref.setAddress(add);
+        maps.setReplyTo(ref);
+        maps.setFaultTo(ref);
 
+        ((BindingProvider)port).getRequestContext()
+            .put("javax.xml.ws.addressing.context", maps);
+
+        try {
+            port.addNumbers3(-1, 2);
+        } catch (SOAPFaultException e) {
+            assertTrue(e.getFault().getFaultCode().contains("OnlyAnonymousAddressSupported"));
+        }
+    }
     private AddNumbersPortType getPort() {
         URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
         assertNotNull("WSDL is null", wsdl);

Modified: cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl?rev=948155&r1=948154&r2=948155&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl
(original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl
Tue May 25 18:32:14 2010
@@ -1,144 +1,251 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-<definitions name="AddNumbers"  
-	     targetNamespace="http://apache.org/cxf/systest/ws/addr_feature/" 
-	     xmlns:tns="http://apache.org/cxf/systest/ws/addr_feature/"
-	     xmlns="http://schemas.xmlsoap.org/wsdl/" 
-	     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-	     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
-	     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
-	     xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
-	     xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
-    <types>
-	<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" 
-		    elementFormDefault="qualified" 
-		    targetNamespace="http://apache.org/cxf/systest/ws/addr_feature/">
-	    <complexType name="addNumbersResponse">
-		<sequence>
-		    <element name="return" type="xsd:int" />
-		</sequence>
-	    </complexType>
-	    <element name="addNumbersResponse" type="tns:addNumbersResponse" />
-	    <element name="addNumbers2Response" type="tns:addNumbersResponse" />
-	    <element name="addNumbers3Response" type="tns:addNumbersResponse" />
-
-	    <complexType name="addNumbers">
-		<sequence>
-		    <element name="number1" type="xsd:int" />
-		    <element name="number2" type="xsd:int" />
-		</sequence>
-	    </complexType>
-	    <element name="addNumbers" type="tns:addNumbers" />
-	    <element name="addNumbers2" type="tns:addNumbers" />
-	    <element name="addNumbers3" type="tns:addNumbers" />
-
-	    <element name="AddNumbersFault" type="tns:AddNumbersFault" />
-	    <complexType name="AddNumbersFault">
-		<sequence>
-		    <element name="detail" type="xsd:string" />
-		    <element name="message" type="xsd:string" />
-		</sequence>
-	    </complexType>
-	</xsd:schema>
-    </types>
-    <message name="addNumbers">
-	<part name="parameters" element="tns:addNumbers" />
-    </message>
-    <message name="addNumbersResponse">
-	<part name="result" element="tns:addNumbersResponse" />
-    </message>
-    <message name="addNumbersFault">
-	<part name="AddNumbersFault" element="tns:AddNumbersFault" />
-    </message>
-    <message name="addNumbers2">
-	<part name="parameters" element="tns:addNumbers2" />
-    </message>
-    <message name="addNumbers2Response">
-	<part name="result" element="tns:addNumbers2Response" />
-    </message>
-    <message name="addNumbers3">
-	<part name="parameters" element="tns:addNumbers3" />
-    </message>
-    <message name="addNumbers3Response">
-	<part name="result" element="tns:addNumbers3Response" />
-    </message>
-    <portType name="AddNumbersPortType">
-	<operation name="addNumbers">
-	    <input message="tns:addNumbers"/>
-	    <output message="tns:addNumbersResponse"/>
-	    <fault name="addNumbersFault" message="tns:addNumbersFault"/>
-	</operation>
-	<operation name="addNumbers2">
-	    <input message="tns:addNumbers2" name="add2In"/>
-	    <output message="tns:addNumbers2Response" name="add2Out"/>
-<!-- 	    <fault name="addNumbersFault" message="tns:addNumbersFault"/> -->
-	</operation>
-	<operation name="addNumbers3">
-	    <input message="tns:addNumbers3" wsam:Action="3in"/>
-	    <output message="tns:addNumbers3Response" wsam:Action="3out"/>
-	    <fault name="addNumbersFault" message="tns:addNumbersFault" wsam:Action="3fault"/>
-	</operation>
-    </portType>
-    <binding name="AddNumbersBinding" type="tns:AddNumbersPortType">
-	<wsaw:UsingAddressing wsdl:required="false" />
-	<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
-	<operation name="addNumbers">
-	    <soap:operation soapAction="" />
-	    <input>
-		<soap:body use="literal" />
-	    </input>
-	    <output>
-		<soap:body use="literal" />
-	    </output>
-	    <fault name="addNumbersFault">
-		<soap:fault name="addNumbersFault" use="literal" />
-	    </fault>
-	</operation>
-	<operation name="addNumbers2">
-	    <soap:operation soapAction="" />
-	    <input>
-		<soap:body use="literal" />
-	    </input>
-	    <output>
-		<soap:body use="literal" />
-	    </output>
-<!-- 	    <fault name="addNumbersFault"> -->
-<!-- 		<soap:fault name="addNumbersFault" use="literal" /> -->
-<!-- 	    </fault> -->
-	</operation>
-	<operation name="addNumbers3">
-	    <soap:operation soapAction="" />
-	    <input>
-		<soap:body use="literal" />
-	    </input>
-	    <output>
-		<soap:body use="literal" />
-	    </output>
-	    <fault name="addNumbersFault">
-		<soap:fault name="addNumbersFault" use="literal" />
-	    </fault>
-	</operation>
-    </binding>
-    <service name="AddNumbersService">
-	<port name="AddNumbersPort" binding="tns:AddNumbersBinding">
-	    <soap:address location="http://localhost:9091/jaxws/add"/>
-	</port>
-    </service>
+	<!--
+		Licensed to the Apache Software Foundation (ASF) under one or more
+		contributor license agreements. See the NOTICE file distributed with
+		this work for additional information regarding copyright ownership.
+		The ASF licenses this file to you 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.
+	-->
+<definitions name="AddNumbers"
+	targetNamespace="http://apache.org/cxf/systest/ws/addr_feature/"
+	xmlns:tns="http://apache.org/cxf/systest/ws/addr_feature/" xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+	xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
+	xmlns:wsp="http://www.w3.org/ns/ws-policy">
+	<types>
+		<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified" targetNamespace="http://apache.org/cxf/systest/ws/addr_feature/">
+			<complexType name="addNumbersResponse">
+				<sequence>
+					<element name="return" type="xsd:int" />
+				</sequence>
+			</complexType>
+			<element name="addNumbersResponse" type="tns:addNumbersResponse" />
+			<element name="addNumbers2Response" type="tns:addNumbersResponse" />
+			<element name="addNumbers3Response" type="tns:addNumbersResponse" />
+
+			<complexType name="addNumbers">
+				<sequence>
+					<element name="number1" type="xsd:int" />
+					<element name="number2" type="xsd:int" />
+				</sequence>
+			</complexType>
+			<element name="addNumbers" type="tns:addNumbers" />
+			<element name="addNumbers2" type="tns:addNumbers" />
+			<element name="addNumbers3" type="tns:addNumbers" />
+
+			<element name="AddNumbersFault" type="tns:AddNumbersFault" />
+			<complexType name="AddNumbersFault">
+				<sequence>
+					<element name="detail" type="xsd:string" />
+					<element name="message" type="xsd:string" />
+				</sequence>
+			</complexType>
+		</xsd:schema>
+	</types>
+	<message name="addNumbers">
+		<part name="parameters" element="tns:addNumbers" />
+	</message>
+	<message name="addNumbersResponse">
+		<part name="result" element="tns:addNumbersResponse" />
+	</message>
+	<message name="addNumbersFault">
+		<part name="AddNumbersFault" element="tns:AddNumbersFault" />
+	</message>
+	<message name="addNumbers2">
+		<part name="parameters" element="tns:addNumbers2" />
+	</message>
+	<message name="addNumbers2Response">
+		<part name="result" element="tns:addNumbers2Response" />
+	</message>
+	<message name="addNumbers3">
+		<part name="parameters" element="tns:addNumbers3" />
+	</message>
+	<message name="addNumbers3Response">
+		<part name="result" element="tns:addNumbers3Response" />
+	</message>
+	<portType name="AddNumbersPortType">
+		<operation name="addNumbers">
+			<input message="tns:addNumbers" />
+			<output message="tns:addNumbersResponse" />
+			<fault name="addNumbersFault" message="tns:addNumbersFault" />
+		</operation>
+		<operation name="addNumbers2">
+			<input message="tns:addNumbers2" name="add2In" />
+			<output message="tns:addNumbers2Response" name="add2Out" />
+			<!--
+				<fault name="addNumbersFault" message="tns:addNumbersFault"/>
+			-->
+		</operation>
+		<operation name="addNumbers3">
+			<input message="tns:addNumbers3" wsam:Action="3in" />
+			<output message="tns:addNumbers3Response" wsam:Action="3out" />
+			<fault name="addNumbersFault" message="tns:addNumbersFault"
+				wsam:Action="3fault" />
+		</operation>
+	</portType>
+	<binding name="AddNumbersBinding" type="tns:AddNumbersPortType">
+		<wsaw:UsingAddressing wsdl:required="false" />
+		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+			style="document" />
+		<operation name="addNumbers">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersFault">
+				<soap:fault name="addNumbersFault" use="literal" />
+			</fault>
+		</operation>
+		<operation name="addNumbers2">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<!-- 	    <fault name="addNumbersFault"> -->
+			<!-- 		<soap:fault name="addNumbersFault" use="literal" /> -->
+			<!-- 	    </fault> -->
+		</operation>
+		<operation name="addNumbers3">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersFault">
+				<soap:fault name="addNumbersFault" use="literal" />
+			</fault>
+		</operation>
+	</binding>
+	<binding name="AddNumbersBindingOnlyAnon" type="tns:AddNumbersPortType">
+		<wsaw:UsingAddressing wsdl:required="false" />
+		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+			style="document" />
+	    <wsp:PolicyReference URI="#AddNumbersOnlyAnon_WSAM_Addressing_Policy"/>
+		<operation name="addNumbers">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersFault">
+				<soap:fault name="addNumbersFault" use="literal" />
+			</fault>
+		</operation>
+		<operation name="addNumbers2">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<!-- 	    <fault name="addNumbersFault"> -->
+			<!-- 		<soap:fault name="addNumbersFault" use="literal" /> -->
+			<!-- 	    </fault> -->
+		</operation>
+		<operation name="addNumbers3">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersFault">
+				<soap:fault name="addNumbersFault" use="literal" />
+			</fault>
+		</operation>
+	</binding>
+	<binding name="AddNumbersBindingNonAnon" type="tns:AddNumbersPortType">
+		<wsaw:UsingAddressing wsdl:required="false" />
+		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+			style="document" />
+	    <wsp:PolicyReference URI="#AddNumbersNonAnon_WSAM_Addressing_Policy"/>
+		<operation name="addNumbers">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersFault">
+				<soap:fault name="addNumbersFault" use="literal" />
+			</fault>
+		</operation>
+		<operation name="addNumbers2">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<!-- 	    <fault name="addNumbersFault"> -->
+			<!-- 		<soap:fault name="addNumbersFault" use="literal" /> -->
+			<!-- 	    </fault> -->
+		</operation>
+		<operation name="addNumbers3">
+			<soap:operation soapAction="" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersFault">
+				<soap:fault name="addNumbersFault" use="literal" />
+			</fault>
+		</operation>
+	</binding>
+	<service name="AddNumbersService">
+		<port name="AddNumbersPort" binding="tns:AddNumbersBinding">
+			<soap:address location="http://localhost:9091/jaxws/add" />
+		</port>
+		<port name="AddNumbersOnlyAnonPort" binding="tns:AddNumbersBindingOnlyAnon">
+			<soap:address location="http://localhost:9091/jaxws/addAnon" />
+		</port>
+		<port name="AddNumbersNonAnonPort" binding="tns:AddNumbersBindingNonAnon">
+			<soap:address location="http://localhost:9091/jaxws/addNonAnon" />
+		</port>
+	</service>
+
+	<wsp:Policy wsu:Id="AddNumbersNonAnon_WSAM_Addressing_Policy"
+		xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+		<wsam:Addressing>
+			<wsp:Policy>
+				<wsam:NonAnonymousResponses />
+			</wsp:Policy>
+		</wsam:Addressing>
+	</wsp:Policy>
+
+	<wsp:Policy wsu:Id="AddNumbersOnlyAnon_WSAM_Addressing_Policy"
+		xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+		<wsam:Addressing>
+			<wsp:Policy>
+				<wsam:AnonymousResponses />
+			</wsp:Policy>
+		</wsam:Addressing>
+	</wsp:Policy>
+
 </definitions>



Mime
View raw message