问题 wsimport无法正常工作


当我尝试使用时 wsimport 使用命令提示符下面的命令,它工作正常:

wsimport -d generated C:\Users\generated\wsdlfile.xml

但是,当我尝试使用时 wsimport 如下所示,它抛出以下错误:

wsimport -d generated https://example.com/exampleService.svc?wsdl

Failed to read the WSDL document: https://example.com/exampleService.svc?wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.

[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s): At least one WSDL with at least one service definition needs to be provided.

        Failed to parse the WSDL.

我可以从浏览器访问URL,同样的事情是从其他系统(从我的PC)开始。可能是什么原因?


2622
2017-08-29 11:09


起源



答案:


我已通过禁用所有代理设置在Windows上解决了此问题,如下所示:

Internet Options > Connections > Lan Settings > Disable all check boxes

注意:只是添加localhost或我的IP地址作为我的代理设置的例外不适合我。


8
2018-03-03 14:52





这似乎是您正在使用的Java版本的问题...

确保您使用java版“1.7.x”来解决此问题。


3
2017-12-19 03:55



似乎存在代理问题。 - Kartic


答案:


我已通过禁用所有代理设置在Windows上解决了此问题,如下所示:

Internet Options > Connections > Lan Settings > Disable all check boxes

注意:只是添加localhost或我的IP地址作为我的代理设置的例外不适合我。


8
2018-03-03 14:52





这似乎是您正在使用的Java版本的问题...

确保您使用java版“1.7.x”来解决此问题。


3
2017-12-19 03:55



似乎存在代理问题。 - Kartic


我有同样的问题,在我的例子中,问题是WSDL文件的编码。

尝试打开 https://example.com/exampleService.svc?wsdl 来自浏览器。如果可以完全解析,您将看到所有xml内容。如果没有,至少Firefox会指出问题出在哪里。

希望它在这种情况下帮助某人


3
2018-01-19 07:30





尝试将此选项设置为wsimport: -XdisableSSLHostnameVerification 哪一个

在获取wsdls时禁用SSL主机名验证。


0
2017-10-02 07:18





在pom.xml下面使用。

    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>1.9</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <phase>generate-sources</phase>
                </execution>
            </executions>
            <configuration>

                <!-- Keep generated files -->
                <keep>true</keep>
                <!-- Package name -->
                <packageName>org.example.echo.service.skeleton</packageName>
                <!-- generated source files destination -->
                <sourceDestDir>src/main/java</sourceDestDir>

                <wsdlUrls>
                    <wsdlUrl>
                        **http://localhost:8080/soapWebService/services/PersonServiceImpl?wsdl**
                    </wsdlUrl>
                </wsdlUrls>
            </configuration>
        </plugin>
    </plugins>

</build>


0
2017-12-03 19:35