Free, public SOAP web services example

Last update: November 7, 2026
Version 4.2.0

Introduction

TL;DR

If you want a simple, online web service, here is a WSDL for it:

Unknown

Firefox browser does not show us the WSDL document, just a blank page, so it is better to use the View Page Source menu to view the document.

Purpose of this site

Creating this site has two purposes. One is to provide a free, public example SOAP web service for learning, prototyping, teaching, testing, demonstrating tools, libraries or technologies. You may use this web service in blog posts, tutorials, videos. I would like to operate this website for reference in the long run.

The second purpose is to present a Java server and example client applications in different programming languages, using different libraries. You can find the source code of the examples on GitHub what I am going to update regularly for the latest versions.

If you have a question, open an issue.

About SOAP web services

SOAP web services may be considered as best practices to exchange data between different applications, based on XML and mostly HTTP(S) protocol. Because of the formats and protocols are text based, they are readable by most of the applications and by humans as well. Web services became very popular, and easy to use on any platform and with any programming language.

SOAP web services are based on OASIS and W3C standards, and the WS-I organization provides some useful profiles to increase interoperability.

SOAP is a messaging protocol specifying an XML-based message format. This is called the SOAP envelope, encapsulating the message content. The web service is described by a WSDL document, which is based on XML as well.

Sometime the SOAP web services are considered legacy solutions today, because the RESTful web services are becoming increasingly popular. Also this is true, but the SOAP web services will be along for a long time.

Diagram: the client sends a SOAP request with the name John Doe in an HTTP POST, and the server returns a SOAP response with the message Hello John Doe! and HTTP 200 OK

Details

Request and response

The web service accepts a name, and gives back a welcome message. (The service accepts only POST HTTP requests so you may not use it in a browser directly.)

Post an XML document to the service address in the following format. The content of the Name tag may be freely rewritten.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
       <HelloRequest xmlns="http://learnwebservices.com/services/hello">
          <Name>John Doe</Name>
       </HelloRequest>
   </soapenv:Body>
</soapenv:Envelope>

This is the response provided by the web service. The Message tag contains the response message based on the request.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
       <HelloResponse xmlns="http://learnwebservices.com/services/hello">
          <Message>Hello John Doe!</Message>
       </HelloResponse>
   </soap:Body>
</soap:Envelope>

Error handling

In case a web service fails to process the SOAP message, it returns a SOAP fault.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>Unmarshalling Error: Unexpected '&lt;' character in element (missing closing '>'?)
 at [row,col {unknown-source}]: [6,13]</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Playground

Try the web service right here in your browser. Edit the request on the left, then press the Send button to see the response of the web service on the right. Also try what happens if you send an invalid request!

Response
The response appears here after you press the Send button.

WSDL

The WSDL document describes the web service. In a machine-readable form, it specifies the protocol and address of the web service, and the messages it accepts and returns. The request and response messages must conform to the WSDL.

<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:tns="http://learnwebservices.com/services/hello" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    targetNamespace="http://learnwebservices.com/services/hello"
    name="HelloEndpointService">
  <wsdl:types>
    <xs:schema 
        xmlns="http://learnwebservices.com/services/hello" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema"         
        targetNamespace="http://learnwebservices.com/services/hello"
        attributeFormDefault="unqualified" 
        elementFormDefault="qualified">
      <xs:complexType name="helloRequest">
        <xs:sequence>
          <xs:element name="Name" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="helloResponse">
        <xs:sequence>
          <xs:element name="Message" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
      <xs:element name="HelloRequest" nillable="true" type="helloRequest"/>
      <xs:element name="HelloResponse" nillable="true" type="helloResponse"/>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="SayHelloResponse">
    <wsdl:part element="tns:HelloResponse" name="HelloResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="SayHello">
    <wsdl:part element="tns:HelloRequest" name="HelloRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="HelloEndpoint">
    <wsdl:operation name="SayHello">
      <wsdl:input message="tns:SayHello" name="SayHello">
    </wsdl:input>
      <wsdl:output message="tns:SayHelloResponse" name="SayHelloResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="HelloEndpointServiceSoapBinding" type="tns:HelloEndpoint">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="SayHello">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="SayHello">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="SayHelloResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="HelloEndpointService">
    <wsdl:port binding="tns:HelloEndpointServiceSoapBinding" name="HelloEndpointPort">
      <soap:address location="https://apps.learnwebservices.com/services/hello"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
