当我尝试使用时 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)开始。可能是什么原因?
我已通过禁用所有代理设置在Windows上解决了此问题,如下所示:
Internet Options > Connections > Lan Settings > Disable all check boxes
注意:只是添加localhost或我的IP地址作为我的代理设置的例外不适合我。
我已通过禁用所有代理设置在Windows上解决了此问题,如下所示:
Internet Options > Connections > Lan Settings > Disable all check boxes
注意:只是添加localhost或我的IP地址作为我的代理设置的例外不适合我。
我有同样的问题,在我的例子中,问题是WSDL文件的编码。
尝试打开 https://example.com/exampleService.svc?wsdl
来自浏览器。如果可以完全解析,您将看到所有xml内容。如果没有,至少Firefox会指出问题出在哪里。
希望它在这种情况下帮助某人
尝试将此选项设置为wsimport: -XdisableSSLHostnameVerification
哪一个
在获取wsdls时禁用SSL主机名验证。
在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>