Spring Maven - 无法生成WSDL。

问题描述 投票:4回答:1

我试图从一个URL生成WSDL,但我无法做到。我的POM.xml文件是这样配置的。

<?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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.springframework</groupId>
<artifactId>gs-consuming-web-service</artifactId>
<version>0.1.0</version>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.2.RELEASE</version>
</parent>

<properties>
    <!-- use UTF-8 for everything -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-xjc</artifactId>
        <version>2.2.5</version>
    </dependency>
    <dependency>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.12.3</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <!-- tag::wsdl[] -->
        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.12.3</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaLanguage>WSDL</schemaLanguage>
                <generatePackage>hello.wsdl</generatePackage>
                <schemas>
                    <schema>
                        <url>http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl</url>
                    </schema>
                </schemas>
            </configuration>
        </plugin>
        <!-- end::wsdl[] -->
    </plugins>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        org.jvnet.jaxb2.maven2
                                    </groupId>
                                    <artifactId>
                                        maven-jaxb2-plugin
                                    </artifactId>
                                    <versionRange>
                                        [0.8.0,)
                                    </versionRange>
                                    <goals>
                                        <goal>generate</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

<repositories>
    <repository>
        <id>spring-releases</id>
        <name>Spring Releases</name>
        <url>https://repo.spring.io/libs-release</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-releases</id>
        <url>https://repo.spring.io/libs-release</url>
    </pluginRepository>
</pluginRepositories>

</project>

我解决了POM. xml文件中出现的所有错误,并且jaxb2也被识别了。当我运行 "maven generate-sources "时,得到以下输出。

[WARNING] URI [wsf.cdyne.comWeatherWSWeather.asmx?wsdl]似乎是一个绝对的HTTP或HTTPS URL。只有在URL可以访问并且服务器正确返回[Last-Modified]头的情况下,才有可能获得最后的修改时间戳。这种方法不可靠,很可能失败。在这种情况下,最后的修改时间戳将被认为是未知的。 [ERROR] 无法从HTTP URL连接中检索URI [wsf.cdyne.comWeatherWSWeather.asmx?wsdl]的最后修改时间戳。Last-Modified]头可能没有正确设置。 警告] URI[]的最后一次修改是在[wsf.cdyne.comWeatherWSWeather.asmx?wsdl]的基础上进行的。http:/wsf.cdyne.comWeatherWSWeather.asmx?wsdl] 是不知道的。

但我不知道如何解决这个问题。同样的肥皂服务在这个 春季指南

(我不得不在错误信息中更改网址,因为我不能发布超过2个链接)

java spring web-services maven wsdl
1个回答
1
投票

M2Eclipse有问题 最好的方法是在命令行中使用maven或者使用其他IDEA。

© www.soinside.com 2019 - 2024. All rights reserved.