diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..8f034fbe8e6e92f91765446b33c5397eebb22766 --- /dev/null +++ b/README.en.md @@ -0,0 +1,74 @@ + + +# README for Webservice Project + +This is a Spring Boot-based WebService project, primarily used to provide simple Web service interfaces. + +## Project Structure + +- `WebserviceApplication.java`: The main startup class for Spring Boot. +- `AuthInterceptor.java`: Used to implement SOAP message interception and authentication logic. +- `WsConfig.java`: Configures related CXF WebService beans. +- `WebServiceEntity.java`: A simple entity class that encapsulates user information (user ID and password). +- `WebServiceTest.java`: Defines the WebService interface. +- `WebServiceTestImpl.java`: Implements the business logic of the WebService interface. + +## Function Description + +1. **Parameterless Interface `getInfo()`** + - Purpose: Used to test whether the WebService is running properly. + - Return Value: Returns the string `"hello"`. + +2. **Parameterized Interface `requestSend(String webServiceEntity)`** + - Purpose: Receives a JSON-formatted string parameter and parses it into a `WebServiceEntity` object, then returns the received parameter content. + - Parameter Format: A JSON string should be provided, for example: `"{\"userId\":\"123\",\"password\":\"abc\"}"`. + - Return Value: Returns `"接收到了" + parameter content`. + +## Technologies Used + +- Spring Boot +- Apache CXF for building the WebService +- Jackson for JSON serialization and deserialization +- Maven as the build tool + +## Configuration Description + +1. The project is configured using `application.yml` (the content of the file is not currently found in the codebase). +2. The WebService interceptor (`AuthInterceptor`) performs authentication during request processing. + +## How to Run + +1. Build the project using Maven: + ```bash + mvn clean package + ``` +2. Start the service: + ```bash + java -jar target/webservice-0.0.1-SNAPSHOT.jar + ``` + +## Testing + +1. **Accessing the WSDL**: + - After starting the service, you can view the WSDL file at: `http://localhost:8080/test?wsdl`. + +2. **Testing with a SOAP Client**: + - Use the `WebServiceTest` interface for testing and invoke the `getInfo()` and `requestSend()` methods. + +3. **Testing with JUnit**: + - `WebserviceApplicationTests.java` contains a basic context loading test to ensure that the Spring context starts correctly. + +## Contribution Guide + +If you would like to contribute code to this project, please submit a Pull Request to this repository. + +## License + +This project is licensed under the MIT License. See the `LICENSE` file for details. + +## Notes + +- This project does not include detailed logging configuration; please add it as needed. +- The `application.yml` file does not show detailed content in the code map; please check the runtime environment configuration. + +For further details on the code implementation, refer to the specific source files. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..61cb29523a828c67561216ccccbbdfac7f22644f --- /dev/null +++ b/README.md @@ -0,0 +1,74 @@ + + +# Webservice 项目 README + +这是一个基于 Spring Boot 的 WebService 服务项目,主要用于提供简单的 Web 服务接口。 + +## 项目结构 + +- `WebserviceApplication.java`:Spring Boot 主启动类。 +- `AuthInterceptor.java`:用于实现 SOAP 消息的拦截与身份验证逻辑。 +- `WsConfig.java`:配置 CXF WebService 的相关 Bean。 +- `WebServiceEntity.java`:简单的实体类,封装了用户信息(用户 ID 和密码)。 +- `WebServiceTest.java`:定义 WebService 接口。 +- `WebServiceTestImpl.java`:实现 WebService 接口的业务逻辑。 + +## 功能说明 + +1. **无参接口 `getInfo()`** + - 作用:用于测试 WebService 是否正常运行。 + - 返回值:返回字符串 `"hello"`。 + +2. **有参接口 `requestSend(String webServiceEntity)`** + - 作用:接收一个 JSON 格式的字符串参数并解析为 `WebServiceEntity` 对象,随后返回接收到的参数内容。 + - 参数格式:需传入 JSON 字符串,例如:`"{\"userId\":\"123\",\"password\":\"abc"}"`。 + - 返回值:返回 `"接收到了" + 参数内容`。 + +## 使用技术 + +- Spring Boot +- Apache CXF 用于 WebService 的构建 +- Jackson 用于 JSON 序列化与反序列化 +- Maven 作为构建工具 + +## 配置说明 + +1. 项目使用 `application.yml` 进行配置(文件暂未在代码地图中找到内容)。 +2. WebService 的拦截器 (`AuthInterceptor`) 会在请求处理时进行身份验证。 + +## 启动方式 + +1. 使用 Maven 构建项目: + ```bash + mvn clean package + ``` +2. 启动服务: + ```bash + java -jar target/webservice-0.0.1-SNAPSHOT.jar + ``` + +## 测试方式 + +1. 访问 WSDL: + - 启动后可以通过 `http://localhost:8080/test?wsdl` 查看 WebService 的 WSDL 文件。 + +2. 使用 SOAP 客户端测试: + - 使用 `WebServiceTest` 接口进行测试,可调用 `getInfo()` 和 `requestSend()` 方法。 + +3. 使用 JUnit 测试: + - `WebserviceApplicationTests.java` 包含了简单的上下文加载测试,确保 Spring 上下文正常启动。 + +## 贡献指南 + +如果你希望为本项目贡献代码,请提交 Pull Request 到本仓库。 + +## 许可证 + +本项目遵循 MIT 许可证。详见 `LICENSE` 文件。 + +## 注意事项 + +- 本项目未提供详细的日志配置,需自行补充。 +- `application.yml` 文件未在代码地图中体现详细内容,请检查运行环境配置。 + +如需进一步了解代码实现,可查看具体源码文件。 \ No newline at end of file