Friday, September 11, 2009

Why do we need WCF

There was a time when applications used to sit on separate computers, then came a need for the different computers to talk to each other. Well we all know that web and web services have long been in there and have been communicating with each other.

We all understand that XML has been adopted as a great medium of communication between web services and their clients. But, in the absence of a protocol, there is no one way to use XML. The sender and receiver of the information have to decide on a certain format for the information every time. It is easier if a global standard is present and the information is shared by default based on that standard.
Web services and client applications communicate with each other by using the Simple Object Access Protocol or SOAP.
SOAP defines the following:

- The format of the SOAP message
- How data should be encoded
- How to send messages
- How to handle replies to these messages

A web service can simply display the messages that a client application can send it and the responses the client application will receive by publishing a Web Service Description Language (WSDL) document.
Now, there are other technologies apart from WCF like .Net Remoting and MSMQ for transfer of information.
What WCF does is provides a unified programming model for many of these technologies, enabling you to build applications that are as independent as possible from the underlying mechanism being used to connect services and applications together. So that the programmatic structure is completely separate from the communication structure.

Now, how does it do that????

So suppose we have a server application and a client application – at the base, we have .Net framework, a set of classes in form of WCF on top and the two interacting with the help of SOAP. By default WCF operations are of the type known as request – reply; the client issues a request in the form of a message and the server responds by replying to the request.


The client need not be based on WCF; it can be J2EE based or anything that supports SOAP. This is a very important point as it supports interoperability with applications built on other technologies.
WCF can also be extended to process plain XML data that is not wrapped in the SOAP envelope. WCF can also be extended to support ATOM or JSON. Thus, we can say WCF is really helpful and is designed to support the present as well as the future scenarios.

Thursday, August 20, 2009

Creating Custom lists in Windows Sharepoint Services 3.0

Custom lists are easy to create in Windows Sharepoint Services 3.0 and then they can be used with Workflows, custom columns, lookup columns and calculated fields. Although there are already existing lists provided by Sharepoint but, using custom lists gives you more options to work with your data.

Step 1: If you have an excel sheet full of data, it is important to remember not to put it all in one list. Break up your data into different lists simply on the basis of different entities. Like Product into one, Order into the other etc.

e.g.

Company

Product

Employee

EmpID

Price

Qty

Total

ABC Ltd

Bicycle

Arun

E123

Rs. 125

3

Rs. 375

BCD Ltd

Toy Gun

Anil

E456

Rs. 75

2

Rs. 150

Step 2: Here we are assuming you already have a blank site to work with. First we will create the Products custom list.

Select Site Actions - Create




Step 3: On the Create screen select ‘Custom List’ from the ‘Custom Lists’ section.





Step 4: On the New screen type ‘Products’ in the ‘Name’ field and type a relevant description in the ‘Description’, then click on create button.

Step 5: We will now have an empty list called ‘Products’. This is a simple empty list without any columns. We will simply use the same columns as in the spreadsheet.

Now, we have to remember that everything is Sharepoint is based on Content Type. It is difficult for someone who has been working on SQL to get used to this idea of Content Types. By default our new Custom List is based on Item Content Type, so it already has a default column – ‘Title’

Step 6: We can even change the name of the column Title.

-> Select Settings - List Settings

-> In the ‘Columns’ section click on the ‘Title’ button.

-> On the ‘Change Column’ screen, in the ‘Column Name’ field type ‘Product Name’.

-> Click on the ‘OK’ button.

-> When you click on the Products list now, you will notice that the heading has now changed to ‘Product Name’.

Step 7: The next step is to add another column to our custom list.

-> Select Settings - Create Column

-> In the Column name fields type ‘Price’.

-> In the type of information field select ‘Currency’.

-> In the Currency format field select an appropriate currency.

-> Click the ‘OK’ button.

We will now have another column named – Price.

We can use the same steps for creating new columns or changing existing columns.

Step 8: The next step is to add data to our custom list i.e. to create a new list item

-> Click the New button.

-> Type the product name in the respective column

-> Type the price for the product in the respective column.

-> Click the OK button.

You will have the below data in your list:

Product Name

Price

Bicycle

Rs. 125

Toy Gun

Rs. 75

Step 9: Follow the same steps to create the ‘Customers’ list.

The ‘Customers’ list can have the below columns:

Last Name

First Name

Company

EmpID

Gupta

Arun

ABC Ltd

E123

Jain

Anil

BCD Ltd

E456

You can get these columns by following Steps 5,6,7 and 8.

Step 10: We can also create custom lists with lookup columns to other lists. Let us create a list ‘Orders’ with lookup columns for Customer and Product created above.

-> First create a ‘Product’ list following the steps 5, 6, 7 and 8.

The columns in the list would be as follows:

Quantity

Total

3

Rs. 375

2

Rs. 150

Now, we need to add the respective lookup columns. To create the customer column we will follow the below steps:

-> Select Settings – Create Column

-> In the ‘Column Name’ field type ‘Customer’.

-> In the ‘Type of information’ field select ‘Lookup’.

-> In the ‘Get Information from’ field, select Customers from the drop down list.

-> In the ‘In this column’ field, select ‘Full Name’ from the drop down list.

-> We can repeat the same steps for a column named ‘Products’ and a lookup to the Products list.

So, finally our Orders list would look something like:

Quantity

Total

Customer

Products

3

Rs. 375

Arun Gupta

Bicycle

2

Rs. 150

Anil Jain

Toy Gun

So, in Sharepoint, you can easily normalize your data by dividing it into lists. You can also link different lists using lookup columns.