<div dir="ltr" style="text-align: left;" trbidi="on">SOAP includes a built-in set of rules for encoding data types.This enables the SOAP message to indicate specific data types, such as integers, floats, doubles, or arrays.</p>
<ul>
<li>SOAP data types are divided into two broad categories: scalar types and compound types. </li>
<li>Scalar types contain exactly one value, such as a last name, price, or product description. </li>
<li>Compound types contain multiple values, such as a purchase order or a list of stock quotes. </li>
<li>Compound types are further subdivided into arrays and structs. </li>
<li>The encoding style for a SOAP message is set via the SOAP-ENV:encodingStyle attribute. </li>
<li>To use SOAP 1.1 encoding, use the value <a href="http://schemas.xmlsoap.org/soap/encoding/" target="_blank">http://schemas.xmlsoap.org/soap/encoding/</a> </li>
<li>To use SOAP 1.2 encoding, use the value <a href="http://www.w3.org/2001/12/soap-encoding" target="_blank">http://www.w3.org/2001/12/soap-encoding</a> </li>
<li>Latest SOAP specification adopts all the built-in types defined by XML Schema. Still SOAP maintains its own convention for defining constructs not standardized by XML Schema, such as arrays and references. </li>
</ul>
<div align='center' id="ads-id"></div>
<p><b><br />
Scalar Types</b><br />
For scalar types, SOAP adopts all the built-in simple types specified by the XML Schema specification. This includes strings, floats, doubles, and integers.<br />
Following table lists the main simple types, excerpted from the XML Schema Part 0: Primer<br />
<a href="http://www.w3.org/TR/2000/WD-xmlschema-0-20000407/" target="_blank">http://www.w3.org/TR/2000/WD-xmlschema-0-20000407/</a></p>
<table border="1" class="src" style="width: 100%px;">
<tbody>
<tr>
<th align="center" colspan="3">Simple Types Built-In to XML Schema </th>
</tr>
<tr>
<th align="left">Simple Type </th>
<th align="left">Example(s) </th>
</tr>
<tr>
<td>string </td>
<td>Confirm this is electric </td>
</tr>
<tr>
<td>boolean </td>
<td>true, false, 1, 0 </td>
</tr>
<tr>
<td>float </td>
<td>-INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN </td>
</tr>
<tr>
<td>double </td>
<td>-INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN </td>
</tr>
<tr>
<td>decimal </td>
<td>-1.23, 0, 123.4, 1000.00 </td>
</tr>
<tr>
<td>binary </td>
<td>100010 </td>
</tr>
<tr>
<td>integer </td>
<td>-126789, -1, 0, 1, 126789 </td>
</tr>
<tr>
<td>nonPositiveInteger </td>
<td>-126789, -1, 0 </td>
</tr>
<tr>
<td>negativeInteger </td>
<td>-126789, -1 </td>
</tr>
<tr>
<td>long </td>
<td>-1, 12678967543233 </td>
</tr>
<tr>
<td>int </td>
<td>-1, 126789675 </td>
</tr>
<tr>
<td>short </td>
<td>-1, 12678 </td>
</tr>
<tr>
<td>byte </td>
<td>-1, 126 </td>
</tr>
<tr>
<td>nonNegativeInteger </td>
<td>0, 1, 126789 </td>
</tr>
<tr>
<td>unsignedLong </td>
<td>0, 12678967543233 </td>
</tr>
<tr>
<td>unsignedInt </td>
<td>0, 1267896754 </td>
</tr>
<tr>
<td>unsignedShort </td>
<td>0, 12678 </td>
</tr>
<tr>
<td>unsignedByte </td>
<td>0, 126 </td>
</tr>
<tr>
<td>positiveInteger </td>
<td>1, 126789 </td>
</tr>
<tr>
<td>date </td>
<td>1999-05-31, &#8212;05 </td>
</tr>
<tr>
<td>time </td>
<td>13:20:00.000, 13:20:00.000-05:00 </td>
</tr>
</tbody>
</table>
<p>For example, here is a SOAP response with a double data type:</p>
<pre class="highlight" name="code"><;?xml version='1.0' encoding='UTF-8'?>;;
<;SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema">;
<;SOAP-ENV:Body>;
 <;ns1:getPriceResponse
 xmlns:ns1="urn:examples:priceservice"
 SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding">;
 <;return xsi:type="xsd:double">;54.99<;/return>;
 <;/ns1:getPriceResponse>;
