Friday, February 6, 2009

Creating and embedding WOLF based applications as eWidgets in your own website


Hello Friends,

Here's the promised post on Creating eWidgets using WOLF Platform-as-a-Service ...

e-Widgets are web based functionality developed using Wolf Platform and made available as part of a different website anywhere in the world. It is a small piece of codes that take the data of specific application from a specific Business Rule. These are XML based data. Using XSLT the data are extracted & the output is produced in HTML format according to the user needs.

Through ewidgets we can restructure the data in any format. To get the data from WOLF Runtime Environment JavaScript or ASP is used. To embed this widget you need to generate a key. For the key, you need a user name and a Domain/localhost URL.

Quick steps to create a eWidget using WOLF Platform-as-a-Service:

1. Create HTML file.
2. Create XSLT file
Write your code according to how you want the data.
3. In the HTML body section
Put the following code




Let me explain you the details of the above code and what it is trying to achieve:

Javascript.ashx is a handler file.
Appid: write your WOLF based Business Application ID (AppID).You can see your Appid when you access your runtime or design time of wolf platform. You can see your appid in the address bar. Look at this sample URL (http://run.wolfframeworks.com/?appid=119DDDD_a205)
The AppID is: 119DDDD_a205

Key :
Write your own public widget key

Steps to create a public key for your eWidget. (Please remember that your widget key is always mapped to a specific user name and tied to a domain URL. You need to add a user to generate a key)

1.Go to run time mode of your application.
2.Enter your administrator or design mode user id & password.
3.Go to manage users & click on find now
4.Please open a user name (the user who would have access to the widget) & go to Entity Data Access section & give access to the user domain. This is a system generated Entity. You need to choose the Solution Root folder and give him 'edit' and 'delete' rights.
5. Do the same thing for menu access.
6.Now log inside the Runtime Mode as the user who has access to the Domain Entity.
7.Click on the 'All Navigation Item' bar & go to the Application Domain
8. Then Click on User Domain and add a new entry.

Enter the domain Name : it could your localhost or your websitename.com URL . Please
remember, this is the URL from where the WOLF based application will be embedded
as a eWidget.
Enter the key : Put a numerical key - any combination is fine. Just remember it :)
Enter the user : Put the name of the user

Now how to use & embed the widget in your code using the Key

The Key is used to authenticate the user. Instead of giving your user id & password you can put a key and so no user name login is required. The Key which we generated is mapped to a specific user. The mapped user only has the access to use & embed the widget in his declared URL. The Key is also mapped to the domain name. If the domain name is localhost then the application can only be accessed through localhost only. If it is mapped to Your Website name then it is accessible through only your website.

service=processbusinessrule
: This statement will process the BusinessRule.
Rulename= Your Business Rule Name (Please make sure you use the right Business Rule Name)
callback=writePandLSheet: This statement is the name of the method and is used to transform XML through XSLT

<head>
<script>
function writeDC(wsfXMLDocument)
{
var s = wsfXMLDocument;
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(s);

xmlDoc1=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc1.async="false";
xmlDoc1.load("XslFile.xsl");

var xsl=xmlDoc1;
var ex=xmlDoc.transformNode(xmlDoc1);
document.getElementById("plForm").innerHTML=ex;
}
</head>
</script>

wsfXMLDocument is data taken from BusinessRule. It is in XML format.
The XML is loaded using loadXML.
Now load your XSL file.
The XML is transformed using transformNode.
Now put the formatted data in div using getElementById.

mode is xml
WOLF Format



eWidgets Format (this is how it looks)


Using WOLF based eWidgets you can get data in Your own Format and embed in any website by generating a key. Please try the process for any of your WOLF based application and let us know.

Regards,

Sharp Developer

No comments: