Categories: SOAPTutorial

SOAP Envelope Element

<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;" trbidi&equals;"on">The SOAP Envelope element is the root element of a SOAP message&period;<br &sol;>&NewLine;<b><br &sol;>&NewLine;The SOAP Envelope Element<&sol;b><br &sol;>&NewLine;The required SOAP Envelope element is the root element of a SOAP message&period; This element defines the XML document as a SOAP message&period; <&sol;p>&NewLine;<p> The SOAP envelope indicates the start and the end of the message so that the receiver knows when an entire message has been received&period; The SOAP envelope solves the problem of knowing when you&&num;8217&semi;re done receiving a message and are ready to process it&period; The SOAP envelope is therefore basic ally a packaging mechanism<br &sol;>&NewLine;SOAP Envelope element can be explained as&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>Every SOAP message has a root Envelope element&period; <&sol;li>&NewLine;<li>Envelope element is mandatory part of SOAP Message&period; <&sol;li>&NewLine;<li>Every Envelope element must contain exactly one Body element&period; <&sol;li>&NewLine;<li>If an Envelope contains a Header element&comma; it must contain no more than one&comma; and it must appear as the first child of the Envelope&comma; beforethe Body&period; <&sol;li>&NewLine;<li>The envelope changes when SOAP versions change&period; <&sol;li>&NewLine;<li>The SOAP envelope is specified using the <i>ENV<&sol;i> namespace prefix and the <i>Envelope<&sol;i> element&period; <&sol;li>&NewLine;<li>The optional SOAP encoding is also specified using a namespace name and the optional <i>encodingStyle<&sol;i> element&comma; which could also point to an encoding style other than the SOAP one&period; <&sol;li>&NewLine;<li>A v1&period;1-compliant SOAP processor will generate a fault when receiving a message containing the v1&period;2 envelope namespace&period; <&sol;li>&NewLine;<li>A v1&period;2- compliant SOAP processor generates a <i>VersionMismatch<&sol;i> fault if it receives a message that does not include the v1&period;2 envelope namespace&period; <&sol;li>&NewLine;<&sol;ul>&NewLine;<div align&equals;'center' id&equals;"ads-id"><&sol;div>&NewLine;<p><b>Example for v1&period;2 is given below-<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight" name&equals;"code">&lt&semi;&quest;xml version&equals;"1&period;0"&quest;&gt&semi;&NewLine;&lt&semi;soap&colon;Envelope&NewLine;xmlns&colon;soap&equals;"http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;12&sol;soap-envelope"&NewLine;soap&colon;encodingStyle&equals;"http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;12&sol;soap-encoding"&gt&semi;&NewLine; &period;&period;&period;&NewLine; Message information goes here&NewLine; &period;&period;&period;&NewLine;&lt&semi;&sol;soap&colon;Envelope&gt&semi; &NewLine;<&sol;pre>&NewLine;<p><b>The <i>xmlns&colon;soap<&sol;i> Namespace<&sol;b><&sol;p>&NewLine;<p> Notice the xmlns&colon;soap namespace in the example above&period; It should always have the value of&colon; &&num;8220&semi;<b><i>http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;12&sol;soap-envelope<&sol;i><&sol;b>&&num;8220&semi;&period;<&sol;p>&NewLine;<p> The namespace defines the Envelope as a SOAP Envelope&period;<&sol;p>&NewLine;<p> If a different namespace is used&comma; the application generates an error and discards the message&period;<br &sol;>&NewLine;<b>The <i>encodingStyle <&sol;i>Attribute<&sol;b><&sol;p>&NewLine;<p> The <i><b>encodingStyle <&sol;b><&sol;i>attribute is used to define the data types used in the document&period; This attribute may appear on any <i><b>SOAP <&sol;b><&sol;i>element&comma; and applies to the element&&num;8217&semi;s contents and all child elements&period;<&sol;p>&NewLine;<p> A <i><b>SOAP <&sol;b><&sol;i>message has no default encoding&period;<&sol;p>&NewLine;<p>Following example illustrates the use of a <b><i>SOAP <&sol;i><&sol;b>message within an<b><i> HTTP POST<&sol;i><&sol;b> operation&comma; which sends the message to the server&period; It shows the namespaces for the envelope schema definition and for the schema definition of the encoding rules&period; The <i><b>OrderEntry <&sol;b><&sol;i>reference in the <b><i>HTTP <&sol;i><&sol;b>header is the name of the program to be invoked at the <b><i>dineshonjava&period;com<&sol;i><&sol;b> Web site&period;<&sol;p>&NewLine;<pre class&equals;"highlight" name&equals;"code">POST &sol;OrderEntry HTTP&sol;1&period;1&NewLine;Host&colon; dineshonjava&period;com&NewLine;Content-Type&colon; application&sol;soap&semi; charset&equals;"utf-8"&NewLine;Content-Length&colon; nnnn&NewLine;&lt&semi;&quest;xml version&equals;"1&period;0"&quest;&gt&semi;&NewLine;&lt&semi;SOAP-ENV&colon;Envelope&NewLine;xmlns&colon;SOAP-ENV&equals;"http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;12&sol;soap-envelope"&NewLine;SOAP-ENV&colon;encodingStyle&equals;"http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;12&sol;soap-encoding"&gt&semi;&NewLine; &period;&period;&period;&NewLine; Message information goes here&NewLine; &period;&period;&period;&NewLine;&lt&semi;&sol;SOAP-ENV&colon;Envelope&gt&semi;&NewLine;<&sol;pre>&NewLine;<p>&NewLine;<i><b>References<&sol;b><&sol;i><br &sol;>&NewLine;1&period; <i><b><a href&equals;"http&colon;&sol;&sol;en&period;wikipedia&period;org&sol;wiki&sol;SOAP" target&equals;"&lowbar;blank">Wikipedia for SOAP<&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;2013&sol;05&sol;soap-message-structure&period;html">Previous<&sol;a> &lt&semi;&lt&semi;&nbsp&semi;&nbsp&semi; &vert;&vert; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;2013&sol;01&sol;core-java-baby-step-to-be-best-java-ian&period;html">Index <&sol;a>&vert;&vert; &nbsp&semi; &gt&semi;&gt&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;2013&sol;05&sol;soap-header-element&period;html">Next<&sol;a> &gt&semi;&gt&semi;<&sol;b><&sol;div>&NewLine;<p>&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;web-service-introduction&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;soap-header-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; '445'&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