Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Namespace handling is a crucial requirement in Web services as every aspect is based on XML. A data service is also a typical web service, with specialized functionality.

Follow the instructions below to set namespaces using the management console.

1. Log on to the product's management console and select "Data Service -> Create" under the "Main" menu.

Image RemovedImage Added

There are several places in a data service to define namespaces as follows:

Service Namespace 
Anchor
Service Namespace
Service Namespace

The service namespace is used to uniquely identify a web service. In the WSDL which represents the service, it is indicated by the "targetNamespace" attribute of the WSDL document element. The service namespace can be set using the Create/Edit Data Service window of the Data Services Server management console.

For example,

Image Modified

Data Service Result Row Namespace 
Anchor
Data Service Result Row Namespace
Data Service Result Row Namespace

This namespace is set through the Row namespace value in the query result section. It associates the result rows or result entries of a specific namespace. Therefore, all the subelements in that result raw are under this namespace by default.

The example below shows how the row namespace is set for the query result element: Customers.

Image Modified

After setting the row namespace, the Customers element's data type falls under the given namespace.

The XML Schema fragment in data types section taken from the service's WSDL is as follows:

Namespaces for Specific Elements in the Result 
Anchor
Namespaces for Specific Elements in the Result
Namespaces for Specific Elements in the Result

You might want only selected elements in the result row to contain a specific namespace. This can be defined by setting the namespace in the output mappings as follows:

Image Modified

This is how the setting is reflected in the WSDL.

Namespaces for Complex Results 
Anchor
Namespaces for Complex Results
Namespaces for Complex Results

In complex results in data services, the result elements can be arbitrarily nested. These nested elements can have their own namespaces. The example below shows how this is represented in a database file fragment, which has a complex result.

The WSDL created for the above service is as follows:

The resulted XML of the executed service is as follows:

Namespace Inheritance in a Data Service

There's an inheritance order where a top-level namespace is inherited by its children. In summary, the inheritance is as follows:

  • Service namespace is applied to all aspects of the data service, i.e. results.
  • Result row namespace overrides the service namespace and applies a given namespace for the whole result.
  • Complex result, nested elements override the result row namespace and assign the namespace to all its child elements.
  • A namespace specifically assigned to an element overrides the parent element's namespace and assigns the given namespace to itself.