!Workflow Name: amset4createnode

!Constituent Services: AuthenticationService, RepositoryService, InitCreateContentWS, DateTimeWS

!Technical Notes

Platform: GlassFishESB V2.1, NetBeans IDE 6.5 (including BPEL Designer, implementing WS-BPEL 2.0)\\
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15\\
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb).

\\

Alfresco Labs 3.1 Final running on remote server, 64-bit Java 1.6.0_13, Tomcat 6 on Red Hat Enterprise Linux 5.


!Workflow Description

__CML: workflow within workflow__

Alfresco uses XML in the form of the Content Manipulation Language (CML) to create statements that can be translated into executable form to perform repository tasks and workflows.  The {{update}} operation of the {{Repository Service}} accepts a sequence of CML statements for execution.  Hence, by stealth, {{RepositoryService.update()}} can do just about anything.

There is documentation for creating CML statements programmatically for a range of client technologies such as plain Java, Java Web services, PHP and JavaScript, for example.  However, how the WSDL operation datatypes map to the Java API is not crystal clear and a bit of suck-it-and-see is required in terms of the SOAP request messages. 

Creating content in Alfresco is a two-stage process.  First a {{node }} is created in the repository, then content is written to it.  To do the writing one can add a CML write statement to the one that creates the node, or else one can use the {{ContentService.write()}} operation.  These options will be illustrated in the next couple of workflows.  Here, the {{node }} is created only.

\\

Because of the operation-for-all-seasons role played by {{RepositoryService.update()}}, the automatically generated input XML template is not brief, as shown below. 

__Code snippet 4.1. Generated SOAP Body for initialisation of CreateNode workflow__

