Java 如何从 WSDL URL 生成 WSDL 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21090111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I generate a WSDL file from a WSDL URL?
提问by emre
My problem is that I created a web service client with wsimportand when creating its service object, it fails because of the HTTPS, like that:
我的问题是我用wsimport创建了一个 web 服务客户端,在创建它的服务对象时,它由于 HTTPS 而失败,如下所示:
MyService_Service service = new MyService_Service(
new URL("https://www.aaa.com/myws/MyService?WSDL"));
So, I am trying to initialize a service object from a WSDL file, but how can I create a WSDL file from that URL "https://www.aaa.com/myws/MyService?WSDL"?
因此,我正在尝试从 WSDL 文件初始化服务对象,但是如何从该 URL“ https://www.aaa.com/myws/MyService?WSDL”创建 WSDL 文件?
Thanks a lot.
非常感谢。
回答by M21B8
Navigate to the URL in a browser and save the file it generates. You'll need to make sure you also save any schemas imported by the wsdl.
在浏览器中导航到 URL 并保存它生成的文件。您需要确保还保存了 wsdl 导入的所有模式。
回答by Arunas Junevicius
JAX-WS needs WSDL document every time one initializes service instance. Since issues like one you described might occur, its possible to package WSDL and associated XSD schemas, so that they would be accessible no matter what.
I'd prefer using XML catalogs, since there would be no need to change WSLD document or XSD schema.
Another option would be to specify @WebService wsdlLocation property and set path to WSDL file. Though if path to XSD schemas is absolute you'll have to modify WSLD document.
If you're working with wsimport utility version that supports clientjar option, that might save you some time.
每次初始化服务实例时,JAX-WS 都需要 WSDL 文档。由于可能会出现您描述的问题,因此可以打包 WSDL 和关联的 XSD 模式,以便无论如何都可以访问它们。
我更喜欢使用XML 目录,因为不需要更改 WSLD 文档或 XSD 架构。
另一种选择是指定 @WebService wsdlLocation 属性并设置 WSDL 文件的路径。尽管如果 XSD 模式的路径是绝对的,您将不得不修改 WSLD 文档。
如果您正在使用支持 clientjar 选项的 wsimport 实用程序版本,这可能会为您节省一些时间。
Creates the jar file of the generated artifacts along with the WSDL
metadata required for invoking the web service.