Categories: TutorialWSDL

Hello World Example WSDL Document

<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<p>Following is the <b><i>WSDL <&sol;i><&sol;b>file that is provided to demonstrate a simple <b><i>WSDL <&sol;i><&sol;b>program&period;<&sol;p>&NewLine;<p>Assuming the <b>service <&sol;b>provides a single publicly available function&comma; called <b><i>sayHelloWorld<&sol;i><&sol;b>&period; This function expects a single string parameter and returns a single string greeting&period; For example if you pass the parameter world then service function <i><b>sayHelloWorld <&sol;b><&sol;i>returns the greeting&comma; &&num;8220&semi;<b>Hello&comma; world&excl;&excl; Dinesh on Java<&sol;b>&&num;8220&semi;&period;<&sol;p>&NewLine;<h2><b>Web Service Name &colon; <i>HelloWorldService<&sol;i><&sol;b><&sol;h2>&NewLine;<p><b>This <i>WSDL <&sol;i>example contains&colon;<&sol;b><br &sol;>&NewLine;&&num;8211&semi; <i><b>SOAP <&sol;b><&sol;i>Protocol<br &sol;>&NewLine;&&num;8211&semi; Document Literal Binding<br &sol;>&NewLine;&&num;8211&semi; No optional <i><b>SOAP <&sol;b><&sol;i>Header included in <b><i>WSDL<&sol;i><&sol;b><br &sol;>&NewLine;&&num;8211&semi; <i><b>SOAP <&sol;b><&sol;i>Body<&sol;p>&NewLine;<h2><b>Content of <i>HelloWorldService&period;wsdl<&sol;i> file<&sol;b><&sol;h2>&NewLine;<pre class&equals;"highlight">&lt&semi;definitions name&equals;"HelloWorldService" &NewLine; targetNamespace&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wsdl&sol;HelloWorldService&period;wsdl" &NewLine; xmlns&equals;"http&colon;&sol;&sol;schemas&period;xmlsoap&period;org&sol;wsdl&sol;" &NewLine; xmlns&colon;soap&equals;"http&colon;&sol;&sol;schemas&period;xmlsoap&period;org&sol;wsdl&sol;soap&sol;" &NewLine; xmlns&colon;tns&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wsdl&sol;HelloWorldService&period;wsdl" &NewLine; xmlns&colon;xsd&equals;"http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;XMLSchema"&gt&semi; &NewLine; &NewLine; &lt&semi;message name&equals;"SayHelloRequest"&gt&semi; &NewLine; &lt&semi;part name&equals;"firstName" type&equals;"xsd&colon;string"&sol;&gt&semi; &NewLine; &lt&semi;&sol;message&gt&semi; &NewLine; &lt&semi;message name&equals;"SayHelloResponse"&gt&semi; &NewLine; &lt&semi;part name&equals;"greeting" type&equals;"xsd&colon;string"&sol;&gt&semi; &NewLine; &lt&semi;&sol;message&gt&semi; &NewLine; &NewLine; &lt&semi;portType name&equals;"HelloWorld&lowbar;PortType"&gt&semi; &NewLine; &lt&semi;operation name&equals;"sayHelloWorld"&gt&semi; &NewLine; &lt&semi;input message&equals;"tns&colon;SayHelloRequest"&sol;&gt&semi; &NewLine; &lt&semi;output message&equals;"tns&colon;SayHelloResponse"&sol;&gt&semi; &NewLine; &lt&semi;&sol;operation&gt&semi; &NewLine; &lt&semi;&sol;portType&gt&semi; &NewLine; &NewLine; &lt&semi;binding name&equals;"HelloWorld&lowbar;Binding" type&equals;"tns&colon;HelloWorld&lowbar;PortType"&gt&semi; &NewLine; &lt&semi;soap&colon;binding style&equals;"rpc" &NewLine; transport&equals;"http&colon;&sol;&sol;schemas&period;xmlsoap&period;org&sol;soap&sol;http"&sol;&gt&semi; &NewLine; &lt&semi;operation name&equals;"sayHelloWorld"&gt&semi; &NewLine; &lt&semi;soap&colon;operation soapAction&equals;"sayHelloWorld"&sol;&gt&semi; &NewLine; &lt&semi;input&gt&semi; &NewLine; &lt&semi;soap&colon;body &NewLine; encodingStyle&equals;"http&colon;&sol;&sol;schemas&period;xmlsoap&period;org&sol;soap&sol;encoding&sol;" &NewLine; namespace&equals;"urn&colon;examples&colon;helloworldservice" &NewLine; use&equals;"encoded"&sol;&gt&semi; &NewLine; &lt&semi;&sol;input&gt&semi; &NewLine; &lt&semi;output&gt&semi; &NewLine; &lt&semi;soap&colon;body &NewLine; encodingStyle&equals;"http&colon;&sol;&sol;schemas&period;xmlsoap&period;org&sol;soap&sol;encoding&sol;" &NewLine; namespace&equals;"urn&colon;dineshonjava&colon;helloworldservice" &NewLine; use&equals;"encoded"&sol;&gt&semi; &NewLine; &lt&semi;&sol;output&gt&semi; &NewLine; &lt&semi;&sol;operation&gt&semi; &NewLine; &lt&semi;&sol;binding&gt&semi; &NewLine; &NewLine; &lt&semi;service name&equals;"HelloWorld&lowbar;Service"&gt&semi; &NewLine; &lt&semi;documentation&gt&semi;WSDL File for HelloWorldService&lt&semi;&sol;documentation&gt&semi; &NewLine; &lt&semi;port binding&equals;"tns&colon;HelloWorld&lowbar;Binding" name&equals;"HelloWorld&lowbar;Port"&gt&semi; &NewLine; &lt&semi;soap&colon;address &NewLine; location&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;SayHelloWorld&sol;"&gt&semi; &NewLine; &lt&semi;&sol;port&gt&semi; &NewLine; &lt&semi;&sol;service&gt&semi; &NewLine;&lt&semi;&sol;definitions&gt&semi; &NewLine;<&sol;pre>&NewLine;<div id&equals;"ads-id" align&equals;"center"><&sol;div>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2013&sol;05&sol;wsdld-1&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<h2><b>Analysis of the Example<&sol;b><&sol;h2>&NewLine;<p><b>1&period; Definition <&sol;b>&colon; <i><b>HelloWorldService<&sol;b><&sol;i><&sol;p>&NewLine;<p><b>2&period; Type <&sol;b>&colon; Using built-in data types and they are defined in XMLSchema&period;<&sol;p>&NewLine;<p><b>3&period; Message <&sol;b>&colon;<&sol;p>&NewLine;<ul>&NewLine;<li><b>sayHelloRequest <&sol;b>&colon; firstName parameter<&sol;li>&NewLine;<li><b>sayHelloresponse<&sol;b>&colon; greeting return value<&sol;li>&NewLine;<&sol;ul>&NewLine;<p><b>4&period; Port Type<&sol;b>&colon; <i><b>sayHelloWorld <&sol;b><&sol;i>operation that consists of a request and response service&period;<&sol;p>&NewLine;<p><b>5&period; Binding<&sol;b>&colon; Direction to use the SOAP HTTP transport protocol&period;<&sol;p>&NewLine;<p><b>6&period; Service<&sol;b>&colon; Service available at <i><b>https&colon;&sol;&sol;dineshonjava&period;com&sol;SayHelloWorld&sol;&period;<&sol;b><&sol;i><&sol;p>&NewLine;<p><b>7&period; Port<&sol;b>&colon; Associates the binding with the URI <b><i>https&colon;&sol;&sol;dineshonjava&period;com&sol;SayHelloWorld&sol;<&sol;i><&sol;b> where the running service can be accessed&period;<&sol;p>&NewLine;<h3><b><br &sol;>&NewLine;WSDL Ports<&sol;b><&sol;h3>&NewLine;<p>The <b>&lt&semi;portType&gt&semi;<&sol;b> element is the most important WSDL element&period;<br &sol;>&NewLine;It describes a web service&comma; the operations that can be performed&comma; and the messages that are involved&period;<br &sol;>&NewLine;The &lt&semi;portType&gt&semi; element can be compared to a function library &lpar;or a module&comma; or a class&rpar; in a traditional programming language&period;<br &sol;>&NewLine;<b><br &sol;>&NewLine;WSDL Messages<&sol;b><&sol;p>&NewLine;<p>The <b>&lt&semi;message&gt&semi;<&sol;b> element defines the data elements of an operation&period;<br &sol;>&NewLine;Each message can consist of one or more parts&period; The parts can be compared to the parameters of a function call in a traditional programming language&period;<br &sol;>&NewLine;<b><br &sol;>&NewLine;WSDL Types<&sol;b><br &sol;>&NewLine;The <b>&lt&semi;types&gt&semi;<&sol;b> element defines the data types that are used by the web service&period;<br &sol;>&NewLine;For maximum platform neutrality&comma; WSDL uses XML Schema syntax to define data types&period;<br &sol;>&NewLine;<b><br &sol;>&NewLine;WSDL Bindings<&sol;b><br &sol;>&NewLine;The <b>&lt&semi;binding&gt&semi;<&sol;b> element defines the data format and protocol for each port type&period;<&sol;p>&NewLine;<p><i><b>References<&sol;b><&sol;i><br &sol;>&NewLine;<i><b><a href&equals;"http&colon;&sol;&sol;en&period;wikipedia&period;org&sol;wiki&sol;Web&lowbar;Services&lowbar;Description&lowbar;Language" target&equals;"&lowbar;blank" rel&equals;"noopener">Wikipedia for WSDL<&sol;a><&sol;b><&sol;i><&sol;p>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"background-color&colon; pink&semi; border-width&colon; thin&semi; text-align&colon; center&semi;"><b>&lt&semi;&lt&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wsdl-elements&sol;">Previous<&sol;a> &lt&semi;&lt&semi;   &vert;&vert; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;core-java-baby-step-to-be-best-java-ian&sol;">Index <&sol;a>&vert;&vert;   &gt&semi;&gt&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wsdl-definition-element&sol;">Next<&sol;a> &gt&semi;&gt&semi;<&sol;b><&sol;div>&NewLine;<&sol;div>&NewLine;<div class&equals;"wp-post-navigation"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-pre"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wsdl-elements&sol;">Previous<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-next"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wsdl-definition-element&sol;">Next<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;<&sol;div>&NewLine;<script type&equals;"text&sol;javascript">&NewLine;jQuery&lpar;document&rpar;&period;ready&lpar;function&lpar;&dollar;&rpar; &lbrace;&NewLine; &dollar;&period;post&lpar;'https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-admin&sol;admin-ajax&period;php'&comma; &lbrace;action&colon; 'mts&lowbar;view&lowbar;count'&comma; id&colon; '457'&rcub;&rpar;&semi;&NewLine;&rcub;&rpar;&semi;&NewLine;<&sol;script>

