You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/03/14 22:25:01 UTC

svn commit: r518329 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/endpoint/ systests/src/test/java/org/apache/cxf/systest/jaxws/ testutils/src/main/resources/wsdl/

Author: dkulp
Date: Wed Mar 14 14:25:00 2007
New Revision: 518329

URL: http://svn.apache.org/viewvc?view=rev&rev=518329
Log:
Fixes for CXF-414

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Server.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=518329&r1=518328&r2=518329
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Wed Mar 14 14:25:00 2007
@@ -210,6 +210,13 @@
         
         modifyChain(chain, requestContext);
         chain.setFaultObserver(outFaultObserver);
+        
+        if (requestContext != null 
+            && requestContext.containsKey(Message.ENDPOINT_ADDRESS)) {
+            endpoint.getEndpointInfo().setAddress((String)requestContext.get(Message.ENDPOINT_ADDRESS));
+        }
+        
+        
         // setup conduit
         Conduit conduit = getConduit();
         exchange.setConduit(conduit);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=518329&r1=518328&r2=518329
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Wed Mar 14 14:25:00 2007
@@ -64,6 +64,9 @@
 
 public class ClientServerTest extends AbstractBusClientServerTestBase {
 
+    private final QName bogusAddressServiceName = new QName(
+                                                "http://apache.org/hello_world_soap_http",
+                                                "SOAPServiceBogusAddressTest");    
     private final QName serviceName = new QName("http://apache.org/hello_world_soap_http",
                                                 "SOAPService");    
     private final QName portName = new QName("http://apache.org/hello_world_soap_http",
@@ -76,6 +79,7 @@
     private final QName portName1  = new QName("http://apache.org/hello_world_soap_http",
                                                "SoapPort2");
 
+
     @BeforeClass
     public static void startServers() throws Exception {                    
         // set up configuration to enable schema validation
@@ -86,6 +90,7 @@
         assertTrue("server did not launch correctly", launchServer(Server.class));
     }
 
+    
     @Test
     public void testBasicConnection() throws Exception {
 
@@ -94,13 +99,12 @@
 
         Greeter greeter = service.getPort(portName, Greeter.class);
 
-        String response = new String("Bonjour");
         try {
             greeter.greetMe("test");
             
             String reply = greeter.sayHi();
             assertNotNull("no response received from service", reply);
-            assertEquals(response, reply);
+            assertEquals("Bonjour", reply);
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();
         }
@@ -680,5 +684,22 @@
             throw (Exception)ex.getCause();
         }
     }
+    
+    
+    @Test
+    public void testBogusAddress() throws Exception {
+        Service service = Service.create(bogusAddressServiceName);
+        Greeter greeter = service.getPort(portName, Greeter.class);
+        BindingProvider bp = (BindingProvider)greeter;
+        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                                   "http://localhost:9015/SoapContext/SoapPort");
+                                   
+        greeter.greetMe("test");
+        String reply = greeter.sayHi();
+        assertNotNull("no response received from service", reply);
+        assertEquals("Bonjour", reply);
+                                   
+    }
+
     
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Server.java?view=diff&rev=518329&r1=518328&r2=518329
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Server.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/Server.java Wed Mar 14 14:25:00 2007
@@ -21,6 +21,7 @@
 
 import java.net.URL;
 
+import javax.jws.WebService;
 import javax.xml.ws.Endpoint;
 
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -40,6 +41,11 @@
         implementor = new DocLitBareGreeterImpl();
         address = "http://localhost:7600/SoapContext/SoapPort";
         Endpoint.publish(address, implementor);
+        
+        
+        implementor = new GreeterImplBogus();
+        address = "http://localhost:9015/SoapContext/SoapPort";
+        Endpoint.publish(address, implementor);
     }
 
     public static void main(String[] args) {
@@ -53,4 +59,13 @@
             System.out.println("done!");
         }
     }
+    
+    
+    @WebService(serviceName = "SOAPServiceBogusAddressTest",
+                portName = "SoapPort",
+                endpointInterface = "org.apache.hello_world_soap_http.Greeter",
+                targetNamespace = "http://apache.org/hello_world_soap_http")
+    public class GreeterImplBogus extends GreeterImpl {
+    
+    }    
 }

Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl?view=diff&rev=518329&r1=518328&r2=518329
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl Wed Mar 14 14:25:00 2007
@@ -390,5 +390,10 @@
             <soap:address location="http://localhost:9009/SoapContext/SoapPort"/>
         </wsdl:port>
     </wsdl:service>
+    <wsdl:service name="SOAPServiceBogusAddressTest">
+        <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
+            <soap:address location="FOO"/>
+        </wsdl:port>
+    </wsdl:service>
 </wsdl:definitions>