# 将代码公开为 Web 服务

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/idea/llms.txt).

假设您有一段实现某些功能的代码，您希望通过特定协议在 Web 上提供这些功能。 在这种情况下，您需要将现有代码转换成 Web 服务并部署。 该操作会更新 Web 服务描述符，并在需要时生成额外的部署代码。 每次修改任何 Web 服务方法签名或添加、删除新方法时都需要执行此操作。

Procedure: 暴露 类

1. 将文本光标置于编辑器中的类名处，然后按 `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Alt+Enter` (NetBeans), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)) 或点击黄色灯泡图标 ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.codeInsight.intentionBulb.png)。

2. 从建议列表中选择   将类暴露为 Web 服务  。

3. 在打开的 [Expose Class As Web Service](expose-class-as-web-service-dialog.html) 对话框中，指定以下内容：

* Web 服务的名称和 URL 地址。

* 访问 Web 服务公共操作时使用的协议和编码样式。

* 类型信息，包括构成 Web 服务接口的名称、操作、参数和数据。

IntelliJ IDEA 会自动将服务描述添加到  `server-config.wsdd`  文件中。

## See also

### 概念

[Web 服务](web-services.html) [Web 服务客户端](web-service-clients.html)

### 过程

[Web 服务](web-services.html)

### 参考

[将类暴露为 Web 服务对话框](expose-class-as-web-service-dialog.html) [Web 服务引用](web-services-reference.html)

