Apis Networks  
SOAP Data Types
Links:
  - Implementing SOAP
  - SOAP Data Types
  - SOAP WSDL
  - SOAP Authentication
  - Language Examples
- PHP4
- PHP5
- Perl
- Ruby
- Python
- Java
- VBScript
- JavaScript
  - SOAP Explorer
Introduction Introduction:
After reading the introduction, you now know it's possible to send and receive information between the client and the server, but how is that data represented? What forms can the data be represented in? Well here is your quick primer on data types and what they mean.

Data types handled by the SOAP interface can be broken down into two categories: scalar and vector (or complex). Scalar data types hold a single value. Perhaps it may hold a number such as 42, or a word like "Hello World!", a truth value (i.e. true or false), or even a mixture, e.g. "Hello World, says the number 42.". Regardless of what it holds it can hold one and only one value at a time.

Vectors, the other general grouping of data, handle more than one element of data at a time. They may be slightly more cumbersome to work with at this, but have the added benefit of being able to store multiple dimensions. For example we could have a vector that stores a person's first and last name. Compare this to a scalar, which would require two variables to store the first and last name respectively. With a vector, this can be coalesced into one variable.

Idioms: Not all programming languages follow the conventions laid out below. Some languages don't have a "boolean" type; sometimes they have an array, but not an associative array; and even sometimes still, they go by a different name (e.g. "hash") or have a derivation of two or more types. If the SOAP interface fuels a bit of an interest in any language, look into exploring the language further in detail by visiting the language's Web site or reading its documentation. Many contain tutorials to help you get started.
Scalars Scalars:
boolean Booleans: Booleans can hold one of two values: true or false.

ints Integers: Integers hold whole numbers that can be either negative or positive (e.g. -39013, 23191). They do not hold numbers with a decimal or fraction.

ints Doubles: These serve as the compliment to integers for expressing numbers. Fractions can be expressed as doubles as well as irrational numbers (e.g. 3.14, 3.0000001).

ints Strings: Finally, these are a catch-all for scalars. Strings are any collection of letters and numbers that cannot be expressed by the previously mentioned types. The previous types can also be converted to strings, but you lose any operations (e.g. addition, subtraction) that could have otherwise been applied. Examples include "Hello", "Testing 12345", or even "21".

Vectors Vectors:
Arrays Arrays: Arrays are the most common type of vectors. They contain multiple values are each element of the array is indexed by a number (also called the "key"), 0 - (N-1) where N is the number of elements in the array. In some languages, arrays can contain mixed data types, that is to say that we could have an array with the values {12, "Hello world!", 3412.11} and they can even contain arrays of arrays (called multidimensional arrays).

associative_arrays Associative Arrays ("hashes"): Very similar to a normal array, except the 0 - (N-1) keys in the array are now replaced with strings. This is the most common form of returning multiple values from a SOAP call, e.g. Common_Module::get_disk_quota returns a hash with keys "used" and "total".

objects Objects: Just as strings are a catch-all for scalars, objects are a catch-all for vectors, although objects tend to be a bit more complex in certain circumstances. Objects are generally avoided in apnscp esprit and are only seen when created via a complexType in SOAP. At this time there are no instances of complexType and shouldn't be in the future.

mixed Mixed: These are the true catch-all; mixed means that it can be anything. It can be a scalar or a vector. It could be a boolean or an object. Returned values &151; what a SOAP call sends back to your application — are never mixed, but parameters &151; things you pass off to a SOAP function, can be. This is done to simplify a function within the control panel, for instance we might have a function called File_Module::delete_files. It wouldn't be prudent to make 100 SOAP calls to remove 100 files in a directory. It would be more efficient to just make one call to File_Module::delete_files with an array of strings that represent the files to delete.

Introduction SOAP Data Types:
Now that you know the basic types that are passed back and forth between the client and server (control panel), it's time to learn the equivalent SOAP data types in the WSDL — don't fret, you'll learn about that in the following section. The following figure demonstrates the relationship between the data types mentioned already and what they're called in SOAP.

Data Types Pretty simple, huh? Now it's time to explore the WSDL of SOAP.

All Rights Reserved. Copyright © 2002-2008 Apis Networks, Inc. All trademarks are property of their legal owner.
Acceptable Use Policy | Terms of Service | Privacy Policy | Site Map | Domain Registration Agreement