Workflow Name: amset5writecontent1#

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#

This workflow writes content to the node created in the previous one.

The neat thing about using the CML statements approach to performing repository operations is that the BPEL application is identical apart from the content of the SOAP initiation message. This is given below.

Code snippet 5.1. Worflow input SOAP message.

<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>
        <ns:writeContent>
          <ns:property>{http://www.alfresco.org/model/content/1.0}content</ns:property>
          <!--This is the content to be written in Base64 encoded binary format.-->
          <ns:content>TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=</ns:content>
          <ns:format>
            <ns1:mimetype>text/plain</ns1:mimetype>
            <!--Optional:-->
            <ns1:encoding>UTF-8</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>workspace</ns1:scheme>
                <!--Optional:-->
                <ns1:address>SpacesStore</ns1:address>
              </ns1:store>
              <!--Optional:-->
              <!--This is the UUID of the node created in the previous workflow.-->
              <ns1:uuid>5444c165-8395-42a4-8579-13f4caef5cf4</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>
      </updateRequest>
    </init:InitCreateContentWSOperation>
  </soapenv:Body>
</soapenv:Envelope>

Alfresco Input/Output#

Code snippet 5.2. RepositoryService.update() SOAP input message.

<?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-17T13:40:15.03+00:00</wsu:Created>
                <wsu:Expires>2009-08-17T13:44:15.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_3c89dc4f14b0f61e55bc4d8851665af6f25a6aea</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: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>workspace</ns1:scheme>
                                <ns1:address>SpacesStore</ns1:address>
                            </ns1:store>
                            <ns1:uuid>5444c165-8395-42a4-8579-13f4caef5cf4</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/>
                </ns:writeContent>
            </ns0:statements>
        </update>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Code snippet 5.3. RepositoryService.update() SOAP output message.

<?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>writeContent</statement>
                <updateCount xsi:nil="true"/>
                <sourceId xsi:nil="true"/>
                <source>
                    <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>
                </source>
                <destination>
                    <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">5444c165-8395-42a4-8579-13f4caef5cf4</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>
                </destination>
            </updateReturn>
        </updateResponse>
    </soapenv:Body>
</soapenv:Envelope>

Alfresco#

If we go back to Alfresco, the screenshot below shows that there is now 0.26 kB of data in the node which was previously empty.

Figure 5.1. The new node with content.


Clicking the node's hyperlink reveals the content:

Man is distinguished, not only by his reason, but by this singular passion from other animals, 
which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of
knowledge, exceeds the short vehemence of any carnal pleasure.

(Hobbes)

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
writecontent1.png 13.3 kB 1 17-Aug-2009 14:33 clayton
« This page (revision-) was last changed on 06-Sep-2009 13:35 by clayton