Wednesday, July 23, 2014

Create and Consume RESTFul Service in .NET Framework 4.0

Create your first RESTful service with WCF 3.5

consume rest web service in c#

 WebRequest req = WebRequest.Create("url");
            string postData = "sessionName=TechJamSessionAtCurologic&fromDate=1-7-2014&toDate=1-7-2014&sessionScheduleId=6";

            byte[] send = Encoding.Default.GetBytes(postData);
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            req.ContentLength = send.Length;

            Stream sout = req.GetRequestStream();
            sout.Write(send, 0, send.Length);
            sout.Flush();
            sout.Close();

            WebResponse res = req.GetResponse();
            StreamReader sr = new StreamReader(res.GetResponseStream());
            string returnvalue = sr.ReadToEnd();

URL Example - http://hostname/Methodname

Alert the hostname of the current URL using javascript

<script>
function myFunction() {
    alert(location.hostname);
}
</script>

Monday, July 21, 2014

workflow manager tools need to be installed to build - project visual studio 2013 and sharepoint 2013

1) Download the installer from the web and execute it.In the search results, click the “Add” button for the Workflow Manager 1.0 row. Then, click the “Install” button

image

2) In order to start the installation process, just click the “I accept” button in the wizard.

image

3) Then check if issue solved else restart computer and then check

Tuesday, July 15, 2014

how to get json key and value in javascript?

var obj = $.parseJSON('{"name": "", "skills": "", "jobtitel": "Entwickler", "res_linkedin": "GwebSearch"}');
alert(obj['jobtitel']);

//By using javasript json parser
var t = JSON.parse('{"name": "", "skills": "", "jobtitel": "Entwickler", "res_linkedin": "GwebSearch"}');
alert(t['jobtitel'])

loop and get key/value pair for JSON array using jQuery

var result = '{"FirstName":"John","LastName":"Doe","Email":"johndoe@johndoe.com","Phone":"123 dead drive"}';

$.each($.parseJSON(result), function(k, v) {
    alert(k + ' is ' + v);
});