Dinesh Rajput

Dinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. It has a series of articles related to Java technologies. Dinesh has been a Spring enthusiast since 2008 and is a Pivotal Certified Spring Professional, an author of a book Spring 5 Design Pattern, and a blogger. He has more than 10 years of experience with different aspects of Spring and Java design and development. His core expertise lies in the latest version of Spring Framework, Spring Boot, Spring Security, creating REST APIs, Microservice Architecture, Reactive Pattern, Spring AOP, Design Patterns, Struts, Hibernate, Web Services, Spring Batch, Cassandra, MongoDB, and Web Application Design and Architecture. He is currently working as a technology manager at a leading product and web development company. He worked as a developer and tech lead at the Bennett, Coleman & Co. Ltd and was the first developer in his previous company, Paytm. Dinesh is passionate about the latest Java technologies and loves to write technical blogs related to it. He is a very active member of the Java and Spring community on different forums. When it comes to the Spring Framework and Java, Dinesh tops the list!

Share
Published by
Dinesh Rajput

Recent Posts

Strategy Design Patterns using Lambda

Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…

4 years ago

Decorator Pattern using Lambda

Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…

4 years ago

Delegating pattern using lambda

Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…

4 years ago

Spring Vs Django- Know The Difference Between The Two

Technology has emerged a lot in the last decade, and now we have artificial intelligence;…

4 years ago

TOP 20 MongoDB INTERVIEW QUESTIONS 2022

Managing a database is becoming increasingly complex now due to the vast amount of data…

4 years ago

Scheduler @Scheduled Annotation Spring Boot

Overview In this article, we will explore Spring Scheduler how we could use it by…

4 years ago