简体   繁体   English

从WSDL自动生成Web服务JAX-WS

[英]Auto-generate web-service JAX-WS from WSDL

I have to create a web service equal to an existing one. 我必须创建一个与现有服务相等的Web服务。 The WSDL must be the same because they do not want to change the client. WSDL必须相同,因为它们不想更改客户端。 How can I do this? 我怎样才能做到这一点?

Also, how I can do with JAX-WS with Maven? 另外,如何在Maven中使用JAX-WS?

Recreating a Web Service from WSDL 从WSDL重新创建Web服务

Based on the book, Java Web Services: Up and Running by Martin Kalin , one way to recreate a service from a WSDL is by starting at the client stubs. 根据Martin Kalin撰写的《 Java Web服务:启动和运行 》一书,从WSDL重新创建服务的一种方法是从客户端存根开始。

wsimport -keep -p <your wsdl>

The item of interest will be the generated SEI code . 感兴趣的项目将是生成的SEI代码

You can remove the client-specific annotations, replace them with server-side annotations and use this as your base interface when rebuilding the web service. 您可以删除特定于客户端的注释,将其替换为服务器端注释,并在重建Web服务时将其用作基本接口。

With the SEI at your disposal, you can easily create your own SIB and publish it. 使用SEI,您可以轻松创建自己的SIB并将其发布。

Important Note: Of course, you will not see the logic behind their SIB, that will not be available to you at any point. 重要说明:当然,您不会看到其SIB背后的逻辑,这在任何时候都将不可用。 But the above approach will hopefully be useful for you since you want to create your own implementation anyway. 但是上述方法对您很有用,因为您仍然想创建自己的实现。

JAX-WS with Maven 带有Maven的JAX-WS

This deserves a separate question on its own. 这值得一个单独的问题。 Maven has a jax-ws plugin (artifact ID: jaxws-maven-plugin) for you to start with. Maven为您提供了一个jax-ws插件(工件ID:jaxws-maven-plugin)。 More info at this link: Using JAX-WS with Maven . 此链接的更多信息:结合使用JAX-WS和Maven

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

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