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 [EMAIL PROTECTED]: > 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; > + > + > [EMAIL PROTECTED](name = "DocLitWrappedCodeFirstService", > + targetNamespace = > "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService") > [EMAIL PROTECTED](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 > >
