WebReference.com - Chapter 30 of Curl Programming Bible, from John Wiley & Sons (3/8) | WebReference

WebReference.com - Chapter 30 of Curl Programming Bible, from John Wiley & Sons (3/8)

To page 1To page 2current pageTo page 4To page 5To page 6To page 7To page 8
[previous] [next]

Curl Programming Bible, chapter 30

XML Types and Curl Types

Curl supplies a number of mappings (Table 30-1) that convert between Curl types and XML types. The entries in the first column in the table below are Curl supplied. In the second column are the corresponding XML Schema built-in types. For each mapping, Curl supplies a marshaler and unmarshaler to convert between the XML type and Curl type. If you need a mapping that is not in Table 30-1, you must supply one. See "Creating Custom Mappings," in this chapter, on how to do it.

Table 30-1: Supplied Mappings
Curl TypeXML Type
floatfloat
doubledouble
intint
unt8unsignedByte
uint16unsignedShort
int8byte
int64long
int16short
boolboolean
Stringstring
ByteVecbase64Binary

Arrays as Arguments

SOAP defines an encoding for arrays. Curl supports passing array arguments with the Soap-1-1-ArrayArgumentDescriptor. The constructor for Soap-1-1ArrayArgumentDescriptor takes three arguments: the name of the argument, the XML type of the array elements, and the Curl type. The Curl type must be an array type.

Consider a SOAP operation that returns synonyms for a given word. It takes a string containing the word as its input argument and returns the synonyms as an array of strings. The Soap-1-1-ArrayArgumentDescriptor constructor for the output argument is

{new Soap-1-1-ArrayArgumentDescriptor,
  	  {new XMLName, "", "Array"},
    {new XMLName, xsd", "string"},
    {Array-of String}
   }

The name of the argument is Array. The XML type of the array elements is string. And the Curl type is {Array-of String}.

NOTE: In the Soap-1-1-ArrayArgument class, the XML type is the array element type and the Curl type is the array type. So the Curl type must be an {Array-of ...} type.

The complete Curl applet (synonyms.curl) containing the Soap-1-1-ArrayArgumentDescriptor is on the accompanying Web site.


To page 1To page 2current pageTo page 4To page 5To page 6To page 7To page 8
[previous] [next]

Created: August 14, 2002
Revised: August 14, 2002

URL: http://webreference.com/programming/curlbible/chap30/3.html