# webService **Repository Path**: note-java/web-service ## Basic Information - **Project Name**: webService - **Description**: webService的服务端,使用cxf - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-05-25 - **Last Updated**: 2025-09-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: webservice服务端搭建 ## README # 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 Apache-2.0 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.