JakartaJEEWebDevelopment

Jakarta JEE8 Enterprise Web Development

View on GitHub

7. Testing Our SOAP Web Service Endpoints

Introduction

In this course, you will learn how to effectively test a SOAP endpoint. SOAP (Simple Object Access Protocol) relies on a contract-first approach using XSD/XML, which can be challenging. We will guide you through the process of overcoming these challenges and ensure your testing is thorough and efficient.

1: How to Test a SOAP Endpoint

Understanding SOAP Endpoints

Overcoming the XSD/XML Contract-First Challenge

2: Choosing a Testing Tool

  1. Eclipse IDE Plugin Tools
    • Advantages: Integrated development environment, supports various plugins for SOAP testing.
    • Usage: Suitable for developers who are already using Eclipse for development.
  2. Browser Development Tools
    • Advantages: Easy to access, no need for additional software.
    • Usage: Quick checks and simple tests, though not as powerful as dedicated tools.
  3. Freeware Tools
    • SOAP UI:
      • Advantages: Comprehensive tool specifically for SOAP and REST testing, with support for automation and scripting.
      • Usage: Ideal for detailed testing, including complex scenarios.
    • Postman:
      • Advantages: Originally designed for REST, but can also be used for SOAP with some configuration.
      • Usage: Great for users familiar with Postman who need to test both REST and SOAP.

3: Using Our Chosen Testing Tool

Testing a SOAP Service Using SOAP UI

Step-by-Step Guide

  1. Download and Install SOAP UI
    • Go to the SOAP UI website and download the latest version.
    • Follow the installation instructions for your operating system.
  2. Create a New SOAP Project
    • Open SOAP UI and click on File > New SOAP Project.
    • Enter the project name and the initial WSDL URL.
    • SOAP UI will parse the WSDL and generate the required request templates.
  3. Understanding the Interface
    • Project Tree: Displays your projects, interfaces, operations, and requests.
    • Request Editor: Where you compose and send your SOAP requests.
    • Response Viewer: Displays the server responses.
  4. Composing a Request
    • Expand the project tree to find the specific operation you want to test.
    • Double-click on the request to open it in the Request Editor.
    • Fill in the required fields with appropriate values.
  5. Sending the Request
    • Click on the Submit button in the Request Editor.
    • SOAP UI will send the request to the endpoint and display the response in the Response Viewer.
  6. Validating the Response
    • Ensure the response matches the expected structure and values as defined in the WSDL/XSD.
    • Use assertions to automate response validation (e.g., Schema Compliance, XPath Match).
  7. Handling Errors and Debugging
    • Analyze error messages to understand issues with the request or response.
    • Use the raw view to see the exact request sent and the response received for troubleshooting.

Section 4: References

  1. SOAP UI Documentation
  2. W3C XML Schema Definition Language (XSD) 1.1