Structure of the WSDL
types
schema
message
part
portType
operation
binding
operation
service
port

Knowledge check

Use the following three questions to check how well you know SOAP web services. You can find the answers in the sections above.

1. What does the client get if it sends an invalid message to the web service?

In case of an error, the response is a SOAP fault, and its faultcode and faultstring elements describe the error. See the Error handling section.

2. Which element of the SOAP envelope contains the HelloRequest element?

The content of the message goes into the Body element inside the Envelope element. See the Request and response section.

3. Which part of the WSDL document contains the address of the web service?

The port inside the service element contains the address, in the location attribute of the soap:address element. See the WSDL section.

Server application

A Spring Boot server application serves the sample web services.

Source code

The application is available on Docker Hub.

If you would like to run with Docker, just use the following command.

docker run -p 8080:8080 --name my-lwsapp vicziani/lwsapp

Then check the http://localhost:8080 address!

Client implementations

To call the web service with SoapUI, create a new SOAP project in the application, and paste the URL of the WSDL document https://apps.learnwebservices.com/services/hello?WSDL into the Initial WSDL input field. SoapUI will process the WSDL file, and generate an example request. On the left side of the panel choose the SayHello operation, then the Request 1 example request. Give a name value in the Name tag (replacing the ? sign), then press the Submit request button.

Click on the picture to view the full animation that shows how to create a request with SoapUI!

SoapUI window with the SayHello request on the left and the HelloResponse on the right

SoapUI project file

Click on the picture to view the full animation that shows how to create a Postman project!

Postman window with the body of the SayHello POST request and the HelloResponse with status 200 OK

Postman Collection file

Apache JMeter may be used to test performance of SOAP web services.

Click on the picture to view the full animation that shows how to create a JMeter project.

JMeter test plan with an HTTP Request element that posts a SOAP envelope to /services/hello

JMeter project file

Use the following command to call the web service with curl.

curl --request POST --header "Content-Type: text/xml;charset=UTF-8"  \
  --data '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/> \
  <soapenv:Body> \
  <HelloRequest xmlns="http://learnwebservices.com/services/hello"><Name>John Doe</Name></HelloRequest> \
  </soapenv:Body></soapenv:Envelope>' \
  https://apps.learnwebservices.com/services/hello

Use the following command to call the web service with Wget.

wget -qO - --header "Content-Type: text/xml;charset=UTF-8"  \
  --post-data '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/> \
  <soapenv:Body> \
  <HelloRequest xmlns="http://learnwebservices.com/services/hello"><Name>John Doe</Name></HelloRequest> \
  </soapenv:Body></soapenv:Envelope>' \
  https://apps.learnwebservices.com/services/hello

Use the following command to call the web service with HTTPie.

echo '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/> \
  <soapenv:Body> \
  <HelloRequest xmlns="http://learnwebservices.com/services/hello"><Name>John Doe</Name></HelloRequest> \
  </soapenv:Body></soapenv:Envelope>' | \
  http -b POST https://apps.learnwebservices.com/services/hello  'Content-Type:text/xml;charset=UTF-8'

A .http file is a plain text file that contains one or more HTTP requests and can be executed by tools such as Visual Studio Code, JetBrains IDEs, etc.

### Sample request
POST https://apps.learnwebservices.com/services/hello

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
       <HelloRequest xmlns="http://learnwebservices.com/services/hello">
          <Name>John Doe</Name>
       </HelloRequest>
   </soapenv:Body>
</soapenv:Envelope>

The following source code demonstrates calling the web service using JAX-WS RI library and jaxws-maven-plugin Maven plugin.

The source code is the same when using CXF with cxf-codegen-plugin Maven plugin.

HelloEndpointService service = new HelloEndpointService();
HelloEndpoint port = service.getHelloEndpointPort();
HelloRequest request = new HelloRequest();
request.setName("John Doe");
HelloResponse response = port.sayHello(request);
System.out.println(response.getMessage());

Source code with JAX-WS RI

Source code with CXF

