【问题标题】:wsimport not workingwsimport 不工作
【发布时间】:2014-08-29 11:09:56
【问题描述】:

当我尝试在命令提示符下使用以下命令使用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)上也可以进行同样的操作。可能是什么原因?

【问题讨论】:

    标签: wsdl wsimport


    【解决方案1】:

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

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

    注意:仅添加 localhost 或我的 IP 地址作为代理设置的例外对我不起作用。

    【讨论】:

    • 这行得通,但谁能解释为什么?任何其他解决方法。
    【解决方案2】:

    我遇到了同样的问题,就我而言,问题在于 WSDL 文件的编码。

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

    希望对遇到这种情况的人有所帮助

    【讨论】:

      【解决方案3】:

      这似乎是您使用的 java 版本的问题...

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

      【讨论】:

      • 好像有代理问题。
      【解决方案4】:

      尝试将此选项设置为 wsimport:-XdisableSSLHostnameVerification which

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

      【讨论】:

        【解决方案5】:

        在 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>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2012-08-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-09-30
          • 2012-08-19
          • 1970-01-01
          相关资源
          最近更新 更多