Tuesday, December 29, 2009

Installing ColdFusion under Tomcat in Ubuntu

ColdFusion doesn't seem to run straight off the bat when installed under Tomcat in Ubuntu. Rather, what I had to end up doing was change the webapps.policy file to give permisions for the application. Essentialy to add this one line of code;

permission java.security.AllPermission;

Wednesday, December 2, 2009

Including the pdf in an email

I keep forgetting what the code is, so here it is;
var myDoc = event.target;
myDoc.mailDoc(false, "to", "cc", "bcc", "Subject", "mail body" );
Placing this in the clic\ck event of a button launches the default emailing client and attaches the pdf.

The first parameter can be set to True, thus not requiring the rest of the parameters.

Thursday, August 27, 2009

Invoking a process through webservices: Code

So I ran the installation and heres the basic code to invoke the process through its webservice endpoint.
Notice invoke_Async to invoke a long lived process asynchronously. I also had to make sure that i set the content type of the document that i was sending as a pdf. The classes are supplied when i create proxy classes from the webservice which is done through the Axis' WSDL2Java command. However, i learnt that Eclipse has a functionality that will automatically create the stubs for you based on a wsdl. Makes life alot easier.

 
public class ExpenseProcessInvokeWebService { public static void main(String[] args){ try{ //create a service locator ExpenseProcessServiceLocator locate = new ExpenseProcessServiceLocator(); //specify the service target URL and object type URL serviceURL = new URL("http://yyzdev3:8080/soap/services/ExpenseProcess?blob=dime"); //Use the binding stub with the locator ExpenseProcessSoapBindingStub expenseClientStub = new ExpenseProcessSoapBindingStub(serviceURL,locate); expenseClientStub.setUsername("administrator"); expenseClientStub.setPassword("password"); //Get the DIME Attachments - which is the PDF document to encrypt java.io.File file = new java.io.File("/home/bileni/Documents/Livecycle/ExpenseProject/Form/expense19-8-2009.pdf"); //Create a DataHandler object DataHandler buildFile = new DataHandler(new FileDataSource(file)); //Use the DataHandler object to create an AttachmentPart object AttachmentPart part = new AttachmentPart(buildFile); //part.setContentType("application/pdf"); part.setMimeHeader("Content-Type", "application/pdf"); System.out.println(part.getContentType()); //get the attachment ID String attachmentID = part.getContentId(); //Add the attachment to the encryption service stub expenseClientStub.addAttachment(part); //Inform ES where the attachment is stored by providing the attachment id BLOB inDoc = new BLOB(); inDoc.setAttachmentID(attachmentID); expenseClientStub.invoke_Async(1, null, inDoc); } catch(Exception e){ e.printStackTrace(); } } }

Tuesday, August 18, 2009

Invoking a process through webservices: Axis

I'm in the process of learning how to invoke a livecycle process through a java servlet using webservices. What I needed to do was to have Apache Axis installed to create Java proxy classes for the webservice endpoint of my process. So what I did was rather than install it on my local machine (and have to instal tomcat as well), I installed on the LC server and mounted the shared drive. This makes it much easier to develop and deploy apps.

So just a quick run trhu of the steps I had to take;
1) Download and untar the Axis download
2) copy it to the deploy folder (LCDIR/jboss/server/all/deploy)
3) Copy the xml parser jars from whatever xml parser distribution that you want to use (I used Xerces) into the lib folder of what you had just copied over
4) Create environment variables (unix);
export AXIS_HOME=/usr/axis
export AXIS_LIB=$AXIS_HOME/lib
export AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery.jar:
$AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:
$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar:$AXIS_LIB/xercesImpl.jar:
$AXIS_LIB$/wsdl4j-1.5.1.jar
5) Test axis at http://server:8080/axis

More detail at http://ws.apache.org/axis/java/install.html

Wednesday, August 5, 2009

Checking the signature with Javascript

To check if the signature has been signed from within the form itself, first get the field using
var digSig = event.target.getField("form1[0].#subform[0].Submit[0].Signature[0]");
Its important to use the fully qualified path to the signature.

Once thats done you can use this check the status
var status = digSig.signatureInfo().status;
The possible values you can get are

-1: not a signature field
0: signature is blank
1: unknown status
2: signature is invalid
3: signature is valid, identity of signer could not be verified
4: signature and identity of signer are both valid

Monday, July 27, 2009

Digital Signatures and Rights management (part Deux)

If you have a form that contains a digital signature and has a policy applied to it, if you ever want to edit that signature (or form for that matter) you'll have problems, since the policy is protecting the form. What you'll need to do is use the "unlockPDF" service to temporarily unlock the form. You can only use this in a short lived process, so place that service and whatever you need to do to the form in a subprocess, and use that subprocess in your main process. At the end of the subprocess, the policy will be reapplied to the for automatically.

Another very important ote is that the security for the subprocess must be set to be invoked as a user that has access to the policy (so set the "invoke as" parameter as a specific user)*.

Note* I was have alot of problem with this, as I was getting the "No veiw permissions" error in my logs. The reason was due to the domain of my users. For some reason LC didn't like it, so once i recreated the users and policy into another domain, all became right with the world.

VirtualBox - Creating a template harddrive

Rather than install windows and have to customize each harddrive to the way that you want it, you can simply create one and then clone that harddrive using this command;
VBoxManage clonehd source.vdi destination.dvi
Simple as that.