%%prettify 
{{{
<soapenv:Envelope xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:init="http://j2ee.netbeans.org/wsdl/amset5createcontent1/InitCreateContentWS" xmlns:ns="http://www.alfresco.org/ws/cml/1.0" xmlns:ns1="http://www.alfresco.org/ws/model/content/1.0">
  <soapenv:Body>
    <init:InitCreateContentWSOperation>
      <username></username>
      <password></password>
      <updateRequest>
        <!--Zero or more repetitions:-->
        <ns:create>
          <!--Optional:-->
          <ns:id>CreateNode</ns:id>
          <!--Optional:-->
          <ns:parent>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:uuid></ns1:uuid>
            <!--Optional:-->
            <ns1:path></ns1:path>
            <!--Optional:-->
            <ns1:associationType></ns1:associationType>
            <!--Optional:-->
            <ns1:childName></ns1:childName>
          </ns:parent>
          <!--Optional:-->
          <ns:parent_id></ns:parent_id>
          <!--Optional:-->
          <ns1:associationType></ns1:associationType>
          <!--Optional:-->
          <ns1:childName></ns1:childName>
          <!--Optional:-->
          <ns:type></ns:type>
          <!--Zero or more repetitions:-->
          <ns:property>
            <ns1:name></ns1:name>
            <ns1:isMultiValue></ns1:isMultiValue>
            <ns1:value></ns1:value>
            <!--Zero or more repetitions:-->
            <ns1:values></ns1:values>
          </ns:property>
        </ns:create>
        <!--Zero or more repetitions:-->
        <ns:addAspect>
          <ns:aspect></ns:aspect>
          <!--Zero or more repetitions:-->
          <ns:property>
            <ns1:name></ns1:name>
            <ns1:isMultiValue></ns1:isMultiValue>
            <ns1:value></ns1:value>
            <!--Zero or more repetitions:-->
            <ns1:values></ns1:values>
          </ns:property>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
        </ns:addAspect>
        <!--Zero or more repetitions:-->
        <ns:removeAspect>
          <ns:aspect></ns:aspect>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
        </ns:removeAspect>
        <!--Zero or more repetitions:-->
        <ns:update>
          <!--1 or more repetitions:-->
          <ns:property>
            <ns1:name></ns1:name>
            <ns1:isMultiValue></ns1:isMultiValue>
            <ns1:value></ns1:value>
            <!--Zero or more repetitions:-->
            <ns1:values></ns1:values>
          </ns:property>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
        </ns:update>
        <!--Zero or more repetitions:-->
        <ns:writeContent>
          <ns:property></ns:property>
          <ns:content></ns:content>
          <ns:format>
            <ns1:mimetype></ns1:mimetype>
            <!--Optional:-->
            <ns1:encoding></ns1:encoding>
          </ns:format>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
        </ns:writeContent>
        <!--Zero or more repetitions:-->
        <ns:delete>
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
        </ns:delete>
        <!--Zero or more repetitions:-->
        <ns:move>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:to>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:uuid></ns1:uuid>
            <!--Optional:-->
            <ns1:path></ns1:path>
            <!--Optional:-->
            <ns1:associationType></ns1:associationType>
            <!--Optional:-->
            <ns1:childName></ns1:childName>
          </ns:to>
          <!--Optional:-->
          <ns:to_id></ns:to_id>
          <!--Optional:-->
          <ns1:associationType></ns1:associationType>
          <!--Optional:-->
          <ns1:childName></ns1:childName>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
        </ns:move>
        <!--Zero or more repetitions:-->
        <ns:copy>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:to>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:uuid></ns1:uuid>
            <!--Optional:-->
            <ns1:path></ns1:path>
            <!--Optional:-->
            <ns1:associationType></ns1:associationType>
            <!--Optional:-->
            <ns1:childName></ns1:childName>
          </ns:to>
          <!--Optional:-->
          <ns:to_id></ns:to_id>
          <!--Optional:-->
          <ns1:associationType></ns1:associationType>
          <!--Optional:-->
          <ns1:childName></ns1:childName>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
          <!--Optional:-->
          <ns:children></ns:children>
        </ns:copy>
        <!--Zero or more repetitions:-->
        <ns:addChild>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:to>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:uuid></ns1:uuid>
            <!--Optional:-->
            <ns1:path></ns1:path>
            <!--Optional:-->
            <ns1:associationType></ns1:associationType>
            <!--Optional:-->
            <ns1:childName></ns1:childName>
          </ns:to>
          <!--Optional:-->
          <ns:to_id></ns:to_id>
          <!--Optional:-->
          <ns1:associationType></ns1:associationType>
          <!--Optional:-->
          <ns1:childName></ns1:childName>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
        </ns:addChild>
        <!--Zero or more repetitions:-->
        <ns:removeChild>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:from>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:uuid></ns1:uuid>
            <!--Optional:-->
            <ns1:path></ns1:path>
          </ns:from>
          <!--Optional:-->
          <ns:from_id></ns:from_id>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:where>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:where>
          <!--Optional:-->
          <ns:where_id></ns:where_id>
        </ns:removeChild>
        <!--Zero or more repetitions:-->
        <ns:createAssociation>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:from>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:from>
          <!--Optional:-->
          <ns:from_id></ns:from_id>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:to>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:to>
          <!--Optional:-->
          <ns:to_id></ns:to_id>
          <ns:association></ns:association>
        </ns:createAssociation>
        <!--Zero or more repetitions:-->
        <ns:removeAssociation>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:from>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:from>
          <!--Optional:-->
          <ns:from_id></ns:from_id>
          <!--You have a CHOICE of the next 2 items at this level-->
          <!--Optional:-->
          <ns:to>
            <!--You have a CHOICE of the next 2 items at this level-->
            <!--Zero or more repetitions:-->
            <ns1:nodes>
              <!--Optional:-->
              <ns1:store>
                <!--Optional:-->
                <ns1:scheme></ns1:scheme>
                <!--Optional:-->
                <ns1:address></ns1:address>
              </ns1:store>
              <!--Optional:-->
              <ns1:uuid></ns1:uuid>
              <!--Optional:-->
              <ns1:path></ns1:path>
            </ns1:nodes>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme></ns1:scheme>
              <!--Optional:-->
              <ns1:address></ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:query>
              <ns1:language></ns1:language>
              <ns1:statement></ns1:statement>
            </ns1:query>
          </ns:to>
          <!--Optional:-->
          <ns:to_id></ns:to_id>
          <ns:association></ns:association>
        </ns:removeAssociation>
      </updateRequest>
    </init:InitCreateContentWSOperation>
  </soapenv:Body>
</soapenv:Envelope>
}}}
/%

To make it a bit easier to sort out the binding it was useful to introduce a schema with a reduced datatype for the {{RepositoryService.update()}} operation.

__Code snippet 4.2. Reduced Datatype for RepositoryService Update Request__

