Social Media

Web Services – Example WSDL

A WSDL contract defines the following Web Service information –

  • Web Service Data Type
  • Web Service messages
  • Web Service interfaces
  • Bindings between the messages and the representation of the data
  • Transport details for the web services.


[sourcecode lang=”xml”] <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="WSDLExampleApplication"
xmlns:errors="" >

<wsdl:import location="Errors.wsdl" namespace="" />

schemaLocation="../schema/WSDLExampleApplication.xsd" />

<wsdl:message name="getMyDetailsRequest">
<wsdl:part name="request" element="tns:getMyDetailsRequest"></wsdl:part>
<wsdl:message name="getMyDetailsResponse">
<wsdl:part name="response" element="tns:getMyDetailsResponse"></wsdl:part>

<wsdl:portType name="WSDLExampleApplicationPort">
<wsdl:operation name="getMyDetails">
<wsdl:input message="tns:getMyDetailsRequest"></wsdl:input>
<wsdl:output message="tns:getMyDetailsResponse"></wsdl:output>

<wsdl:binding name="WSDLExampleApplicationBinding" type="tns:WSDLExampleApplicationPort">
<soap:binding style="document" transport="" />
<wsdl:operation name="getMyDetails">
style="document" />
<soap:body use="literal" />
<soap:body use="literal" />

<wsdl:service name="WSDLExampleApplication">
<wsdl:port binding="tns:WSDLExampleApplicationBinding" name="WSDLExampleApplicationPort">
<soap:address location="http://localhost:8181/cxf/webservice/WSDLExampleApplication" />


This shows the two parts of the wsdl –

  • logical part – contains types(wsdl:types), message(wsdl:message), portType(wsdl:portType) elements. Defines service interface and message exchanged
  • concrete part – binding(wsdl:binding) and service(wsdl:service) elements, transportation type

The datatypes are defined in the external “../schema/WSDLExampleApplication.xsd” – this allows types to be shared amongst wsdl’s. This follows standard schema rules –

> Support for simple types (xsd:string, xsd:int, xsd:long, …)
> Support for complex types –

[sourcecode lang=”xml”] <xsd:complexType name="getMyDetailsRequest">
<xsd:element name="nameString" type="xsd:string" />
<xsd:element name="count" type="xsd:int" />

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment: