<div dir="ltr" style="text-align: justify;" trbidi="on">
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td valign="top">
<ul>
<li><b>SOAP </b>is not tied to any one transport protocol. </li>
<li><b>SOAP </b>can be transported via <b>SMTP</b>, <b>FTP</b>, <b>IBM</b>&#8216;s <b>MQSeries</b>, or <b>Microsoft Message Queuing (MSMQ). </b></li>
<li><b>SOAP </b>specification includes details on <b>HTTP </b>only. </li>
<li><b>HTTP </b>remains the most popular <b>SOAP </b>transport protocol. </li>
</ul>
<p><b><br />
SOAP via HTTP</b><br />
Quite logically, <b>SOAP</b> <b>requests </b>are sent via an <b>HTTP </b>request and <b>SOAP responses </b>are returned within the content of the <b>HTTP response</b>. While <b> SOAP requests</b> can be sent via an <b>HTTP GET</b>, the specification includes details on <b>HTTP POST</b> only.<br />
Additionally, both <b>HTTP requests and responses</b> are required to set their content type to <b><i>text/xml</i></b>.<br />
The <b>SOAP </b>specification mandates that the client must provide a <i><b> SOAPAction </b></i>header, but the actual value of the <i><b>SOAPAction </b></i>header is dependent on the <i><b>SOAP </b></i>server implementation.</p>
<div align="center" id="ads-id"></div>
<p>For example, to access the AltaVista BabelFish Translation service, hosted by XMethods, you must specify the following as a <i><b>SOAPAction </b></i>header.</p>
<table class="ex" style="width: 100%px;">
<tbody>
<tr>
<td>
<pre>urn:xmethodsBabelFish#BabelFish
</pre>
</td>
</tr>
</tbody>
</table>
<p>Even if the server does not require a full <i><b>SOAPAction </b></i>header, the client must specify an empty string (&#8220;&#8221;), or a null value. For example:</p>
<table class="ex" style="width: 100%px;">
<tbody>
<tr>
<td>
<pre class="highlight" name="code">SOAPAction: ""
SOAPAction:
</pre>
</td>
</tr>
</tbody>
</table>
<p>Here is a sample request sent via <i><b>HTTP </b></i>to the <b><i>XMethods Babelfish </i></b>Translation service:</p>
<table class="src" style="width: 100%px;">
<tbody>
<tr>
<td>
<pre class="highlight" name="code">POST /perl/soaplite.cgi HTTP/1.0
Host: services.xmethods.com
Content-Type: text/xml; charset=utf-8
Content-Length: 538
SOAPAction: "urn:xmethodsBabelFish#BabelFish"

<;?xml version='1.0' encoding='UTF-8'?>;
<;SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">;
<;SOAP-ENV:Body>;
<;ns1:BabelFish
xmlns:ns1="urn:xmethodsBabelFish"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">;
<;translationmode xsi:type="xsd:string">;en_fr<;/translationmode>;
<;sourcedata xsi:type="xsd:string">;Hello, world!<;/sourcedata>;
<;/ns1:BabelFish>;
<;/SOAP-ENV:Body>;
<;/SOAP-ENV:Envelope>;
</pre>
</td>
</tr>
</tbody>
</table>
<p>Note the content type and the <i><b>SOAPAction </b></i>header. Also note that the <b><i> BabelFish </i></b>method requires two String parameters. The translation mode en_fr will translate from English to French.<br />
Here is the response from <i><b>XMethods</b></i>:</p>
<table class="src" style="width: 100%px;">
<tbody>
<tr>
<td>
<pre class="highlight" name="code">HTTP/1.1 200 OK
Date: Sat, 09 Jun 2001 15:01:55 GMT
Server: Apache/1.3.14 (Unix) tomcat/1.0 PHP/4.0.1pl2
SOAPServer: SOAP::Lite/Perl/0.50
Cache-Control: s-maxage=60, proxy-revalidate
Content-Length: 539
Content-Type: text/xml

<;?xml version="1.0" encoding="UTF-8"?>;
<;SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">;
<;SOAP-ENV:Body>;
<;namesp1:BabelFishResponse xmlns:namesp1="urn:xmethodsBabelFish">;
<;return xsi:type="xsd:string">;Bonjour, monde!<;/return>;
<;/namesp1:BabelFishResponse>;
<;/SOAP-ENV:Body>;
<;/SOAP-ENV:Envelope>;

</pre>
</td>
</tr>
</tbody>
</table>
<p><i><b>SOAP </b></i>responses delivered via <i><b>HTTP </b></i>are required to follow the same <b><i> HTTP </i></b>status codes. For example, a status code of 200 OK indicates a successful response. A status code of 500 Internal Server Error indicates that there is a server error and that the SOAP response includes a Fault element.</td>
</tr>
</tbody>
</table>
<p>
<b><br />
SOAP HTTP Binding</b><br />
 A SOAP method is an HTTP request/response that complies with the SOAP encoding rules.</p>
<h3>HTTP + XML = SOAP</h3>
<p> A SOAP request could be an HTTP POST or an HTTP GET request.<br />
 The HTTP POST request specifies at least two HTTP headers: Content-Type and Content-Length.</p>
<p></p>
<h2>Content-Type</h2>
<p> The Content-Type header for a SOAP request and response defines the MIME type for the message and the character encoding (optional) used for the XML body of the request or response.</p>
<h4>Syntax</h4>
<p></p>
<div class="code notranslate">
<div> Content-Type: MIMEType; charset=character-encoding </div>
</div>
<p></p>
<h4>Example</h4>
<p></p>
<div class="code notranslate">
<div> POST /item HTTP/1.1<br />
Content-Type: application/soap+xml; charset=utf-8 </div>
</div>
<p></p>
<h2>Content-Length</h2>
<p> The Content-Length header for a SOAP request and response specifies the number of bytes in the body of the request or response.</p>
<h4>Syntax</h4>
<p></p>
<div class="code notranslate">
<div> Content-Length: bytes</div>
</div>
<p></p>
<h4>Example</h4>
<p></p>
<div class="code notranslate">
<div> <b><i>POST /item HTTP/1.1<br />
Content-Type: application/soap+xml; charset=utf-8<br />
Content-Length: 250 </i></b></div>
</div>
<p>
<i><b>References</b></i><br />
<i><b><a href="http://en.wikipedia.org/wiki/SOAP" target="_blank">Wikipedia for SOAP</a></b></i></p>
<p> ; </p>
<div style="background-color: pink; border-width: thin; text-align: center;"><b><;<;<a href="https://dineshonjava.com/2013/05/soap-encoding.html">Previous</a> <;<; ; ; || <a href="https://dineshonjava.com/2013/01/core-java-baby-step-to-be-best-java-ian.html">Index </a>||  ; >;>;<a href="https://dineshonjava.com/2013/05/soap-example.html">Next</a> >;>;</b></div>
<p>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/soap-encoding/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/soap-example/">Next</a> 
									 </div> 
									</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
 $.post('https://dineshonjava.com/wp-admin/admin-ajax.php', {action: 'mts_view_count', id: '440'});
});
</script>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…