Wednesday, July 15, 2009

Digital Signatures and Rights management

I've just figured out that if you want to apply any type of policy onto a form (like thru a custom renderer) you need to apply the policy as the first thing. The reason being is that if you apply the policy afterwards, it breaks the digital signature.

Oddly enough this also applies if you reader extend the form. If you apply the reader extension THEN apply the policy, you'll get an error saying that you can't apply a policy on a signed form. Strange, eh?

Monday, July 13, 2009

Digital Signatures and Process Flows

Learning something new, when using digital signatures in a document, the data type of the form should be Document Form. This is exactly like an xfaForm, except you hve the ability to render the form just once and then once submitted the form as a whole document gets transferred over.

Read http://livecycleapps.wordpress.com/2009/02/11/livecycle-process-variable-cheat-sheet/ for more info

The only thing is trying to access field values of a document form type. I'll update when i have that figured out.

update* Looks like i'll have to use the export data service, then use xpath on that xml to access the different values. So you'd have to use something like this in the xpath;
/process_data/formVar//nameOfField

Its also helpful to get values from the form if you don't happen to have a schema attached.

Saturday, April 25, 2009

Linux: Share folders from windows to Kubuntu

I had a little trouble sharing my folders from windows to kubuntu, so with a little digging around i found this command that'll create a folder that'll link to your networkdrive. Of course you can change the location of where you want the mount to which ever folder
sudo mount -t smbfs -o username=james,password=bond //FileServer/Files /home/james/shares/FileServer
Of course if you do this, you may want to give your windows box a static ip, or use the name of the computer instead of the ip address.

To have this network folder permanently mounted, edit your /etc/fstab file to add
//FileServer/Files /home/james/shares/FileServer cifs username=james,password=bond 0 0

Curious tho that it uses cifs rather than smbfs, but i read somewhere that its being deprecated...

*******note: I was trying this on my work laptop, trying to mount a server folder onto my local system, and I kept getting this error in my syslog (/var/log/syslog)
smbfs: mount_data version 1919251317 is not supported
Turns out, it was because i didn't have the smbfs package installed. i don't know why it would have just said that, but in either case simply running
sudo apt-get install smbfs
Fixed it right up

Wednesday, April 22, 2009

Linux: Remoting into Kubuntu

Seems simple enough, here are the ingredients;

Kubuntu (duh)
VNC
Your IP address

So if you go to your start menu and go to your application tab, then Internet->Desktop sharing, you'll bring up Krfb, Kubuntu's native desktop sharing manager. With this app you can send invitations either explicitly (an email) or implicity (where the the invitee has 1 hr to log on).

Once you have Krfb up, click on Configure, then check off "Allow uninvited Connections" (to allow you to connect whenever) and uncheck Ask before accepting uninvited connection (so that you'll go straight in when you remote). Finally, be sure to put a password.

Once thats done you'll have to make sure that the computer, or rather the default port of 5900, is open to the outside world through your router/firewall. You may want to change the port just for security reasons.


Well, i've tried it and i have to say it sucks. or atleast not up to what i was hoping. I vnc'd to my machine at home and it was very laggy (not due to my connection, i can remote desktop in) and the desktop was very jagged. Looks like i'll have to find something better.

Friday, April 17, 2009

Livecycle: Connecting to webservices through Javascript

This is extremely helpful in that you don't have to have hidden fields and have to worry about binding fields to webservices.

First things first, you have to know the address of the webservice. You may have made it through so other server, but if you had created it using livecycle (ie a webservice endpoint), you can either hardcode the address in (in which case skip to the Note), or you can dynamically establish the location of the server;
var server = event.target.URL;
Once you open the form inn WORKSPACE, server will contain an address. This address will contain the address of the server, it'll be in a format of;
http://wfdev:8080/workspace/tksdfjh

So what you'll have to do is to strip out the first part of the address;
server = server.substring(0,server.indexOf("/",8));

And you just tack on the endpoint to the server;
var myUrl = getServerURL.GetServerURL() + "/soap/services/myWebService?wsdl";

This makes it pretty handy if your webservice resides in a test server a prodction server (as an example) and you're transfering the form between servers and you don't want to have to keep changing the address.

******
Note: if your webservice is not on the Livecycle server, and the address is same no matter where you use the form, u can start from here
******

And then once you have the address you make a connection to it
var connection = Net.SOAP.connect(myUrl);
Now once you have this connection, you can call the methods of the service using the dot notation;
var result = connection.myMethod({"paramenter1": value, "parameter2":value2});

Note the way that the parameters are passed in.

Monday, April 13, 2009

Linux: Cheat sheets

I'm trying to brush up on my linux skills and commands, and i constantly searching the web for commands and such. I was thinking about creating a type of "cheat sheet" or commands that i use most often. But until i do, here is a really, really comprehensive listing of different commands that I've found posted on Scott Klarr's website;

http://www.scottklarr.com/topic/115/linux-unix-cheat-sheets---the-ultimate-collection/

Livecycle: maxChars

This was strangely difficult to figure out, it took quite a bit of tracking down to figure out how to accomplish.

I've been trying to figure out to dynamically set the maximum number of characters in a text field and I was misled by a whole bunch of info. But basically heres the line of code;

field.value.text.maxChars = "x";

where x is an integer representing the number of characters.

Simple enough, eh?