%%prettify 
{{{
<schema elementFormDefault="qualified"
targetNamespace="http://j2ee.netbeans.org/wsdl/amset5createcontent1/InitCreateContentWS/repodata"
xmlns:tns="http://j2ee.netbeans.org/wsdl/amset5createcontent1/InitCreateContentWS/repodata"
xmlns:cml="http://www.alfresco.org/ws/cml/1.0"
xmlns:cms="http://www.alfresco.org/ws/model/content/1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <xsd:import namespace="http://www.alfresco.org/ws/headers/1.0" schemaLocation="headers.xsd"/>
            <xsd:import namespace="http://www.alfresco.org/ws/cml/1.0" schemaLocation="cml.xsd"/>
            <xsd:import namespace="http://www.alfresco.org/ws/model/content/1.0" schemaLocation="types.xsd"/>
            
            <element name="update">
                <complexType>
                    <sequence>
                        <element name="statements" type="cml:CML"/>
                    </sequence>
                </complexType>
            </element>
         
            <element name="updateResponse">
                <complexType>
                    <sequence>
                        <element maxOccurs="unbounded" minOccurs="0" name="updateReturn" type="tns:UpdateResult"/>
                    </sequence>
                </complexType>
            </element>
         
            <complexType name="UpdateResult">
                <sequence>
                    <element name="statement" type="xsd:string"/>
                    <element name="updateCount" nillable="true" type="cms:ResultSet"/>
                    <element name="sourceId" nillable="true" type="xsd:string"/>
                    <element name="source" nillable="true" type="cms:Reference"/>
                    <element name="destination" nillable="true" type="cms:Reference"/>
                </sequence>
            </complexType>

            <element name="UpdateResult" type="tns:UpdateResult"/>

        </schema>}}}
/%

This provides a more sympathetic SOAP input.  The BPEL workflow is initiated using the following SOAP message.

__Code snippet 4.3. Input SOAP Message for InitCreateContentWS__

