# Test Scripts for JAX-WS Hello World Service This folder contains test scripts to interact with the JAX-WS Hello World Service. ## Python Test Script ### Prerequisites - Python 3.6 or higher - pip (Python package installer) ### Installation 1. **Install Python dependencies:** **Windows:** ```cmd cd scripts pip install -r requirements.txt ``` **Linux/Mac:** ```bash cd scripts pip3 install -r requirements.txt ``` ### Running the Test Script Make sure the JAX-WS service is running (using Docker or traditional setup). **Windows:** ```cmd python test_hello_world.py ``` **Linux/Mac:** ```bash python3 test_hello_world.py # OR chmod +x test_hello_world.py ./test_hello_world.py ``` ### What the Script Does The `test_hello_world.py` script: 1. **Checks WSDL availability** - Verifies the service is running 2. **Tests with multiple names** - Calls the service with predefined test cases 3. **Interactive mode** - Allows you to enter custom names and see responses in real-time ### Example Output ``` ============================================================ JAX-WS Hello World Service Test Client ============================================================ 1. Checking WSDL availability... WSDL is accessible 2. Testing Hello World Service... Calling service with name: 'World' Response: Hello World, World! Calling service with name: 'Python Client' Response: Hello World, Python Client! Calling service with name: 'JAX-WS User' Response: Hello World, JAX-WS User! Calling service with name: 'Docker' Response: Hello World, Docker! 3. Interactive Mode -------------------------------------------------------- Enter a name (or 'quit' to exit): John Response: Hello World, John! Enter a name (or 'quit' to exit): quit ============================================================ Test completed! ============================================================ ``` ## Using the HelloWorldClient Class You can also use the `HelloWorldClient` class in your own Python scripts: ```python from test_hello_world import HelloWorldClient # Create client client = HelloWorldClient() # Check if service is available is_available, message = client.check_wsdl() print(message) # Call the service response = client.call_hello_world("Your Name") print(response) # Output: Hello World, Your Name! ``` ## Troubleshooting ### Service Not Available If you get a connection error: 1. Make sure the Docker container is running: ```bash docker ps | grep jaxws ``` 2. Check if the service is accessible: ```bash curl http://localhost:8080/jaxws-hello-world/hello?wsdl ``` 3. Restart the service: ```bash docker-compose restart ``` ### Python Not Found If you get "python: command not found": - **Windows**: Use `python` or `py` command - **Linux/Mac**: Use `python3` command ### Dependencies Not Installing If pip install fails: 1. Make sure pip is up to date: ```bash python -m pip install --upgrade pip ``` 2. Try installing with sudo (Linux/Mac only): ```bash sudo pip3 install -r requirements.txt ``` 3. Use a virtual environment: ```bash python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt ```