Sunday, 25 August 2013

SOAP and REST

WCF services in enterprises are used for developing distributed enterprise application. There are lots of advantages of using WCF services. WCF service can be exposed on multiple endpoints e.g. HTTP, TCP etc. and the client applications have a choice to select the specific endpoint for the communication. WCF 3.5 had introduced support for Representational State Transfer (REST) using which the response from the service can be directly send using Plain Old Xml form (POX). If the WCF service is using REST/POX, then it is not necessary for the client to consume the WCF service proxy. For REST, WCF introduced a new binding i.e. WebHttpBinding. A client application that can do HTTP communication and can process XML, could now directly make a call to the WCF service and perform operations using XML.

And now the million dollar question which motivated me to write this article – If an existing service is already exposing SOAP using bindings like the basicHttpBinding, then can the same service expose REST i.e. using WebHttpBinding too? The answer is YES and in this article, I have explained the same.

Sunday, 18 August 2013

how to play flash file in html

<object width="400" height="40"
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/
pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
<param name="SRC" value="sound.swf">
<embed src="sound.swf" width="400" height="40" >
</embed>
</object>

Friday, 2 August 2013

date validation in ajax calender extender

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript">
        function checkDate(sender, args) {
        
          var toDate= new Date();

            toDate.setMinutes(0);

            toDate.setSeconds(0);

            toDate.setHours(0);

            toDate.setMilliseconds(0);

            if (sender._selectedDate > toDate) {

                alert("You can't select day greater than today!");

                sender._selectedDate = toDate;

                //set the date back to the current date

                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager>
    <div>
    <asp:TextBox ID="tb" runat="server"></asp:TextBox>
        <asp:CalendarExtender ID="CalendarExtender1" runat="server"
            TargetControlID="tb" OnClientDateSelectionChanged="checkDate"
            DaysModeTitleFormat="dd-mmm-yyyy" Format="dd-MMM-yyyy">
        </asp:CalendarExtender>
    </div>
    </form>
</body>
</html>