You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2006/11/22 09:00:32 UTC

svn commit: r478071 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ testutils/src/main/java/...

Author: mmao
Date: Wed Nov 22 00:00:32 2006
New Revision: 478071

URL: http://svn.apache.org/viewvc?view=rev&rev=478071
Log:
CXF-258 

Fixed NEP in the RPC style when we don't have the WSDLLocation set in the WebService annotation
Also added the testcase for it.

Previous SEI in tests are generated in the testutils, so it always contains the WSDLLocation in the annotation.
If there is no WSDLLocation it's a different branch which we didn't cover by the test.
The issue was caused by wrong processing of wrapped style.

Added:
    incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/Hello.java   (with props)
    incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/HelloImpl.java   (with props)
Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=478071&r1=478070&r2=478071
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java Wed Nov 22 00:00:32 2006
@@ -407,12 +407,15 @@
             return !(ann.parameterStyle().equals(ParameterStyle.BARE) || ann.style().equals(Style.RPC));
         }
 
-        ann = implInfo.getEndpointClass().getAnnotation(SOAPBinding.class);
+        return isWrapped();
+    }
+    
+    @Override
+    public Boolean isWrapped() {
+        SOAPBinding ann = implInfo.getEndpointClass().getAnnotation(SOAPBinding.class);
         if (ann != null) {
             return !(ann.parameterStyle().equals(ParameterStyle.BARE) || ann.style().equals(Style.RPC));
         }
-
         return null;
     }
-
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java?view=diff&rev=478071&r1=478070&r2=478071
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java Wed Nov 22 00:00:32 2006
@@ -34,6 +34,7 @@
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.hello_world_soap_http.GreeterImpl;
+import org.apache.hello_world_soap_http.HelloImpl;
 
 public class EndpointImplTest extends AbstractJaxWsTest {
 
@@ -54,8 +55,8 @@
             String address = "http://localhost:8080/test";
             endpoint.publish(address);
         } catch (IllegalArgumentException ex) {
-            //assertTrue(ex.getCause() instanceof BusException);
-            //assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException)ex.getCause()).getCode());
+            assertTrue(ex.getCause() instanceof BusException);
+            assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException)ex.getCause()).getCode());
         }
         ctx = greeter.getContext();
         
@@ -79,12 +80,30 @@
             String address = "http://localhost:8080/test";
             endpoint.publish(address);
         } catch (IllegalArgumentException ex) {
-            //assertTrue(ex.getCause() instanceof BusException);
-            //assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException)ex.getCause()).getCode());
+            assertTrue(ex.getCause() instanceof BusException);
+            assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException)ex.getCause()).getCode());
         }
         ctx = greeter.getContext();
         
         assertNotNull(ctx);
+    }
+    
+    public void testWSAnnoWithoutWSDLLocationInSEI() throws Exception {
+        HelloImpl hello = new HelloImpl();
+        JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
+        serviceFactory.setBus(getBus());
+        serviceFactory.setInvoker(new BeanInvoker(hello));
+        serviceFactory.setServiceClass(HelloImpl.class);
+        
+        EndpointImpl endpoint = new EndpointImpl(getBus(), hello, serviceFactory);
+
+        try {
+            String address = "http://localhost:8080/test";
+            endpoint.publish(address);
+        } catch (IllegalArgumentException ex) {
+            assertTrue(ex.getCause() instanceof BusException);
+            assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException)ex.getCause()).getCode());
+        }
     }
 
     static class EchoObserver implements MessageObserver {

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java?view=diff&rev=478071&r1=478070&r2=478071
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java Wed Nov 22 00:00:32 2006
@@ -54,6 +54,10 @@
         return null;
     }
 
+    public Boolean isWrapped() {
+        return null;
+    }
+    
     public Boolean isWrapped(Method m) { 
         return null;
     }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=478071&r1=478070&r2=478071
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Wed Nov 22 00:00:32 2006
@@ -94,7 +94,7 @@
     private Executor executor;
     private List<String> ignoredClasses = new ArrayList<String>();
     private SimpleMethodDispatcher methodDispatcher = new SimpleMethodDispatcher();
-    private boolean wrappedStyle = true;
+    private Boolean wrappedStyle;
     private Map<String, Object> properties;
     
     public ReflectionServiceFactoryBean() {
@@ -191,7 +191,7 @@
             
             createInterface(serviceInfo);
 
-            if (wrappedStyle) {
+            if (isWrapped()) {
                 initializeWrappedElementNames(serviceInfo);
             }
             
@@ -199,7 +199,7 @@
                 getDataBinding().initialize(serviceInfo);
             }
             
-            if (wrappedStyle) {
+            if (isWrapped()) {
                 initializeWrappedSchema(serviceInfo);
             }
             
@@ -839,7 +839,16 @@
     }
 
     public boolean isWrapped() {
-        return wrappedStyle;
+        if (this.wrappedStyle != null) {
+            return this.wrappedStyle;
+        }
+        for (AbstractServiceConfiguration c : serviceConfigurations) {
+            Boolean b = c.isWrapped();
+            if (b != null) {
+                return b.booleanValue();
+            }
+        }
+        return true;
     }
 
     public void setWrapped(boolean style) {

Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/Hello.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/Hello.java?view=auto&rev=478071
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/Hello.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/Hello.java Wed Nov 22 00:00:32 2006
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+package org.apache.hello_world_soap_http;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+
+@WebService(name = "Hello", targetNamespace = "http://apache.org/hello_world_soap_http")
+@SOAPBinding(style = javax.jws.soap.SOAPBinding.Style.RPC, use = javax.jws.soap.SOAPBinding.Use.LITERAL)
+public interface Hello {
+    @WebMethod(operationName = "sayHi")    
+    String sayHi();
+}

Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/Hello.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/Hello.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/HelloImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/HelloImpl.java?view=auto&rev=478071
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/HelloImpl.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/HelloImpl.java Wed Nov 22 00:00:32 2006
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+package org.apache.hello_world_soap_http;
+@javax.jws.WebService(name = "Hello", 
+                      serviceName = "HelloService",
+                      portName = "HelloPort",
+                      targetNamespace = "http://apache.org/hello_world_soap_http", 
+                      endpointInterface = "org.apache.hello_world_soap_http.Hello")
+
+public class HelloImpl implements Hello {
+    public String sayHi() {
+        return "Hello CXF";
+    }    
+}

Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/HelloImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_soap_http/HelloImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date