Declaring Mashup Variables and Parameters
At a minimum, you must add an output parameter for the mashup to hold the mashup result. Typically, you also add several variables or input parameters to work with the data for the mashup. See Variables and Parameters.
Note: only one <output> declaration can occur within a mashup. Validation for the mashup script will not flag multiple <output> declarations as an error. You will, however, receive an error when debugging or publishing the mashup script.
Variables and Parameters
Variables and parameters have a global scope in mashups. You can declare them anywhere within a mashup script.
Variables and parameters can serve several purposes in a mashup operation:
Variables and parameters each have a name and a datatype. They can also have an optional default value and a service name, if their datatype is a named type defined by a service. They can hold scalar data or complex objects represented as XML documents. See Valid Variable or Parameter Names and Datatypes for Variables and Parameters for more information.
Note: the Mashup Engine automatically converts the results of component services to XML for any variable that holds complex objects.
You can also construct XML for complex input parameters or any intermediate variables. See Constructing the Mashup Result, Input or Intermediate Variables for information on commands that construct XML documents.
Variables and parameters must be added as children of the mashup <operation> element or as children of the <mashup> element itself. Do not add these declarations inside other mashup commands.
Order is not important. You can also reference them before they are declared.
Tip: you can omit declarations for complex input parameters or variables (with a document data type). The Mashup Engine will implictly create document-type parameters or variables that are used in EMML commands but not explicitly declared.
Variables to hold the output of commands can also be implicit – simply use a name in a command. The Mashup Engine automatically creates a variable with that name and a datatype of document.
Valid Variable or Parameter Names
Variable and parameter names must follow these rules to be valid:
*
These reserved names are used for service invocation error handling.
*
global or system
*
They can use the reserved name httpResponse.header-name to define standard or custom HTTP headers for the mashup result. For custom HTTP headers, header-name must begin with X-.
*
*
Datatypes for Variables and Parameters
Mashup variables, input parameters and output parameters can be scalar values or complex, as shown below:
See Valid Date Formats for Presto Services for more information on the supported format for date parameters.
Examples

<operation name="sample">
<outputparam name="result" type="document"/>
<inputparam name="queryDate" type="date" default="2007-03-01"/>
<inputparam name="securityType" type="svc:certType" service="Credentials"/>
<inputparam name="query">
<svc:query>
<svc:category>books</svc:category>
<svc:ranking>allResults<svc:ranking>
<svc:date>{$queryDate}</svc:date>
<svc:maximum>100</svc:maximum>
</svc:query>
</inputparam>
...
<variables>
<variable name="key" type="string" default="1SF8BTKBTXN6XP68BY02"/>
<variable name="loops" type="number"/>
<variable name="amznResult" type="document"/>
<variable name="httpResponse.Content-type" type="string"
default="text/csv; charset=UTF-8"
</variables>
...
</operation>
Declaring Namespaces
You must declare any namespaces used in:
*
Note: when you declare namespaces for component services, you must use the same namespace prefix as the Mashup Server. Test the service operation in the Service Inspector View to see the correct prefix to use.
*
You declare namespaces using the xmlns attribute on any element in a mashup script. Typically, it is easier to define all the namespaces used in the script on the <mashup> element.
This example shows <mashup> with the default namespace set to EMML:
It also has a declaration for an Amazon service that is used within the mashup and a declaration for the namespace used for the mashup result. As this example shows, namespaces are simply valid URIs – they can be URLs or URNs.
Note: previous releases used <namespace> elements to define namespace for component services. This technique is deprecated, although it is still supported.
The Macro Namespace
Mashup scripts that you create in Mashup Studio also automatically have the Macro namespace declared:
http://www.jackbe.com/2008-03-01/EMMLMacro
This namespace is used to identify the custom mashup commands that you define as macros. See <macro:name>: Calling a Macro in a Mashup Script for more information.