How do I know the WSDL URL of my Web Service ?

In this tutorial we will learn how to retrieve the SOAP Web Service WSDL URL, so that you can quickly test your SOAP Web Service.

Ok let’s begin from the following SOAP Web Service application available on JBoss EAP or WildFly. Here is the server log upon deployment:

16:18:12,387 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-6) Creating Service {}AddressingService from WSDL: WEB-INF/wsdl/AddressingService.wsdl
16:18:12,788 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-6) Setting the server’s publish address to be http://localhost:8080/wildfly-jaxws-addressing/AddressingService
16:18:12,873 INFO  [] (MSC service thread 1-6) JBWS024074: WSDL published to: file:/home/francesco/jboss/wildfly-10.0.0.Final/standalone/data/wsdl/wildfly-jaxws-addressing-service.war/AddressingService.wsdl

This information informs us about the published address of the SOAP Web Service which is set to : http://localhost:8080/wildfly-jaxws-addressing/AddressingService?wsdl

Besides server logs, there are other strategies to retrieve the SOAP Web Service URL:

1) Use the Command Line Interface

By pointing to the deployment unit which contains the SOAP Web Service, it is possible via CLI to retrieve the WSDL URL of it:

[standalone@localhost:9990 /] /deployment=wildfly-jaxws-addressing.war/subsystem=webservices/endpoint=com.demo.AddressingService:read-resource(include-runtime=true) 
{ "outcome" => "success", "result" => 
       . . . . 
       "wsdl-url" => "http://localhost:8080/wildfly-jaxws-addressing/AddressingService?wsdl" 

 2) Use the Web Admin console

First, connect to the Web Console of the application Server. Next, navigate to the Runtime upper tab of the Web console, and select the Web Services Subsystem:

3) From the WSDL itself (for Top-Down Web Services)

If you are developing Top-Down Web services (also known as Contract-First Web Services), you can define the Contract Definition of your SOAP Web Service in a WSDL file. Within the WSDL, look out for the soad:address location element:

   <service name='ProfileMgmtService'>
      <port binding='tns:ProfileMgmtBinding' name='ProfileMgmtPort'>

         <!-- service address will be rewritten to actual one when WSDL is requested from running server -->
         <soap:address location='http://SERVER:PORT/jaxws-retail/ProfileMgmtBean'/>

The parameter location contains the WSDL URL for your Web Service. In our case, we rely on the default rewriting of the WSDL address with the actual server address and port, where the service has been deployed.

How is the WSDL URL generated ?

You might however wonder how the WSDL URL is generated. Well the starting point is the SOAP Web Service name, which is defined in the WSDL:

<wsdl:service name="AddressingService">

If you are coding Code-first SOAP Web Service, you can define the Web service name through annotations as follows:

        portName = "AddressingPort",
        serviceName = "AddressingService")
public class AddressingService implements AddressingServiceWs {

//. . .

Now you know about the Service name. The host and port where the Service is exposed is a matter of configuration:

In practice, when exposing the SOAP Web Service, the application server performs an URL rewriting of the SOAP Address (contained in the WSDL), replacing the host name with the property wsdl-host and the port with wsdl-port.

Important ! In order for the rewriting to work, set the modify-wsdl-address property to true (By default it’s true). If this property is set to false the <soap:address> URL declared in the WSDL will be used instead.

Customizing the WSDL Path

Since JBossWS-CXF 5.0 it is possible to customize the Path of the WSDL by using a Sed-like syntax replacer. For example:

<subsystem xmlns="urn:jboss:domain:webservices:2.0">
            <!-- Other configuration -->

Please notice that, in order to take effect, it is required to set the modify-wsdl-address property to true.

Rewriting the SOAP address using XML descriptors

Finally, you can use the WEB-INF/jboss-webservices.xml file to rewrite the SOAP address, Port or protocol to be exposed by your Web service. Here is an example;

<webservices version="1.2"

Web Service Testing

We have created a dedicated tutorial for testing SOAP Web services, which includes:

  • Testing SOAP Web services with SOAPUI
  • Using cURL to test SOAP Web services
  • Testing SOAP Web services with Apache JMeter
  • Programmatically test SOAP Web services with JUnit

You can read it here: How to test SOAP Web Services