The following source code demonstrates calling the web service using Spring Web Services library and maven-jaxb2-plugin Maven plugin.

HelloRequest helloRequest = new HelloRequest();
helloRequest.setName("John Doe");

JAXBElement<HelloResponse> response = (JAXBElement<HelloResponse>)
        webServiceTemplate.marshalSendAndReceive(new ObjectFactory().createHelloRequest(helloRequest));

System.out.println(response.getValue().getMessage());

Source code

The following source code demonstrates calling the web service using Apache Axis2/Java library, Axis2 Databinding Framework and axis2-wsdl2code-maven-plugin Maven plugin.

HelloEndpointServiceStub stub =
        new HelloEndpointServiceStub();

HelloEndpointServiceStub.HelloRequest helloRequest =
        new HelloEndpointServiceStub.HelloRequest();
helloRequest.setName("John Doe");

HelloEndpointServiceStub.HelloRequestE sayHelloE =
        new HelloEndpointServiceStub.HelloRequestE();
sayHelloE.setHelloRequest(helloRequest);

HelloEndpointServiceStub.HelloResponseE sayHelloResponseE =
        stub.sayHello(sayHelloE);
System.out.println(sayHelloResponseE
        .getHelloResponse()
        .getMessage());

Source code

The following source code demonstrates calling the web service using groovy-wslite library.

@Grab('com.github.groovy-wslite:groovy-wslite:1.1.2')
import wslite.soap.*

def client = new SOAPClient('https://apps.learnwebservices.com/services/hello')
def response = client.send {
    body {
        HelloRequest('xmlns':'http://learnwebservices.com/services/hello') {
          Name("John Doe")
        }
    }
}

println(response.HelloResponse.Message)

Source code

The following source code uses the Zeep framework to call the web service.

wsdl = 'https://apps.learnwebservices.com/services/hello?wsdl'
client = zeep.Client(wsdl=wsdl)
request = 'John Doe'
print(client.service.SayHello(request))

Source code

It is possible to call a web service from JavaScript running in the browser when it is in the same domain, or the Cross-Origin Resource Sharing (CORS) is properly configured.

const url = "https://apps.learnwebservices.com/services/hello";
const request = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <HelloRequest xmlns="http://learnwebservices.com/services/hello">
            <Name>John Doe</Name>
        </HelloRequest>
    </soapenv:Body>
 </soapenv:Envelope>`;

const fetchData = {
  method: "POST",
  body: request,
};

fetch(url, fetchData)
  .then(function (response) {
    return response.text();
  })
  .then(function (xml) {
    const xmlDoc = new DOMParser().parseFromString(xml, "text/xml");
    console.log(
      xmlDoc.getElementsByTagNameNS(
        "http://learnwebservices.com/services/hello",
        "Message"
      )[0].textContent
    );
  })
  .catch(function (error) {
    console.log("Error calling webservice: " + error);
  });

Source code

The following source code demonstrates how to call a web service with Node.js and SOAP package.

const soap = require("soap");
const url = "https://apps.learnwebservices.com/services/hello?wsdl";
const args = { Name: "John Doe" };
soap.createClient(url, function (err, client) {
  client.SayHello(args, function (err, result) {
    console.log(result.Message);
  });
});

Source code

The following source code demonstrates how to call a web service with .NET using C# language.

HelloEndpointClient client = new HelloEndpointClient();
var response = await client.SayHelloAsync(new () { Name = "John Doe" });
Console.WriteLine(response.HelloResponse.Message);

Source code

The following source code demonstrates how to call a web service with Ruby and Savon.

require 'savon'

client = Savon.client(wsdl: 'https://apps.learnwebservices.com/services/hello?WSDL')
response = client.call(
  :say_hello,
  soap_action: '',
  message: { 'Name' => 'John Doe' }
)
puts response.body[:hello_response][:message]

Source code

The following source code demonstrates how to call a web service with PHP and SOAP extension.

<?php

$client = new SoapClient('https://apps.learnwebservices.com/services/hello?wsdl');
echo $client
	->SayHello(
		[
				'Name' => 'John Doe'
		]
	)
	->Message
;

Source code

Contributors

Contributions are welcome. Feel free to open a pull request with changes.