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/11/17 04:06:19 UTC

svn commit: r595902 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ systests/src/test/java/org/apache/cxf/systest/soapheader/

Author: dkulp
Date: Fri Nov 16 19:06:19 2007
New Revision: 595902

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

........
  r595901 | dkulp | 2007-11-16 22:02:58 -0500 (Fri, 16 Nov 2007) | 2 lines
  
  Fix issue with headers that aren't on the wire causing faults
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/PizzaImpl.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java?rev=595902&r1=595901&r2=595902&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java Fri Nov 16 19:06:19 2007
@@ -97,7 +97,7 @@
                 }
                 
             }
-            if (object != null && mpi.getTypeClass() != null) {
+            if (mpi.getTypeClass() != null) {
                 parameters.put(mpi, object);
             }
         }

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java?rev=595902&r1=595901&r2=595902&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java Fri Nov 16 19:06:19 2007
@@ -23,6 +23,12 @@
 
 import java.net.URL;
 
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.pizza.Pizza;
@@ -42,7 +48,7 @@
 
     @BeforeClass
     public static void startServers() throws Exception {
-        assertTrue("server did not launch correctly", launchServer(Server.class));
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
     }
 
     @Test
@@ -65,6 +71,20 @@
 
         assertEquals(208, res.getMinutesUntilReady());
     }
+    @Test
+    public void testBasicConnectionNoHeader() throws Exception {
+        PizzaNoHeader port = getPortNoHeader();
+
+        OrderPizzaType req = new OrderPizzaType();
+        ToppingsListType t = new ToppingsListType();
+        t.getTopping().add("NoHeader!");
+        t.getTopping().add("test");
+        req.setToppings(t);
+
+        OrderPizzaResponseType res =  port.orderPizza(req);
+
+        assertEquals(100, res.getMinutesUntilReady());
+    }
 
     private Pizza getPort() {
         URL wsdl = getClass().getResource("/wsdl/pizza_service.wsdl");
@@ -74,6 +94,34 @@
         assertNotNull("Service is null ", service);
 
         return service.getPizzaPort();
+    }
+    
+    private PizzaNoHeader getPortNoHeader() {
+        URL wsdl = getClass().getResource("/wsdl/pizza_service.wsdl");
+        assertNotNull("WSDL is null", wsdl);
+
+        PizzaService service = new PizzaService(wsdl, serviceName);
+        assertNotNull("Service is null ", service);
+
+        return service.getPort(PizzaNoHeader.class);
+    }
+    
+    
+    @WebService(targetNamespace = "http://cxf.apache.org/pizza", name = "Pizza")
+    @XmlSeeAlso({ org.apache.cxf.pizza.types.ObjectFactory.class })
+    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+    public interface PizzaNoHeader {
+
+        @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+        @WebResult(name = "OrderResponse",
+                   targetNamespace = "http://cxf.apache.org/pizza/types",
+                   partName = "body")
+        @WebMethod(operationName = "OrderPizza")
+        org.apache.cxf.pizza.types.OrderPizzaResponseType orderPizza(
+            @WebParam(partName = "body", name = "OrderRequest",
+                      targetNamespace = "http://cxf.apache.org/pizza/types")
+            org.apache.cxf.pizza.types.OrderPizzaType body
+        );
     }
 
 }

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/PizzaImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/PizzaImpl.java?rev=595902&r1=595901&r2=595902&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/PizzaImpl.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/soapheader/PizzaImpl.java Fri Nov 16 19:06:19 2007
@@ -28,7 +28,11 @@
 
     public OrderPizzaResponseType orderPizza(OrderPizzaType body, CallerIDHeaderType callerID) {
         OrderPizzaResponseType resp = new OrderPizzaResponseType();
-        resp.setMinutesUntilReady(100 + Integer.parseInt(callerID.getPhoneNumber()));
+        if (body.getToppings().getTopping().get(0).contains("NoHeader")) {
+            resp.setMinutesUntilReady(100);
+        } else {
+            resp.setMinutesUntilReady(100 + Integer.parseInt(callerID.getPhoneNumber()));
+        }
         return resp;
     }