<;/SOAP-ENV:Body>;
<;/SOAP-ENV:Envelope>;
</pre>
<p><b><br />
Compound Types</b><br />
SOAP arrays have a very specific set of rules, which require that you specify both the element type and array size. SOAP also supports multidimensional arrays, but not all SOAP implementations support multidimensional functionality.<br />
To create an array, you must specify it as an xsi:type of Array. The array must also include an arrayType attribute. This attribute is required to specify the data type for the contained elements and the dimension(s) of the array.<br />
For example, the following attribute specifies an array of 10 double values:</p>
<table class="src" style="width: 100%px;">
<tbody>
<tr>
<td>
<pre class="highlight">arrayType="xsd:double[10]"
</pre>
</td>
</tr>
</tbody>
</table>
<p>In contrast, the following attribute specifies a two-dimensional array of strings: </p>
<table class="ex" style="width: 100%px;">
<tbody>
<tr>
<td>
<pre class="highlight">arrayType="xsd:string[5,5]"
</pre>
</td>
</tr>
</tbody>
</table>
<p>Here is a sample SOAP response with an array of double values:</p>
<pre class="highlight" name="code"><;?xml version='1.0' encoding='UTF-8'?>;
<;SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema">;
<;SOAP-ENV:Body>;
 <;ns1:getPriceListResponse
 xmlns:ns1="urn:examples:pricelistservice"
 SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding">;
 <;return
 xmlns:ns2="http://www.w3.org/2001/09/soap-encoding"
 xsi:type="ns2:Array" ns2:arrayType="xsd:double[2]">;
 <;item xsi:type="xsd:double">;54.99<;/item>;
 <;item xsi:type="xsd:double">;19.99<;/item>;
 <;/return>;
 <;/ns1:getPriceListResponse>;
<;/SOAP-ENV:Body>;
<;/SOAP-ENV:Envelope>;
</pre>
<p>Structs contain multiple values, but each element is specified with a unique accessor element. For example, consider an item within a product catalog. In this case, the struct might contain a product SKU, product name, description, and price. Here is how such a struct would be represented in a SOAP message:</p>
<pre class="highlight" name="code"><;?xml version='1.0' encoding='UTF-8'?>;
<;SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema">;
<;SOAP-ENV:Body>;
 <;ns1:getProductResponse
 xmlns:ns1="urn:examples:productservice"
 SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding">;
 <;return xmlns:ns2="urn:examples" xsi:type="ns2:product">;
 <;name xsi:type="xsd:string">;Red Hat Linux<;/name>;
 <;price xsi:type="xsd:double">;54.99<;/price>;
 <;description xsi:type="xsd:string">;
 Red Hat Linux Operating System
 <;/description>;
 <;SKU xsi:type="xsd:string">;A358185<;/SKU>;
 <;/return>;
 <;/ns1:getProductResponse>;
<;/SOAP-ENV:Body>;
<;/SOAP-ENV:Envelope>;
</pre>
<p><b>NOTE</b>: Please you take care of proper indentation while you write your SOAP code.</p>
<p> Each element in a struct is specified with a unique accessor name. For example, the message above includes four accessor elements: name , price , description , and SKU. Each element can have its own data type; for example, name is specified as a string , whereas price is specified as a double.</p>
<p><i><b>References</b></i><br />
1. <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-fault-element.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-transport.html">Next</a> >;>;</b></div>
<p>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/soap-fault-element/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/soap-transport/">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: '441'});
});
</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…