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 2008/08/08 23:20:43 UTC

svn commit: r684099 - in /cxf/trunk/rt: bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ frontend/simple/src/main/java/org/apache/cxf/service/factory/ frontend/simple/sr...

Author: dkulp
Date: Fri Aug  8 14:20:43 2008
New Revision: 684099

URL: http://svn.apache.org/viewvc?rev=684099&view=rev
Log:
[CXF-1657, CXF-1737] Fix bug with on-ways in wsdl causing simple frontend to NPE and possible problem in checking for faults with an empty message
Also make sure OperationResourceInfo thing is set in JAXRS

Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/CheckFaultInterceptor.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/CheckFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/CheckFaultInterceptor.java?rev=684099&r1=684098&r2=684099&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/CheckFaultInterceptor.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/CheckFaultInterceptor.java Fri Aug  8 14:20:43 2008
@@ -54,6 +54,10 @@
                 && xmlReader.hasNext()) {
                 x = xmlReader.next();
             }
+            if (!xmlReader.hasNext()) {
+                //end of document, just return
+                return;
+            }
         } catch (XMLStreamException e) {
             throw new SoapFault(new Message("XML_STREAM_EXC", LOG), e, 
                                 message.getVersion().getSender());

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=684099&r1=684098&r2=684099&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java Fri Aug  8 14:20:43 2008
@@ -134,6 +134,7 @@
             throw new WebApplicationException(404);
         }
 
+        message.getExchange().put(ROOT_RESOURCE_CLASS, resource);
 
         List<ProviderInfo<RequestHandler>> shs = 
             ProviderFactory.getInstance().getRequestHandlers();
@@ -144,6 +145,11 @@
                 acceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
                 List<MediaType> acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes);
                 message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
+                OperationResourceInfo ori = 
+                    JAXRSUtils.findTargetMethod(resource, values.getFirst(URITemplate.FINAL_MATCH_GROUP), 
+                                               httpMethod, values, requestContentType, acceptContentTypes);
+                message.getExchange().put(OperationResourceInfo.class, ori);
+
                 return;
             }
         }
@@ -152,8 +158,6 @@
         List<MediaType> acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes);
         message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
         
-        message.getExchange().put(ROOT_RESOURCE_CLASS, resource);
-        
         LOG.fine("Request path is: " + path);
         LOG.fine("Request HTTP method is: " + httpMethod);
         LOG.fine("Request contentType is: " + requestContentType);

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=684099&r1=684098&r2=684099&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Fri Aug  8 14:20:43 2008
@@ -615,7 +615,8 @@
         Class paramType = method.getReturnType();
         Type genericType = method.getGenericReturnType();
 
-        if (!initializeParameter(o, method, -1, paramType, genericType)) {
+        if (o.hasOutput()
+            && !initializeParameter(o, method, -1, paramType, genericType)) {
             return false;
         }
 

Modified: cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java?rev=684099&r1=684098&r2=684099&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java (original)
+++ cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java Fri Aug  8 14:20:43 2008
@@ -18,12 +18,16 @@
  */
 package org.apache.cxf.service.factory;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.hello_world_doc_lit.Greeter;
+import org.apache.hello_world_doc_lit.GreeterImplDoc;
 import org.junit.Test;
 
 public class RountripTest extends AbstractSimpleFrontendTest {
@@ -34,6 +38,7 @@
         svrBean.setAddress("http://localhost/Hello");
         svrBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
         svrBean.setServiceBean(new HelloServiceImpl());
+        svrBean.setServiceClass(HelloService.class);        
         svrBean.setBus(getBus());
         
         svrBean.create();
@@ -53,5 +58,23 @@
         c.getInInterceptors().add(new LoggingInInterceptor());
         
         assertEquals("hello", client.sayHello());
+        assertEquals("hello", client.echo("hello"));
+    }
+
+    @Test
+    public void testOneWay() throws Exception {
+        ServerFactoryBean svrBean = new ServerFactoryBean();
+        svrBean.setAddress("http://localhost/Hello2");
+        svrBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
+        svrBean.setServiceBean(new GreeterImplDoc());
+        svrBean.setServiceClass(Greeter.class);
+        svrBean.setEndpointName(new QName("http://apache.org/hello_world_doc_lit",
+                                        "SoapPort"));
+        svrBean.setServiceName(new QName("http://apache.org/hello_world_doc_lit",
+                                         "SOAPService"));
+        svrBean.setWsdlLocation("testutils/hello_world_doc_lit.wsdl");
+        svrBean.setBus(getBus());
+        
+        svrBean.create();
     }
 }