简体   繁体   English

使用wsimport生成Web服务客户端类

[英]Generating webservice client classes using wsimport

I am trying to understand how to create web services, as I am new to them. 我正在尝试了解如何创建Web服务,因为我是他们的新手。 I am going through the following tutorial: 我正在阅读以下教程:

http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/ http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/

I have a question, and needs a bit of explanation. 我有一个问题,需要一些解释。 When we create Java Web Service Client via wsimport tool, it creates two files, HelloWorld.java, and HelloWorldImplService. 当我们通过wsimport工具创建Java Web Service客户端时,它将创建两个文件HelloWorld.java和HelloWorldImplService。 My question is that, we all ready have HelloWorld.java interface that we have created when creating the web service(the first interface that we create at the top of the tutorial), and now there is another HelloWorld.java interface, how does the two files get distinguished? 我的问题是,我们都已经准备好在创建Web服务时创建的HelloWorld.java接口(我们在本教程顶部创建的第一个接口),现在有了另一个HelloWorld.java接口,如何区分两个文件?

regards Harbir 问候哈比尔

Generating the client side code from the WSDL indeed also generates the HelloWorld interface. 实际上,从WSDL生成客户端代码也将生成HelloWorld接口。 In practice, when you create a web service client, all you have is the WSDL. 实际上,当您创建Web服务客户端时,您所拥有的只是WSDL。 You don't have the server side source code, as usually the server is run by some third party. 您没有服务器端源代码,因为通常服务器是由第三方运行的。 That is why this interface is generated when you generate client side code, but also when you generate server side code. 这就是为什么在生成客户端代码时以及在生成服务器端代码时都会生成此接口的原因。 But if you happen to own both the server side code and the client side code then you can consider putting the common source files in one shared module and eliminate duplicates. 但是,如果您同时拥有服务器端代码和客户端代码,则可以考虑将公共源文件放在一个共享模块中,并消除重复项。

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

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