5

I am currently in the process of replacing the IBM WebService framework with Axis2. When generating the code from the WSDL file, I use the Maven plugin WSDL2Code. However, the code created is always wrong. Or rather, the packagenames are always wrong, which in turn makes every method called uncallable (creating even more errors, up to 10.000+ errors in eclipse).

Here's an example of what is actually going on (this is just an example I made specifically to get advice):

      <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
                <execution>
                    <id>Test</id>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                    <configuration>
                        <packageName>test.testpackage</packageName>
                        <databindingName>xmlbeans</databindingName>
                        <wsdlFile>${basedir}/wsdl/service.wsdl</wsdlFile>
                        <outputDirectory>${basedir}/testdirectory</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

In theory, this should generate code with the package name "test.testpackage" in the directory testdirectory/test/testpackage. However, instead it creates the following package: Src.test.testpackage in the directory testdirectory.src.test.testpackage. It always adds a "src" to both package name and directory - if I change the package name to src.test.testpackage, it will generate the following package: src.src.test.testpackage.

This, of course, leads to a huge problem, because every generated file has the following error: "The declared package "src.test.testpackage" does not match the expected package "src.src.test.testpackage"

I'm at a complete loss here. I simply can't find any reason at all why it should add "src" everywhere. I've noticed an auto-generated build.xml file containing a value called sourcedirectory = x/src (or something similar), but there's nothing I can do to affect this value (trying to change it and then save the file makes no difference, obviously, since it's just generated again the next time I run maven).

Oh, and I generally use the command "mvn clean install" and version 1.4.1 of WSDL2Code, so it's not one of the old wsdl2code:wsdl2code bugs.

If anyone has any idea of what is actually wrong here, I'd greatly appreciate it.

Thanks in advance.

5 Answers5

9

Version 1.4.1 has a few more configuration options that are not really documented (have a look at the the source of org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo)...

Just use <flattenFiles>true</flattenFiles> - that should solve your problem :-)

2

This question is quite old, so I don't know if you're still having the problem...

I would recommend using Axistools Maven Plugin instead, it worked great in our case.

Cavva79
  • 379
  • 6
  • 17
Thomas Marti
  • 940
  • 9
  • 12
0

This is connected with those "genius" of(or user of) maven/axis2 that practically takes decisions for you ... see this: [Axis2 mailing list entry][1]

[1]: http://markmail.org/search/?q=[Axis2]+indrit#query:[Axis2 Mailing List entry]%20indrit+page:1+mid:a34wbp7l3pljagsz+state:results

Indrit
  • 99
  • 1
  • 9
0

Maybe 'src' is part of ${basedir} ?

leppie
  • 115,091
  • 17
  • 196
  • 297
0

I'm afraid not. Even if it was, the strange problem shouldn't occur then - the path would then be correct being testdirectory/src/test/testpackage, thus causing no problem with the package name. The problem now arises because it is placed in a directory the package does not expect - it expects ${basedir}/testdirectory/insert.package.here.divided.by./, but instead it gets ${basedir}/testdirectory/src/insert.package.here.divided.by./.

The src should not be present in that part of the path.