Wednesday 4 February 2009

Oracle Aqua logic ESB and Alfresco document management integration

Alfresco provides SOAP API for integration of document management services. The SOAP web services are secured using username token profile standard. In lay man terms this means each web service calls requires authentication ticket in SOAP headers.
To insert a document in alfresco document management service, insure a store exists and a user has rights to it, following that follow steps below

1) Use authentication service to Authenticate and retrieve a token
2) Use the token from step 1 and pass to any subsequent web service calls, in this case create service (to store document)


Alfresco Authentication service from ESB

Insure alfresco is running, if not start alfresco using shortcut in start menu
1) Import the WSDL. The WSDL file could be found in WSDL folder example C:\Alfresco\tomcat\webapps\alfresco\wsdl
2) Create business service using the business service in step 1
3) Call the start session operation, passing the username and password.

This will result in service returning:





admin

TICKET_d1b09a6cf0a6083e1079be6dff9a09ff1300fd95

636589202940FF49CF5A2705FBA7AB9A







Ticket returned in the response needs to be passed along to subsequent calls in SOAP header
Content service in alfresco

When calling write operation in create service, authentication information is required in soap header example:




2008-09-25T13:32:32.203Z
2009-09-29T19:13:32.203Z


ticket
TICKET_bcf645c4cbf5b5a43eba43ca65147ab0f202c179
JrKZdUBVLTODE7Hayc+35A==
2008-09-25T13:32:32.203Z








workspace
SpacesStore



/app:company_home/app:guest_home/cm:TestUpload2.txt

{http://www.alfresco.org/model/content/1.0}content

aGVsbG8gdGhpcyBpcyB0ZXN0

text/html
utf-8







Content

The content passed in write operation needs to be in base64 format. There are various methods of encoding a file into base64 format. To get started one could use online services. Programmatically ESB provides function to convert text to base64 format. In POC it was converted using JAX-WS based web service.

Mime type
Correct mime type of the content needs to be passed along so that when reading browser could render the content. List of mime types could be found here

Password Text
Password text field contains the Ticket retrieved from authentication service.

Once the document has been uploaded into the repository end session operation of authentication service is called along with ticket


Copy the DLL for CIFS to work

From
C:\Alfresco\extras\bin
To
C:\WINDOWS\system32

2 comments:

Mr. Ed said...

Interesting example. We are integrating Alfresco with ServiceMix ESB. What use case do you have in mind? We have a lot of automated content processing to support our web site, and are attempting to offload acquisition, transformation (incl. translation) and publishing to ESB.

singh said...

Thanks Ed,

Alfresco is used as repository to store documents in xml format.

Post processing is applied to xml to archive in appropriate location, apply appropriate template to convert them to pdf/word on the fly.

the role of esb is to provide a layer of abstraction so the client is unaware where documents are being stored