%%prettify 
{{{
<soapenv:Envelope xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:init="http://j2ee.netbeans.org/wsdl/amset5createcontent1/InitCreateContentWS" xmlns:ns="http://www.alfresco.org/ws/cml/1.0" xmlns:ns1="http://www.alfresco.org/ws/model/content/1.0">
  <soapenv:Body>
    <init:InitCreateContentWSOperation>
      <username>admin</username>
      <password>adminPassword</password>
      <updateRequest>
        <!--Zero or more repetitions:-->
        <ns:create>
          <!--Optional:-->
          <ns:id>CreateNode</ns:id>
          <!--Optional:-->
          <ns:parent>
            <!--Optional:-->
            <ns1:store>
              <!--Optional:-->
              <ns1:scheme>workspace</ns1:scheme>
              <!--Optional:-->
              <ns1:address>SpacesStore</ns1:address>
            </ns1:store>
            <!--Optional:-->
            <ns1:uuid>a390583c-1704-4fb5-955f-826d5a9f8563</ns1:uuid>
            <!--Optional:-->
            <ns1:path></ns1:path>
            <!--Optional:-->
            <ns1:associationType>{http://www.alfresco.org/model/content/1.0}contains</ns1:associationType>
            <!--Optional:-->
            <ns1:childName>{http://www.alfresco.org/model/content/1.0}contains</ns1:childName>
          </ns:parent>
          <ns:type>{http://www.alfresco.org/model/content/1.0}content</ns:type>
          <!--Zero or more repetitions:-->
          <ns:property>
            <ns1:name>{http://www.alfresco.org/model/content/1.0}name</ns1:name>
            <ns1:isMultiValue>false</ns1:isMultiValue>
            <ns1:value>BPSOCT10DOCNODE</ns1:value>
            <!--Zero or more repetitions:-->
            <ns1:values></ns1:values>
          </ns:property>
        </ns:create>    
      </updateRequest>
    </init:InitCreateContentWSOperation>
  </soapenv:Body>
</soapenv:Envelope>}}}
/%

This results in the following SOAP message going to the {{RepositoryService.update() }}operation.

\\

According to the schema, it looks like the unique identifier for the parent folder would be sufficient to identify it, but the schema and addess are required also.

__Code snippet 4.4. Input SOAP Message for RepositoryService.update()__

%%prettify 
{{{
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
        <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsu:Created>2009-08-07T10:39:07.88+00:00</wsu:Created>
                <wsu:Expires>2009-08-07T10:43:07.00+00:00</wsu:Expires>
            </wsu:Timestamp>
            <UsernameToken>
                <Username>admin</Username>
                <Password Id="" Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">TICKET_ffbe9abe434075e30034515ade00ff6038ad4b7a</Password>
            </UsernameToken>
        </Security>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <update
            xmlns="http://www.alfresco.org/ws/service/repository/1.0" xmlns:msgns="http://www.alfresco.org/ws/service/repository/1.0">
            <ns0:statements
                xmlns:init="http://j2ee.netbeans.org/wsdl/amset5createcontent1/InitCreateContentWS"
                xmlns:msgns="http://j2ee.netbeans.org/wsdl/amset5createcontent1/InitCreateContentWS"
                xmlns:ns="http://www.alfresco.org/ws/cml/1.0"
                xmlns:ns0="http://www.alfresco.org/ws/service/repository/1.0" xmlns:ns1="http://www.alfresco.org/ws/model/content/1.0">
                <ns:create>
                    <ns:id>CreateNode</ns:id>
                    <ns:parent>
                        <ns1:store>
                            <ns1:scheme>workspace</ns1:scheme>
                            <ns1:address>SpacesStore</ns1:address>
                        </ns1:store>
                        <ns1:uuid>a390583c-1704-4fb5-955f-826d5a9f8563</ns1:uuid>
                        <ns1:path/>
                        <ns1:associationType>{http://www.alfresco.org/model/content/1.0}contains</ns1:associationType>
                        <ns1:childName>{http://www.alfresco.org/model/content/1.0}contains</ns1:childName>
                    </ns:parent>
                    <ns:type>{http://www.alfresco.org/model/content/1.0}content</ns:type>
                    <ns:property>
                        <ns1:name>{http://www.alfresco.org/model/content/1.0}name</ns1:name>
                        <ns1:isMultiValue>false</ns1:isMultiValue>
                        <ns1:value>BPSOCT10DOCNODE</ns1:value>
                        <ns1:values/>
                    </ns:property>
                </ns:create>
            </ns0:statements>
        </update>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
}}}
/%

This creates a node of name BPSOCT10DOCNODE in the parent folder identified by {{workspace://SpacesStore/a390583c-1704-4fb5-955f-826d5a9f8563}} which is in the {{What is the Protein Folding Problem Folder}}.  The identifier for the new node is returned in the SOAP response.

__Code snippet 4.5. RepositoryService.update() SOAP response__

%%prettify 
{{{
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <updateResponse xmlns="http://www.alfresco.org/ws/service/repository/1.0">
            <updateReturn>
                <statement>create</statement>
                <updateCount xsi:nil="true"/>
                <sourceId>CreateNode</sourceId>
                <source xsi:nil="true"/>
                <destination>
                    <ns1:store xmlns:ns1="http://www.alfresco.org/ws/model/content/1.0">
                        <ns1:scheme>workspace</ns1:scheme>
                        <ns1:address>SpacesStore</ns1:address>
                    </ns1:store>
                    <ns2:uuid xmlns:ns2="http://www.alfresco.org/ws/model/content/1.0">5444c165-8395-42a4-8579-13f4caef5cf4</ns2:uuid>
                    <ns3:path xmlns:ns3="http://www.alfresco.org/ws/model/content/1.0">/app:company_home/cm:Waffle_x0020_Bus_x0020_Workflows/cm:What_x0020_is_x0020_the_x0020_Protein_x0020_Folding_x0020_Problem/cm:contains</ns3:path>
                </destination>
            </updateReturn>
        </updateResponse>
    </soapenv:Body>
</soapenv:Envelope>
}}}
/%


This node will appear in the Alfresco web application:

__Figure 4.1.  New node represented in Alfresco Web application__

[{Image src='createnode.png' width='1029' height='331' align='left'  }]

\\

Note that if the node is named using a filename format that Alfresco recognises like {{file.txt }}or {{file.html}}, then the appropriate icon is displayed.  The Web application isn't happy with an empty content node, though, and if the associated link is clicked then the following message is returned.

__Figure 4.2.  No content node error message

[{Image src='nocontentmessage.png' width='593' height='104' align='left'  }]