You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Glen Mazza <gl...@verizon.net> on 2007/10/30 22:14:11 UTC

Re: svn commit: r590451 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ systests/src/test/java/org/apache/cxf/systest/jaxws/

You mean, allow *clients* to work if they don't have methods for some of
the operations defined in the WSDL, correct?  If I understand correctly,
that was the concern with CXF-940.

Glen

Am Dienstag, den 30.10.2007, 20:52 +0000 schrieb dkulp@apache.org:
> Author: dkulp
> Date: Tue Oct 30 13:52:52 2007
> New Revision: 590451
> 
> URL: http://svn.apache.org/viewvc?rev=590451&view=rev
> Log:
> CXF-940 - Allow services to work if they don't have methods for some of the operations in the wsdl.  The methods it does have will work.
> 
> Added:
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java   (with props)
> Modified:
>     incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
>     incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
>     incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
>     incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
> 
> Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java?rev=590451&r1=590450&r2=590451&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java (original)
> +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java Tue Oct 30 13:52:52 2007
> @@ -101,6 +101,20 @@
>          
>          operations.put(operation.getName(), operation);
>      }
> +    
> +    /**
> +     * Removes an operation from this service.
> +     *
> +     * @param operation the operation.
> +     */
> +    public void removeOperation(BindingOperationInfo operation) {
> +        if (operation.getName() == null) {
> +            throw new NullPointerException(
> +                new Message("BINDING.OPERATION.NAME.NOT.NULL", LOG).toString());
> +        } 
> +        
> +        operations.remove(operation.getName());
> +    }
>  
>      /**
>       * Returns the operation info with the given name, if found.
> 
> Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java?rev=590451&r1=590450&r2=590451&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java (original)
> +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java Tue Oct 30 13:52:52 2007
> @@ -85,6 +85,15 @@
>      void addOperation(OperationInfo operation) {
>          operations.put(operation.getName(), operation);
>      }
> +    
> +    /**
> +     * Removes an operation from this service.
> +     *
> +     * @param operation the operation.
> +     */
> +    public void removeOperation(OperationInfo operation) {
> +        operations.remove(operation.getName());
> +    }    
>  
>      /**
>       * Returns the operation info with the given name, if found.
> 
> 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?rev=590451&r1=590450&r2=590451&view=diff
> ==============================================================================
> --- 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 Tue Oct 30 13:52:52 2007
> @@ -303,6 +303,7 @@
>      }
>  
>      protected void initializeWSDLOperations() {
> +        List<OperationInfo> removes = new ArrayList<OperationInfo>();
>          Method[] methods = serviceClass.getMethods();
>          Arrays.sort(methods, new MethodComparator());
>  
> @@ -329,17 +330,29 @@
>              }
>  
>              if (selected == null) {
> -                throw new ServiceConstructionException(new Message("NO_METHOD_FOR_OP", LOG, o.getName()));
> +                LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName());
> +                removes.add(o);
> +            } else {
> +                initializeWSDLOperation(intf, o, selected);
>              }
> -
> -            initializeWSDLOperation(intf, o, selected);
> +        }
> +        for (OperationInfo op : removes) {
> +            intf.removeOperation(op);
>          }
>  
>          //Some of the operations may have switched from unwrapped to wrapped.  Update the bindings.
>          for (ServiceInfo service : getService().getServiceInfos()) {
>              for (BindingInfo bi : service.getBindings()) {
> +                List<BindingOperationInfo> biremoves = new ArrayList<BindingOperationInfo>();
>                  for (BindingOperationInfo binfo : bi.getOperations()) {
> -                    binfo.updateUnwrappedOperation();
> +                    if (removes.contains(binfo.getOperationInfo())) {
> +                        biremoves.add(binfo); 
> +                    } else {
> +                        binfo.updateUnwrappedOperation();
> +                    }
> +                }
> +                for (BindingOperationInfo binfo : biremoves) {
> +                    bi.removeOperation(binfo);
>                  }
>              }
>          }
> 
> Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties?rev=590451&r1=590450&r2=590451&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties (original)
> +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties Tue Oct 30 13:52:52 2007
> @@ -19,7 +19,7 @@
>  #
>  #
>  COULD_NOT_FIND_PORTTYPE = Could not find portType named {0}
> -NO_METHOD_FOR_OP = Could not find a matching method for operation {0}
> +NO_METHOD_FOR_OP = Could not find a matching method for operation {0}. Operation will be unavailable.
>  COULD_NOT_SET_WRAPPER_STYLE = Service class: {0} contains overloaded operation can not use wrapper style
>  USING_PROXY_FOR_SERVICE = Service class: {0} is a java.lang.reflect.Proxy instance.  This is known not to work well as \
>    annotations on the real instance are not available.  We suggest overriding the ServiceClass via spring config or \
> 
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=590451&r1=590450&r2=590451&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java Tue Oct 30 13:52:52 2007
> @@ -198,6 +198,23 @@
>      }
>      
>      @Test
> +    public void testMissingMethods() throws Exception {
> +        QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", 
> +                "DocLitWrappedCodeFirstServicePort");
> +        QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", 
> +                "DocLitWrappedCodeFirstService");
> +        
> +        Service service = Service.create(new URL(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl"),
> +                      servName);
> +        DocLitWrappedCodeFirstServiceMissingOps port = service.getPort(portName,
> +                                  DocLitWrappedCodeFirstServiceMissingOps.class);
> +
> +        int[] ret = port.echoIntArray(new int[] {1, 2});
> +        assertNotNull(ret);
> +        //port.arrayOutput();
> +    }
> +    
> +    @Test
>      public void testStringListOutDocLitNoWsdl() throws Exception {
>          QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService", 
>                                     "DocLitWrappedCodeFirstServicePort");
> 
> Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java?rev=590451&view=auto
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java (added)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java Tue Oct 30 13:52:52 2007
> @@ -0,0 +1,48 @@
> +/**
> + * 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.cxf.systest.jaxws;
> +
> +import java.util.Vector;
> +
> +import javax.jws.WebMethod;
> +import javax.jws.WebParam;
> +import javax.jws.WebService;
> +import javax.jws.soap.SOAPBinding;
> +
> +
> +@WebService(name = "DocLitWrappedCodeFirstService",
> +            targetNamespace = "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService")
> +@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
> +             use = SOAPBinding.Use.LITERAL)
> +public interface DocLitWrappedCodeFirstServiceMissingOps {
> +
> +    @WebMethod
> +    String[] arrayOutput();
> +
> +    @WebMethod
> +    String arrayInput(
> +            @WebParam(name = "input") String[] inputs);
> +
> +    @WebMethod
> +    Vector<String> listOutput();
> +    
> +    @WebMethod
> +    int[] echoIntArray(int[] ar);
> +    
> +}
> 
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java
> ------------------------------------------------------------------------------
>     svn:keywords = Rev Date
> 
> 


Re: svn commit: r590451 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ systests/src/test/java/org/apache/cxf/systest/jaxws/

Posted by Glen Mazza <gl...@verizon.net>.
I can understand clients still being allowed to run if the WSDL has been
expanded to accomodate more operations--if nothing else, Metro operates
that way.

But server-side, what you're saying is that a web service should be
allowed to operate inconsistently from its WSDL--i.e., not have a 1-to-1
mapping between operations and functions.  The benefits for allowing
that seem somewhat more questionable.

Glen


Am Dienstag, den 30.10.2007, 17:31 -0400 schrieb Daniel Kulp:
> It actually allows both clients and servers to work. 
> 
> For clients, the interface passed to the service.create thing won't have 
> the methods so there really isn't a way to invoke it.
> 
> For servers, the operations that DO map to a method will work fine.   For 
> others, when it tries to parse the request, it won't find a usable 
> operation and a fault would be raised.
> 
> Dan
> 
> 
> On Tuesday 30 October 2007, Glen Mazza wrote:
> > You mean, allow *clients* to work if they don't have methods for some
> > of the operations defined in the WSDL, correct?  If I understand
> > correctly, that was the concern with CXF-940.
> >
> > Glen
> >
> > Am Dienstag, den 30.10.2007, 20:52 +0000 schrieb dkulp@apache.org:
> > > Author: dkulp
> > > Date: Tue Oct 30 13:52:52 2007
> > > New Revision: 590451
> > >
> > > URL: http://svn.apache.org/viewvc?rev=590451&view=rev
> > > Log:
> > > CXF-940 - Allow services to work if they don't have methods for some
> > > of the operations in the wsdl.  The methods it does have will work.
> > >
> > > Added:
> > >    
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/DocLitWrappedCodeFirstServiceMissingOps.java   (with props)
> > > Modified:
> > >    
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> > >indingInfo.java
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> > >nterfaceInfo.java
> > > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> > >service/factory/ReflectionServiceFactoryBean.java
> > > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> > >service/factory/SimpleMessages.properties
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/ClientServerMiscTest.java
> > >
> > > Modified:
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> > >indingInfo.java URL:
> > > http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/o
> > >rg/apache/cxf/service/model/BindingInfo.java?rev=590451&r1=590450&r2=
> > >590451&view=diff
> > > ====================================================================
> > >========== ---
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> > >indingInfo.java (original) +++
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> > >indingInfo.java Tue Oct 30 13:52:52 2007 @@ -101,6 +101,20 @@
> > >
> > >          operations.put(operation.getName(), operation);
> > >      }
> > > +
> > > +    /**
> > > +     * Removes an operation from this service.
> > > +     *
> > > +     * @param operation the operation.
> > > +     */
> > > +    public void removeOperation(BindingOperationInfo operation) {
> > > +        if (operation.getName() == null) {
> > > +            throw new NullPointerException(
> > > +                new Message("BINDING.OPERATION.NAME.NOT.NULL",
> > > LOG).toString()); +        }
> > > +
> > > +        operations.remove(operation.getName());
> > > +    }
> > >
> > >      /**
> > >       * Returns the operation info with the given name, if found.
> > >
> > > Modified:
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> > >nterfaceInfo.java URL:
> > > http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/o
> > >rg/apache/cxf/service/model/InterfaceInfo.java?rev=590451&r1=590450&r
> > >2=590451&view=diff
> > > ====================================================================
> > >========== ---
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> > >nterfaceInfo.java (original) +++
> > > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> > >nterfaceInfo.java Tue Oct 30 13:52:52 2007 @@ -85,6 +85,15 @@
> > >      void addOperation(OperationInfo operation) {
> > >          operations.put(operation.getName(), operation);
> > >      }
> > > +
> > > +    /**
> > > +     * Removes an operation from this service.
> > > +     *
> > > +     * @param operation the operation.
> > > +     */
> > > +    public void removeOperation(OperationInfo operation) {
> > > +        operations.remove(operation.getName());
> > > +    }
> > >
> > >      /**
> > >       * Returns the operation info with the given name, if found.
> > >
> > > 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/ReflectionServiceFactory
> > >Bean.java?rev=590451&r1=590450&r2=590451&view=diff
> > > ====================================================================
> > >========== ---
> > > 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 Tue Oct 30 13:52:52
> > > 2007 @@ -303,6 +303,7 @@
> > >      }
> > >
> > >      protected void initializeWSDLOperations() {
> > > +        List<OperationInfo> removes = new
> > > ArrayList<OperationInfo>(); Method[] methods =
> > > serviceClass.getMethods();
> > >          Arrays.sort(methods, new MethodComparator());
> > >
> > > @@ -329,17 +330,29 @@
> > >              }
> > >
> > >              if (selected == null) {
> > > -                throw new ServiceConstructionException(new
> > > Message("NO_METHOD_FOR_OP", LOG, o.getName())); +               
> > > LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName()); +          
> > >      removes.add(o);
> > > +            } else {
> > > +                initializeWSDLOperation(intf, o, selected);
> > >              }
> > > -
> > > -            initializeWSDLOperation(intf, o, selected);
> > > +        }
> > > +        for (OperationInfo op : removes) {
> > > +            intf.removeOperation(op);
> > >          }
> > >
> > >          //Some of the operations may have switched from unwrapped
> > > to wrapped.  Update the bindings. for (ServiceInfo service :
> > > getService().getServiceInfos()) { for (BindingInfo bi :
> > > service.getBindings()) { +                List<BindingOperationInfo>
> > > biremoves = new ArrayList<BindingOperationInfo>(); for
> > > (BindingOperationInfo binfo : bi.getOperations()) { -               
> > >     binfo.updateUnwrappedOperation();
> > > +                    if (removes.contains(binfo.getOperationInfo()))
> > > { +                        biremoves.add(binfo);
> > > +                    } else {
> > > +                        binfo.updateUnwrappedOperation();
> > > +                    }
> > > +                }
> > > +                for (BindingOperationInfo binfo : biremoves) {
> > > +                    bi.removeOperation(binfo);
> > >                  }
> > >              }
> > >          }
> > >
> > > Modified:
> > > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> > >service/factory/SimpleMessages.properties URL:
> > > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/
> > >src/main/java/org/apache/cxf/service/factory/SimpleMessages.propertie
> > >s?rev=590451&r1=590450&r2=590451&view=diff
> > > ====================================================================
> > >========== ---
> > > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> > >service/factory/SimpleMessages.properties (original) +++
> > > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> > >service/factory/SimpleMessages.properties Tue Oct 30 13:52:52 2007 @@
> > > -19,7 +19,7 @@
> > >  #
> > >  #
> > >  COULD_NOT_FIND_PORTTYPE = Could not find portType named {0}
> > > -NO_METHOD_FOR_OP = Could not find a matching method for operation
> > > {0} +NO_METHOD_FOR_OP = Could not find a matching method for
> > > operation {0}. Operation will be unavailable.
> > > COULD_NOT_SET_WRAPPER_STYLE = Service class: {0} contains overloaded
> > > operation can not use wrapper style USING_PROXY_FOR_SERVICE =
> > > Service class: {0} is a java.lang.reflect.Proxy instance.  This is
> > > known not to work well as \ annotations on the real instance are not
> > > available.  We suggest overriding the ServiceClass via spring config
> > > or \
> > >
> > > Modified:
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/ClientServerMiscTest.java URL:
> > > http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/j
> > >ava/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=590451
> > >&r1=590450&r2=590451&view=diff
> > > ====================================================================
> > >========== ---
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/ClientServerMiscTest.java (original) +++
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/ClientServerMiscTest.java Tue Oct 30 13:52:52 2007 @@ -198,6
> > > +198,23 @@
> > >      }
> > >
> > >      @Test
> > > +    public void testMissingMethods() throws Exception {
> > > +        QName portName = new
> > > QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstSer
> > >vice", +                "DocLitWrappedCodeFirstServicePort");
> > > +        QName servName = new
> > > QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstSer
> > >vice", +                "DocLitWrappedCodeFirstService");
> > > +
> > > +        Service service = Service.create(new
> > > URL(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl"), +                   
> > >   servName);
> > > +        DocLitWrappedCodeFirstServiceMissingOps port =
> > > service.getPort(portName, +                                 
> > > DocLitWrappedCodeFirstServiceMissingOps.class); +
> > > +        int[] ret = port.echoIntArray(new int[] {1, 2});
> > > +        assertNotNull(ret);
> > > +        //port.arrayOutput();
> > > +    }
> > > +
> > > +    @Test
> > >      public void testStringListOutDocLitNoWsdl() throws Exception {
> > >          QName portName = new
> > > QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstSer
> > >vice", "DocLitWrappedCodeFirstServicePort");
> > >
> > > Added:
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/DocLitWrappedCodeFirstServiceMissingOps.java URL:
> > > http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/j
> > >ava/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissing
> > >Ops.java?rev=590451&view=auto
> > > ====================================================================
> > >========== ---
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/DocLitWrappedCodeFirstServiceMissingOps.java (added) +++
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/DocLitWrappedCodeFirstServiceMissingOps.java Tue Oct 30 13:52:52
> > > 2007 @@ -0,0 +1,48 @@
> > > +/**
> > > + * 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.cxf.systest.jaxws;
> > > +
> > > +import java.util.Vector;
> > > +
> > > +import javax.jws.WebMethod;
> > > +import javax.jws.WebParam;
> > > +import javax.jws.WebService;
> > > +import javax.jws.soap.SOAPBinding;
> > > +
> > > +
> > > +@WebService(name = "DocLitWrappedCodeFirstService",
> > > +            targetNamespace =
> > > "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService")
> > > +@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
> > > +             use = SOAPBinding.Use.LITERAL)
> > > +public interface DocLitWrappedCodeFirstServiceMissingOps {
> > > +
> > > +    @WebMethod
> > > +    String[] arrayOutput();
> > > +
> > > +    @WebMethod
> > > +    String arrayInput(
> > > +            @WebParam(name = "input") String[] inputs);
> > > +
> > > +    @WebMethod
> > > +    Vector<String> listOutput();
> > > +
> > > +    @WebMethod
> > > +    int[] echoIntArray(int[] ar);
> > > +
> > > +}
> > >
> > > Propchange:
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/DocLitWrappedCodeFirstServiceMissingOps.java
> > > --------------------------------------------------------------------
> > >---------- svn:eol-style = native
> > >
> > > Propchange:
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> > >xws/DocLitWrappedCodeFirstServiceMissingOps.java
> > > --------------------------------------------------------------------
> > >---------- svn:keywords = Rev Date
> 
> 
> 


Re: svn commit: r590451 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ systests/src/test/java/org/apache/cxf/systest/jaxws/

Posted by Daniel Kulp <dk...@apache.org>.
It actually allows both clients and servers to work. 

For clients, the interface passed to the service.create thing won't have 
the methods so there really isn't a way to invoke it.

For servers, the operations that DO map to a method will work fine.   For 
others, when it tries to parse the request, it won't find a usable 
operation and a fault would be raised.

Dan


On Tuesday 30 October 2007, Glen Mazza wrote:
> You mean, allow *clients* to work if they don't have methods for some
> of the operations defined in the WSDL, correct?  If I understand
> correctly, that was the concern with CXF-940.
>
> Glen
>
> Am Dienstag, den 30.10.2007, 20:52 +0000 schrieb dkulp@apache.org:
> > Author: dkulp
> > Date: Tue Oct 30 13:52:52 2007
> > New Revision: 590451
> >
> > URL: http://svn.apache.org/viewvc?rev=590451&view=rev
> > Log:
> > CXF-940 - Allow services to work if they don't have methods for some
> > of the operations in the wsdl.  The methods it does have will work.
> >
> > Added:
> >    
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/DocLitWrappedCodeFirstServiceMissingOps.java   (with props)
> > Modified:
> >    
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> >indingInfo.java
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> >nterfaceInfo.java
> > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> >service/factory/ReflectionServiceFactoryBean.java
> > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> >service/factory/SimpleMessages.properties
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/ClientServerMiscTest.java
> >
> > Modified:
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> >indingInfo.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/o
> >rg/apache/cxf/service/model/BindingInfo.java?rev=590451&r1=590450&r2=
> >590451&view=diff
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> >indingInfo.java (original) +++
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/B
> >indingInfo.java Tue Oct 30 13:52:52 2007 @@ -101,6 +101,20 @@
> >
> >          operations.put(operation.getName(), operation);
> >      }
> > +
> > +    /**
> > +     * Removes an operation from this service.
> > +     *
> > +     * @param operation the operation.
> > +     */
> > +    public void removeOperation(BindingOperationInfo operation) {
> > +        if (operation.getName() == null) {
> > +            throw new NullPointerException(
> > +                new Message("BINDING.OPERATION.NAME.NOT.NULL",
> > LOG).toString()); +        }
> > +
> > +        operations.remove(operation.getName());
> > +    }
> >
> >      /**
> >       * Returns the operation info with the given name, if found.
> >
> > Modified:
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> >nterfaceInfo.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/o
> >rg/apache/cxf/service/model/InterfaceInfo.java?rev=590451&r1=590450&r
> >2=590451&view=diff
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> >nterfaceInfo.java (original) +++
> > incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/I
> >nterfaceInfo.java Tue Oct 30 13:52:52 2007 @@ -85,6 +85,15 @@
> >      void addOperation(OperationInfo operation) {
> >          operations.put(operation.getName(), operation);
> >      }
> > +
> > +    /**
> > +     * Removes an operation from this service.
> > +     *
> > +     * @param operation the operation.
> > +     */
> > +    public void removeOperation(OperationInfo operation) {
> > +        operations.remove(operation.getName());
> > +    }
> >
> >      /**
> >       * Returns the operation info with the given name, if found.
> >
> > 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/ReflectionServiceFactory
> >Bean.java?rev=590451&r1=590450&r2=590451&view=diff
> > ====================================================================
> >========== ---
> > 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 Tue Oct 30 13:52:52
> > 2007 @@ -303,6 +303,7 @@
> >      }
> >
> >      protected void initializeWSDLOperations() {
> > +        List<OperationInfo> removes = new
> > ArrayList<OperationInfo>(); Method[] methods =
> > serviceClass.getMethods();
> >          Arrays.sort(methods, new MethodComparator());
> >
> > @@ -329,17 +330,29 @@
> >              }
> >
> >              if (selected == null) {
> > -                throw new ServiceConstructionException(new
> > Message("NO_METHOD_FOR_OP", LOG, o.getName())); +               
> > LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName()); +          
> >      removes.add(o);
> > +            } else {
> > +                initializeWSDLOperation(intf, o, selected);
> >              }
> > -
> > -            initializeWSDLOperation(intf, o, selected);
> > +        }
> > +        for (OperationInfo op : removes) {
> > +            intf.removeOperation(op);
> >          }
> >
> >          //Some of the operations may have switched from unwrapped
> > to wrapped.  Update the bindings. for (ServiceInfo service :
> > getService().getServiceInfos()) { for (BindingInfo bi :
> > service.getBindings()) { +                List<BindingOperationInfo>
> > biremoves = new ArrayList<BindingOperationInfo>(); for
> > (BindingOperationInfo binfo : bi.getOperations()) { -               
> >     binfo.updateUnwrappedOperation();
> > +                    if (removes.contains(binfo.getOperationInfo()))
> > { +                        biremoves.add(binfo);
> > +                    } else {
> > +                        binfo.updateUnwrappedOperation();
> > +                    }
> > +                }
> > +                for (BindingOperationInfo binfo : biremoves) {
> > +                    bi.removeOperation(binfo);
> >                  }
> >              }
> >          }
> >
> > Modified:
> > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> >service/factory/SimpleMessages.properties URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/
> >src/main/java/org/apache/cxf/service/factory/SimpleMessages.propertie
> >s?rev=590451&r1=590450&r2=590451&view=diff
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> >service/factory/SimpleMessages.properties (original) +++
> > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/
> >service/factory/SimpleMessages.properties Tue Oct 30 13:52:52 2007 @@
> > -19,7 +19,7 @@
> >  #
> >  #
> >  COULD_NOT_FIND_PORTTYPE = Could not find portType named {0}
> > -NO_METHOD_FOR_OP = Could not find a matching method for operation
> > {0} +NO_METHOD_FOR_OP = Could not find a matching method for
> > operation {0}. Operation will be unavailable.
> > COULD_NOT_SET_WRAPPER_STYLE = Service class: {0} contains overloaded
> > operation can not use wrapper style USING_PROXY_FOR_SERVICE =
> > Service class: {0} is a java.lang.reflect.Proxy instance.  This is
> > known not to work well as \ annotations on the real instance are not
> > available.  We suggest overriding the ServiceClass via spring config
> > or \
> >
> > Modified:
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/ClientServerMiscTest.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/j
> >ava/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=590451
> >&r1=590450&r2=590451&view=diff
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/ClientServerMiscTest.java (original) +++
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/ClientServerMiscTest.java Tue Oct 30 13:52:52 2007 @@ -198,6
> > +198,23 @@
> >      }
> >
> >      @Test
> > +    public void testMissingMethods() throws Exception {
> > +        QName portName = new
> > QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstSer
> >vice", +                "DocLitWrappedCodeFirstServicePort");
> > +        QName servName = new
> > QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstSer
> >vice", +                "DocLitWrappedCodeFirstService");
> > +
> > +        Service service = Service.create(new
> > URL(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl"), +                   
> >   servName);
> > +        DocLitWrappedCodeFirstServiceMissingOps port =
> > service.getPort(portName, +                                 
> > DocLitWrappedCodeFirstServiceMissingOps.class); +
> > +        int[] ret = port.echoIntArray(new int[] {1, 2});
> > +        assertNotNull(ret);
> > +        //port.arrayOutput();
> > +    }
> > +
> > +    @Test
> >      public void testStringListOutDocLitNoWsdl() throws Exception {
> >          QName portName = new
> > QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstSer
> >vice", "DocLitWrappedCodeFirstServicePort");
> >
> > Added:
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/DocLitWrappedCodeFirstServiceMissingOps.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/j
> >ava/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissing
> >Ops.java?rev=590451&view=auto
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/DocLitWrappedCodeFirstServiceMissingOps.java (added) +++
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/DocLitWrappedCodeFirstServiceMissingOps.java Tue Oct 30 13:52:52
> > 2007 @@ -0,0 +1,48 @@
> > +/**
> > + * 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.cxf.systest.jaxws;
> > +
> > +import java.util.Vector;
> > +
> > +import javax.jws.WebMethod;
> > +import javax.jws.WebParam;
> > +import javax.jws.WebService;
> > +import javax.jws.soap.SOAPBinding;
> > +
> > +
> > +@WebService(name = "DocLitWrappedCodeFirstService",
> > +            targetNamespace =
> > "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService")
> > +@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
> > +             use = SOAPBinding.Use.LITERAL)
> > +public interface DocLitWrappedCodeFirstServiceMissingOps {
> > +
> > +    @WebMethod
> > +    String[] arrayOutput();
> > +
> > +    @WebMethod
> > +    String arrayInput(
> > +            @WebParam(name = "input") String[] inputs);
> > +
> > +    @WebMethod
> > +    Vector<String> listOutput();
> > +
> > +    @WebMethod
> > +    int[] echoIntArray(int[] ar);
> > +
> > +}
> >
> > Propchange:
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/DocLitWrappedCodeFirstServiceMissingOps.java
> > --------------------------------------------------------------------
> >---------- svn:eol-style = native
> >
> > Propchange:
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ja
> >xws/DocLitWrappedCodeFirstServiceMissingOps.java
> > --------------------------------------------------------------------
> >---------- svn:keywords = Rev Date



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog