In the version that you have you only have one choice to interface with LC (SOAP). In ES2 you coudl also use the Rest Interface (start the orchestration with a URL in the image field but that is a topic for another day).
So in using Soap we must Reader extend the form to allow Reader users to make Soap calls or if we are only interested in getting the image when the form renders then we can set the retrieve image soap call to run server side and no Reader Extensions are required. I will assume an interactive form for now.
To build the Soap service we need two things. A service to retrieve the image from whatever location it is in and a setValue service to base64 encode the contents of the image (for transporation on the Soap envelope). So here is what you need to do:
1. Create a new orchestration - it shoudl be shortlived.
2. Add the service that yo need to retrieve the contents of the image - a readDocument (if on the filesystem) or a retrieve content service (if image is in repository).
3. Create a document variable to hold the image.
4. Configure the service to read the image and store it in the new doc var. Note that you may want to create some sort of input parameter to be able to control which image is retrieved by passing in its value.
5. Drag a new SetValue operation on to the orchestration and connect the read operation to the setValue.
6. Create a new variable of type string (unlimited length) and set it as an output. This is what will be returned to the form and will contain the base64 encoded image.
7. In the setValue create a new Mapping.
8. Edit the mapping to have the string variable in the Location.
9. In the Expression side click to Edit the Expression.
10. In the Editor click on the Functions tab and choose the Document Object Functions. A list of Document Object Functions will appear.
11. Double click on the getDocContentBase64(com.adobe.idp.Document) function. It will be placed in the editor.
12. Renove the com.adobe.idp.Document from inbetween the braces and replace it with the Doc var that holds the image contents. You can click on the Process Data tab and simply choose it from the list. It will be placed in the expression where the cursor currently resides.
13. Now you can save and test you orchestration. Try it from inside of workbench and ensure that it is working as we designed it. You will get a screen of jumbled chars if it works as this is the string that is the base64 encoded image being returned to you.
You may want to turn security off for this service as you do not want to have the user enter credentials each time they get an image.
Now in Designer....
1. Create a new DataConnection of type WSDL
2. Point to the WSDL that was just created.
3. Bind the output string to the ImageField - you may also need to bind any inputs that you have setup.
4. You need a way of executing the SOAP connection - you can use the button provided or you can programmatically execute the service by using:
You can also put the button provided on the form and prgrammatically click it as well.
Now when you execute the web service the orchestration will run - retrieve the image, base64 encode it and return it to the form. The binding will stream the image contents into the image field and it will display.
Thanks for the valueable instructions. I try to configure the service to read the image based on the input that the user enter but get confused. Can you please explain a little bit more on how to "Note that you may want to create some sort of input parameter to be able to control which image is retrieved by passing in its value."
I woudl start by hardcoding the image name in the service to verify that it works. Once that is done, you need some way of telling the service which image you want. This is usually done by passing in the image name. If all images are an employee number followed by an extension, then you can pass the employee number (the dynamic part of the file name) and construct the rest of the filename (the static part) using a setValue operation and string functions.
I tried as you suggested but got the below error:
"[8/13/10 10:26:24:436 CDT] 00000042 WorkflowDSCIn E com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker logFailedFaultRouting An exception was thrown with name com.adobe.livecycle.fileutils.FileUtilsException message:ALC-FUT-001-011: File "http://msms/images/catalog/200.jpg" does not exist. while invoking service FileUtilsService and operation readDocument and no fault routes were found to be configured."
Can you help on this, please provide your email if you would like to see my process.
Well even I tried the UNC path like in Windows explorer, I still got the same error. Please see the error below.
[8/13/10 13:12:58:467 CDT] 00000026 WorkflowDSCIn E com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker logFailedFaultRouting An exception was thrown with name com.adobe.livecycle.fileutils.FileUtilsException message:ALC-FUT-001-011: File D:\My Pictures\Smile.jpg does not exist. while invoking service FileUtilsService and operation readDocument and no fault routes were found to be configured.
Is there a way to make it work with the URL link ?
Well, it was not on the same server. So I moved the file to the server where the LC Process is located then the error is gone.
So here are my two questions:
1) If the file is on a different server, how can I make it work? Does it work with the UNC path like \\ComputerName\SharedFolder\Resource\ ?
2) Is it possbile to make it work with URL link like "http\\abc.com\image\filename.jpg" ?
Then you will need a service to get the file from the other server. If you map a drive to the other server you could use the File Read that you are using. There are other services that come with teh product (FTP, SOAP) that you coudl use to retrieve it.