You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Agusti Tomas <ag...@gmail.com> on 2016/03/17 10:38:32 UTC

Static wsdl not working after ugrading to CXF 3.0.4

Hello everyone,

I'm new to the mailing list and desperate for help on this issue I have. I
have posted a mesage to stackoverflow that I copy&paste below. Apologies if
this is not allowed but I think it explains the problem quite clearly. The
link to the original post is:

http://stackoverflow.com/questions/36041744/static-wsdl-not-working-after-ugrading-to-cxf-3-0-4

If I get an answer, I'll post it there as well. Here it goes:

So I have a pretty simple setup where I have a wsdl in my web application,
I use this wsdl to generate classes which I then instantiate and use to
call methods present on a remote server that uses the exact same wsdl I
have in my web application.

This was working until not long ago when I upgraded from CXF 2.6.8 to CXF
3.0.4 (more precisely the version that comes with JBoss Fuse 6.2.1 running
on top of JBoss 6.4.0 EAP). Here is the dependencies section of my pom file
(note that I have a root pom for version management and all dependencies
are provided by default):

<dependencies>

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
    </dependency>

    <dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-all-6.0</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cdi</artifactId>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jettison</groupId>
        <artifactId>jettison</artifactId>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
    </dependency>
</dependencies>

Here is the source generation by the wsdl2java maven plugin, also from the
pom:

<plugin>
    <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <configuration>
            <fork>once</fork>
        </configuration>
        <executions>

            <execution>
                <id>Step one</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
                <configuration>

<sourceRoot>${project.build.directory}/generated-sources/wsdl/pg-sapc</sourceRoot>
                    <wsdlOptions>
                        <wsdlOption>

<wsdl>${project.basedir}/src/main/resources/wsdl/Generic/MyWsdl.wsdl</wsdl>

<wsdlLocation>classpath:wsdl/Generic/MyWsdl.wsdl</wsdlLocation>
                            <packagenames>
                                <packagename>my.package</packagename>
                            </packagenames>
                            <extraargs>
                                <extraarg>-exsh</extraarg>
                                <extraarg>true</extraarg>
                            </extraargs>
                        </wsdlOption>
                    </wsdlOptions>
                </configuration>
            </execution>...

And this is the code using the generated files, notice I change the
endpoint to the remote server endpoint before calling a method:

private static final GeneratedSource GENERATEDSOURCE = new
GeneratedSource();...Service destination =
GENERATEDSOURCE.getServiceport(); //EXCEPTION TRIGGERED ON THIS
LINE!!!
BindingProvider prov = (BindingProvider)destination;
prov.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);
prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
try {
    destination.methodCall(inputData);} catch (WebServiceException ex) {...

I marked the line that throws an exception in the above code. The stack
trace is:

Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Service class my.package.protocol.session.SessionControl does not
implement the logout method.
at org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:69)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.bindOperation(JaxWsServiceFactoryBean.java:294)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperation(JaxWsServiceFactoryBean.java:267)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:665)
[cxf-rt-wsdl-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:303)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:415)
[cxf-rt-wsdl-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:525)
[cxf-rt-wsdl-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)
[cxf-rt-wsdl-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
[cxf-rt-frontend-simple-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
[cxf-rt-frontend-simple-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)
[cxf-rt-frontend-simple-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:493)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:359)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]...
211 moreCaused by: java.lang.NoSuchMethodException:
my.package.protocol.session.SessionControl.logout(my.package.protocol.session.Logout,
javax.xml.ws.Holder)
at java.lang.Class.getMethod(Class.java:1670) [rt.jar:1.7.0_71]
at org.apache.cxf.jaxws.JAXWSMethodDispatcher.getImplementationMethod(JAXWSMethodDispatcher.java:89)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]
at org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:56)
[cxf-rt-frontend-jaxws-3.0.4.redhat-621084.jar:3.0.4.redhat-621084]...
225 more

Any clues as to what am I doing wrong would be much appreciated, thanks!
-- 

Agustí Tomàs