adding operations to wsdls make old clients fail
------------------------------------------------

                 Key: CXF-940
                 URL: https://issues.apache.org/jira/browse/CXF-940
             Project: CXF
          Issue Type: Improvement
          Components: Service Model
    Affects Versions: 2.0
            Reporter: Christian Pfeifhofer


Using the old client code generated by wsdl2java to call a webservice which has 
been extended to support a new operation leads to an exception at runtime:

javax.xml.ws.WebServiceException: 
org.apache.cxf.service.factory.ServiceConstructionException: No method was 
found for the WSDL operation 
{http://order.rbp.tmobile.at/services/rbpModifyContract/}rbpNewOperationWithExistingDatatypes.
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:240)
        at javax.xml.ws.Service.getPort(Service.java:94)
        at 
at.tmobile.rbp.order.services.rbpmodifycontract.RbpModifyContractService.getRbpModifyContract(RbpModifyContractService.java:51)
        at 
RbpModifyContractOperationsImplTestBase.testStandardCall(RbpModifyContractOperationsImplTestBase.java:87)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at 
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:228)
        at junit.framework.TestSuite.run(TestSuite.java:223)
        at 
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: No 
method was found for the WSDL operation 
{http://order.rbp.tmobile.at/services/rbpModifyContract/}rbpNewOperationWithExistingDatatypes.
        at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:300)
        at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:196)
        at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:195)
        at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:246)
        at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:136)
        at 
org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:83)
        at 
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:50)
        at 
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:82)
        at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:320)
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:238)
        ... 23 more

I had a look into ReflectionServiceFactoryBean.java (specifically 
initializeWSDLOperations()) where the exception is thrown
https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Seems like the model build from the new wsdl is compared to the old 
wsdl2java-generated interface file. If there are any operation not found in the 
java interface an exception is thrown. 

To support backward compatibility and loose coupling between web service 
providers and clients, it would be better to ignore methods not mentioned in 
the java interface file instead, as they can not be called via the interface 
anyway.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to