1

I would like to generate java classes using the Apache CXG Maven plugin (WSLD2Java) for generating web service clients.

I have a configuration that works, but when I am offline OR the server is not available the generate sources fails.

The error is that it failed to create wsdl definition : from "wsdl location" ... Operation Timed Out.

From what I gather the tool can't access the service and so it can not get the XSD and in turn fails.

I have the WSDL and the XSD, how do I get the Maven plugin configured to use the local copies of the files rather than requesting extra data from the Server?

EDIT: I have got it "working" by editing the WSDL directly. I amended the XSD Import tag to > refer to the XSD which is located in the same folder as the WSDL.

Editing the WSDL solution seems hackie and I would prefer something I could configure. Any thoughts?

The POM file is setup as follows minus artefact id:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<dependencies>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxrs</artifactId>
        <version>2.7.10</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.16</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.surefire</groupId>
                    <artifactId>surefire-junit47</artifactId>
                    <version>2.16</version>
                </dependency>
            </dependencies>
            <configuration>
                <includes>
                    <include>**/*.class</include>
                </includes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <executable>java</executable>
                <arguments>
                    <argument>-classpath</argument>
                    <classpath />
                </arguments>
            </configuration>
        </plugin>
    </plugins>
</build>
<profiles>
    <profile>
        <id>CXF</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <dependencies>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxws</artifactId>
                <version>2.7.10</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-http</artifactId>
                <version>2.7.10</version>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-codegen-plugin</artifactId>
                    <version>2.7.10</version>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals><goal>wsdl2java</goal></goals>
                            <configuration>
                                <sourceRoot>${basedir}/target/generated-sources</sourceRoot>
                                <wsdlOptions>
                                    <wsdlOption>
                                        <wsdl>${basedir}/src/main/resources/wsdls/WebService.wsdl</wsdl>
                                        <wsdlLocation>classpath:WebService.wsdl</wsdlLocation>
                                    </wsdlOption>
                                </wsdlOptions>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Ian McShane
  • 340
  • 3
  • 10
  • Please show the full pom file and may be you have a link to your project (possibly github or so)? – khmarbaise May 11 '14 at 12:16
  • Hi @khmarbaise I have added the POM, not too exciting I am afraid which is in part why it was not there to start with. I have made a note that I got 'around' the problem by editing the XSD Import tag on the WSDL to refer to the XSD file. But I would prefer a solution that is configurable. – Ian McShane May 11 '14 at 16:46

0 Answers0