Workflow Name: amset6createandwrite#

Constituent Services: AuthenticationService, RepositoryService, InitCreateContentWS, DateTimeWS#

Technical Notes#

Platform: GlassFishESB V2.1, NetBeans IDE 6.5.1 (Build 200905151554)
Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.2-b01
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#

amset4 created a node and amset5 wrote content to it. This workflow combines the two operations.

There is a little lollipop required here. In order to write to the node in amset5 the uuid returned by the create process in amset4 was supplied. This is not possible if the two operations are carried out using contiguous Alfresco CML statements, there being no explicit way to pass the newly created uuid to the write statement.

The solution is to link the statements using an id element declared in the create statement and referenced in the write statement. Alfresco then does the necessary logical linkage of the create and write processes.

The RepositoryService.update() SOAP input and output messages are shown below. The elements linking the 2 CML statements, both with value CreateAndWrite, are id in create and where_id in writeContent.

Code snippet 6.1. RepositoryService.update() SOAP request.

<?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-18T12:00:20.31+00:00</wsu:Created>
                <wsu:Expires>2009-08-18T12:04:20.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_3a322efa2044d1544e135b48f16729f0f2d5fb17</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>CreateAndWrite</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>CreateAndWrite.txt</ns1:value>
                        <ns1:values/>
                    </ns:property>
                </ns:create>
                <ns:writeContent>
                    <ns:property>{http://www.alfresco.org/model/content/1.0}content</ns:property>
                    <ns:content>TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=</ns:content>
                    <ns:format>
                        <ns1:mimetype>text/plain</ns1:mimetype>
                        <ns1:encoding>UTF-8</ns1:encoding>
                    </ns:format>
                    <ns:where>
                        <ns1:nodes>
                            <ns1:store>
                                <ns1:scheme/>
                                <ns1:address/>
                            </ns1:store>
                            <ns1:uuid/>
                            <ns1:path/>
                        </ns1:nodes>
                        <ns1:store>
                            <ns1:scheme/>
                            <ns1:address/>
                        </ns1:store>
                        <ns1:query>
                            <ns1:language/>
                            <ns1:statement/>
                        </ns1:query>
                    </ns:where>
                    <ns:where_id>CreateAndWrite</ns:where_id>
                </ns:writeContent>
            </ns0:statements>
        </update>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Code snippet 6.2. RepositoryService.update() SOAP response.

<?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>CreateAndWrite</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">471d4bc3-5285-4f9e-9bab-f923943a76e0</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>
            <updateReturn>
                <statement>writeContent</statement>
                <updateCount xsi:nil="true"/>
                <sourceId xsi:nil="true"/>
                <source>
                    <ns4:store xmlns:ns4="http://www.alfresco.org/ws/model/content/1.0">
                        <ns4:scheme>workspace</ns4:scheme>
                        <ns4:address>SpacesStore</ns4:address>
                    </ns4:store>
                    <ns5:uuid xmlns:ns5="http://www.alfresco.org/ws/model/content/1.0">471d4bc3-5285-4f9e-9bab-f923943a76e0</ns5:uuid>
                    <ns6:path xmlns:ns6="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</ns6:path>
                </source>
                <destination>
                    <ns7:store xmlns:ns7="http://www.alfresco.org/ws/model/content/1.0">
                        <ns7:scheme>workspace</ns7:scheme>
                        <ns7:address>SpacesStore</ns7:address>
                    </ns7:store>
                    <ns8:uuid xmlns:ns8="http://www.alfresco.org/ws/model/content/1.0">471d4bc3-5285-4f9e-9bab-f923943a76e0</ns8:uuid>
                    <ns9:path xmlns:ns9="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</ns9:path>
                </destination>
            </updateReturn>
        </updateResponse>
    </soapenv:Body>
</soapenv:Envelope>

Figure 6.1. New content in Alfresco.

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
png
createandwrite.png 14.5 kB 1 18-Aug-2009 12:06 clayton
« This page (revision-) was last changed on 06-Sep-2009 13:35 by clayton