简体   繁体   English

如何在https地址的wsdl中生成Eclipse中的Web服务客户端?

[英]How to generate a web service client in Eclipse from a wsdl at an https address?

I can generate a client from 我可以从中生成一个客户端

http://localhost:8080/service?wsdl

just fine, but now I want to generate a client from 很好,但现在我想从中生成一个客户端

https://localhost:8081/service?wsdl

and Eclipse says the location is invalid, and when Eclipse makes the attempt my Jetty server says Eclipse说这个位置是无效的,当Eclipse尝试我的Jetty服务器时说

javax.net.ssl.SSLException: Received fatal alert: certificate_unknown javax.net.ssl.SSLException:收到致命警报:certificate_unknown

I can easily navigate to the wsdl in my browser after confirming the security exception, so it's definitely there. 确认安全异常后,我可以在浏览器中轻松导航到wsdl,所以它肯定存在。

I've tried downloading the wsdl to my local file system, but I still can't generate it from there because the wsdl contains a reference to other https locations, eg. 我已经尝试将wsdl下载到我的本地文件系统,但我仍然无法从那里生成它因为wsdl包含对其他https位置的引用,例如。

<xsd:import namespace="http://my.service.namespace/" schemaLocation="https://localhost:8081/serviceSchema?xsd=1"/>

I've modified eclipse.ini to contain the following lines: 我修改了eclipse.ini以包含以下行:

-Djavax.net.ssl.trustStore="/path/to/my/truststore/.keystore"
-Djavax.net.ssl.trustStorePassword="mytruststorepassword"
-Djavax.net.ssl.keyStore="/path/to/my/keystore/.keystore"
-Djavax.net.ssl.keyStorePassword="mykeystorepassword"

to no avail. 无济于事。 Eclipse does not appear to have any preference settings related to this either. Eclipse似乎没有任何与此相关的首选项设置。 Is there any way to do this through eclipse, or will I have to use some external tool? 有没有办法通过eclipse做到这一点,还是我必须使用一些外部工具?

EDIT: For others with the same issue, here's how I solved it. 编辑:对于有同样问题的其他人,这是我如何解决它。

  1. Navigate to the wsdl in your browser, and download it to your file system. 导航到浏览器中的wsdl,然后将其下载到文件系统。
  2. Navigate to anything it depends on, and download it as well. 导航到它所依赖的任何内容,并下载它。
  3. Open the dependency you just downloaded with a browser and copy its new location, eg. 使用浏览器打开刚下载的依赖项并复制其新位置,例如。

    file:///path/to/my/schema/service.xsd 文件:///path/to/my/schema/service.xsd

  4. Paste this into your downloaded wsdl file where its https address is, repeat for any other schema, and save. 将其粘贴到您下载的wsdl文件中,其中https地址为,对任何其他模式重复,然后保存。
  5. Copy the file location of your wsdl file, as above 复制wsdl文件的文件位置,如上所示
  6. In Eclipse, generate a New->Other...->Web Service Client and paste the file location into the service definition, and it should work. 在Eclipse中,生成一个New-> Other ...-> Web Service Client并将文件位置粘贴到服务定义中,它应该可以工作。 Thanks to everyone for the help! 感谢大家的帮助!

将wsdl保存到本地文件系统并从那里生成,它似乎是Eclipse中的一个错误,请检查链接。

I had the same problem and the link from the accepted answer does not work for me, but i generated the service using the following steps: 我有同样的问题,接受的答案中的链接对我不起作用,但我使用以下步骤生成服务:

  1. Save the wsdl as a local file. 将wsdl保存为本地文件。 (Such as myService.wsdl) (例如myService.wsdl)
  2. Copy the wsdl file to the project. 将wsdl文件复制到项目中。
  3. Right click the wsdl file -> [ Web Services ] -> [ Generate Client ] 右键单击wsdl文件 - > [Web服务] - > [生成客户端]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM