#!/usr/bin/env python3 """ Simple non-interactive test script for JAX-WS Hello World Service """ import sys from test_hello_world import HelloWorldClient def test_service(name=None): """ Simple test function Args: name: Optional name to test with. If None, uses "World" """ if name is None: name = "World" if len(sys.argv) < 2 else sys.argv[1] client = HelloWorldClient() # Check WSDL print(f"Checking service availability...") wsdl_ok, wsdl_msg = client.check_wsdl() if not wsdl_ok: print(f"[FAIL] {wsdl_msg}") sys.exit(1) print(f"[OK] {wsdl_msg}") # Call service print(f"\nCalling service with: '{name}'") result = client.call_hello_world(name) print(f"Response: {result}") # Verify response format expected_start = f"Hello World, {name}" if result.startswith(expected_start): print("\n[PASS] Test PASSED!") return 0 else: print(f"\n[FAIL] Test FAILED! Expected response to start with: '{expected_start}'") return 1 if __name__ == "__main__": exit_code = test_service() sys.exit(exit_code)