How To Define a Payload With No Namespace
There may be situations where your application requires the ability to send/receive messages with a payload that has no namespace, e.g. a javascript application which uses JSON "mapped" serializations. Because alakai employs a "contract first" deployment approach, your message must be modeled using an IDL (interface definition language), e.g. WSDL.
To define a message payload with no namespace requires that you model the message using WSDL 1.1 (WSDL 2.0 messages must reference a global element declaration, which aquires the definining document's target namespace.) The trick is that you must define a complex type (which does have a namespace) and reference it from a WSDL 1.1 message part as indicated within the following example deployment descriptor:
<deployment xmlns="http://bluestemsoftware.org/specification/eoa/1.0/deployment">
<components>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://json/test" targetNamespace="http://json/test">
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://json/test" />
</xs:schema>
</types>
<message name="MyMessage" xmlns:ns="http://json/test">
<part name="U" type="ns:myComplexType" />
</message>
</definitions>
</components>
<providers>
<xs:schema targetNamespace="http://json/test" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="myComplexType">
<xs:sequence>
<xs:element name="V" form="unqualified">
<xs:complexType>
<xs:sequence>
<xs:element name="W" form="unqualified">
<xs:complexType>
<xs:sequence>
<xs:element name="X" form="unqualified">
<xs:complexType>
<xs:sequence>
<xs:element name="Y" form="unqualified" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
<eoa:message xmlns:eoa="http://bluestemsoftware.org/specification/eoa/ext/message/default/1.0" xmlns:tns="http://json/test" name="tns:MyMessage">
<U xmlns="">
<V>
<W>
<X>
<Y>40</Y>
</X>
</W>
</V>
</U>
</eoa:message>
</providers>
</deployment>
When retrieving a message part from a runtime multipart message instance instance (which in this example is named "tns:MyMessage") where the message is typed using a schema type (which in this example is "tns:myComplexType,) the Message#getContent() method returns the "part accessor" element instance, which in this case would be the element "U" with no namespace. The following "mapped" JSON serialization for this payload could then be retrieved by invoking the Content#serializeContent() method passing an instance of ContentSerializationMappedJSON:
{"U":{"V":{"W":{"X":{"Y":40}}}}}
Tada - no namespaces. And ... because your message payload is modeled using XML Schema, the message can be optionally validated at any point within the application, i.e. by invoking the Message#validate() method.