Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Friday 14 November 2014

Current time zone for a city- Free API

Current time zone for a city- Free API

Get TimeZone & Local time from Latitude/Longitude



$localtime = 0;
$latitude = '40.71417';
$longitude = '-74.00639';
try {
    $client = new Zend_Http_Client('http://www.earthtools.org/timezone-1.1/' . $latitude . '/' . $longitude);
    $response = $client->request('GET');
    $xmlData = $response->getBody();
    if (!empty($xmlData)) {
        $xmlData = simplexml_load_string($xmlData);  
        print_r($xmlData);
    }

} catch (Exception $e) {
    echo 'Error' . $e->getMessage();
}

Output:

SimpleXMLElement Object
(
    [version] => 1.0
    [location] => SimpleXMLElement Object
        (
            [latitude] => 40.71417
            [longitude] => -74.00639
        )
    [offset] => -5
    [suffix] => R
    [localtime] => 13 Nov 2014 01:42:07
    [isotime] => 2014-11-13 01:42:07 -0500
    [utctime] => 2014-11-13 06:42:07
    [dst] => Unknown
)


Get Latitude/Longitude from address


http://maps.googleapis.com/maps/api/geocode/json?address=chandigarh&sensor=false

Output:
http://maps.googleapis.com/maps/api/geocode/json?address=chandigarh&sensor=false



Monday 27 October 2014

Zend Gdata Youtube API - Search Video - View Video Detail

Zend Gdata Youtube API - Search Video - View Video Detail

Youtube API is very useful to show the youtube videos in your website. You don't required any account for search the video. You can filter the video by query string, category, limit no of records & you can see even video detail.
You can also upload OR do changes in uploaded videos but for this you need youtube account.On the behalf of my experience I am presenting some easy example which let you understand the youtube API. These example are testing with zend framework 1.12. Please let me your thoughts on this...



Search Videos by Category
$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->category = 'Comedy/dog';
//$query->setCategory('Comedy/dog'); OR 
$videos = $yt->getVideoFeed($query);
$this->printVideoFeed($videos);


Search Videos by query string
$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->videoQuery = 'dogs';
$videos = $yt->getVideoFeed($query);
$this->printVideoFeed($videos);


List Top Rated Videos
$yt = new Zend_Gdata_YouTube();
$videos = $yt->getTopRatedVideoFeed();
$this->printVideoFeed($videos);


List Today's Top Rated Videos
$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->setTime('today');
$videos = $yt->getVideoFeed($query);
$this->printVideoFeed($videos);


List videos by viewCount & Add limit
$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->orderBy = 'viewCount';
$query->startIndex = 10;
$query->maxResults = 20;
$videos = $yt->getVideoFeed($query);
$this->printVideoFeed($videos);



Example In Zend Framework 
class IndexController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */
    }

    public function indexAction() {

        // action body
    }

    function printVideoFeed($videoFeed) {
        foreach ($videoFeed as $videoEntry) {
            $this->printVideoEntry($videoEntry);
        }
    }

    function printVideoEntry($videoEntry) {
        echo '\n Video: ' . $videoEntry->getVideoTitle();
        echo '\n Video ID: ' . $videoEntry->getVideoId();
        echo '\n Updated: ' . $videoEntry->getUpdated();
        echo '\n Description: ' . $videoEntry->getVideoDescription();
        echo '\n Category: ' . $videoEntry->getVideoCategory();
        echo '\n Tags: ' . implode(", ", $videoEntry->getVideoTags());
        echo '\n Watch page: ' . $videoEntry->getVideoWatchPageUrl();
        echo '\n Flash Player Url: ' . $videoEntry->getFlashPlayerUrl();
        echo '\n Duration: ' . $videoEntry->getVideoDuration();
        echo '\n View count: ' . $videoEntry->getVideoViewCount();
        echo '\n Rating: ' . $videoEntry->getVideoRatingInfo();
        echo '\n Geo Location: ' . $videoEntry->getVideoGeoLocation();
        echo '\n Recorded on: ' . $videoEntry->getVideoRecorded();

        foreach ($videoEntry->mediaGroup->content as $content) {
            if ($content->type === "video/3gpp") {
                echo '
 Mobile RTSP link: ' . $content->url;
            }            
        }
        echo "\n\n";
    }

    function youtubeAction() {
        $yt = new Zend_Gdata_YouTube();
        $query = $yt->newVideoQuery();
        $query->category = 'Comedy/dog';
        //$query->setCategory('Comedy/dog'); OR 
        $videos = $yt->getVideoFeed($query);
        $this->printVideoFeed($videos);
        die("");
    }

}

Execute:/index/youtube


Output:
Video: My 200th Video
Video ID: h23oPnh1WJM
Updated: 2014-10-27T00:30:41.000Z
Description: Please subscribe to my channel and my vlog channel! I make new videos here every Wednesday and make vlogs during my majestical daily life. JennaMarbles Jenna...
Category: Comedy
Tags:
Watch page: https://www.youtube.com/watch?v=h23oPnh1WJM&feature=youtube_gdata_player
Flash Player Url: https://www.youtube.com/v/h23oPnh1WJM?version=3&f=videos&app=youtube_gdata
Duration: 263
View count: 3640139
Rating: Array
Geo Location:
Recorded on:
Mobile RTSP link: rtsp://r6---sn-p5qlsu76.c.youtube.com/CiILENy73wIaGQmTWHV4PuhthxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
Mobile RTSP link: rtsp://r6---sn-p5qlsu76.c.youtube.com/CiILENy73wIaGQmTWHV4PuhthxMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp



Saturday 25 October 2014

How do I get a YouTube video thumbnail from the YouTube

How do I get a YouTube video thumbnail from the YouTube




How to get youtube video thumbnail
1. First Get the Video URL (Video URL is like https://www.youtube.com/v/J0Qu6eyyr4c)
2. Get the youtube video Id from Video URL (Video id is like J0Qu6eyyr4c)
3. Now video thumbnail is ready.


Small Video Image
How do I get a YouTube video thumbnail from the YouTube
http://img.youtube.com/vi/J0Qu6eyyr4c/default.jpg 



Bigger Video Thumbnail
How do I get a YouTube video thumbnail from the YouTube
http://img.youtube.com/vi/J0Qu6eyyr4c/mqdefault.jpg



Large Video Thumbnail
How do I get a YouTube video thumbnail from the YouTube
http://img.youtube.com/vi/J0Qu6eyyr4c/hqdefault.jpg



Thursday 21 August 2014

XML Interview Questions And Answers

XML Interview Questions And Answers

What is full Form XML?
Extensible Markup Language.


What is XML?
It is text-based standard design for interchange the information between two application. There are no predefined tags and attributes in XML. you can create your own tags and attributes in tag.


Who created the XML?
Jon Bosak


Why It is so popular?
  • It is free standard for exchange information.
  • It is independent of language.
  • It is independent of Hosting Server 
  • Human Readable.
  • You can create your Own tags in XML. 
  • Used for embed images, video etc

Where XML is used?
It is used to exchange the information between two application. Information can also be exchanged between two different application which is running on different OR same server. It is used in Web Application, Mobile Application (IOS, Android, Iphone, window Phone) for providing the API. It is also used AS installer in web application, you can set the application configuration in XML file.


Why it is used?
  • It is Opensource.
  • It is easy to understand.
  • you can create your own tags. 
  • Independent of languages and OS.
  • You can embed photo, videos in XML.

What is file extension of XML?
.xml


How the raw XML file can be viewed in a browser?
Raw XML files can be viewed in Mozilla, Firefox, Opera, Internet Explorer and in Netscape. For make XML documents to display like nice web pages, you will have to add some display information.


How to parse XML in PHP?
http://www.web-technology-experts-notes.in/2013/05/parse-xml-in-php-by-example.html


What is a CDATA section in XML?
The CDATA is used when you don't want some text data be parsed by the XML parser.
<![CDATA[ HERE IS NON-PARSED DATA]]>
Now, above data will not parse.


What is XQuery?
Xquery is a query language that is used to retrieve data from XML documents. You can add, update, delete and list the XML with use of XQuery.


What i XMLA ?
It is protocol of Microsoft  for XML-messaging used for exchanging data between client and servers.


What is XSL?
XSL is a language used for expressing style sheets. An XSL style sheet is a file that describes the way to display an XML document.


What is the difference between XML and HTML?
HTML XML
Used for displaying information. Used for data representation.
HTML is used to mark up text so it can be displayed to users. XML is used to mark up data so it can be processed by computers.
HTML describes both structure (e.g. <p>, <h2>, <em>) and appearance (e.g. <br>, <font>, <i>) XML describes only content
HTML uses a fixed, unchangeable tags There is no predefined tags, you can create your own.



What are the benefits of XML?
Simplicity
Openness
Extensibility
Self-description
Contains machine-readable context information- Tags, attributes and element structure provide context information. Can embed multiple data types - XML documents can contain any possible data type - from multimedia data (image, sound, video) to active components (Java applets, ActiveX).



What is a well-formed XML document?
If a document is syntactically correct it can be called as well-formed XML documents.
Every open tag must be closed.
The open tag must exactly match the closing tag: XML is case-sensitive.
All elements must be embedded within a single root element.
Child tags must be closed before parent tags.
A well-formed document has correct XML tag syntax, but the elements might be invalid for the specified document type.



How to add CSS in XML File?
<!--xml-stylesheet type="text/css" href="/css/mystyle.css"?-->



How to add CSS in XML File?
<script>
<![CDATA[
function()
{
    any code........
}
]]>
</script>

Thursday 7 August 2014

Goole Map - Track your moving Position on google map- html5

Goole Map - Track your moving Position on google map- html5

This will enable to you get the current position of your location in mobile. First it will tell your current position on the Google map in form of Pushpin. When you start changing your position then pushpin will start moving. It will be follow you. But GPS and internet must be support by your mobile and off-course it should be enabled in your mobile. It will also work in 2G/3G/4G. It will give your more accurate when you are in City area.

How its work:
It will check your current position with use of browser html5 property. Thats why it ask "Are you want to share your current location".To see your position you must give the access of your current position to the browser. After getting your position it simply plot on google map. When you change your position it recheck the position with use of GPS and update the pushpin on google map.


Initializing...

<style>
    body {font-family: Helvetica;font-size:13pt;padding:0px;margin:0px}
    #map_canvas{display:none; height:100%; width:100%; position:relative;z-index:1;}
    #current {padding:5px; background-color:#000; position:unset; left:0px;z-index:2;text-align:center;width:90%;opacity:0.4;color:#FFF;border-radius:0px 0px 5px 5px; font-weight:bold;}
    #btnCont{position:absolute; bottom:0px; left:0px; width:100%; text-align:center;z-index:2;}</style>


<div id="current">
Initializing...</div>
<div id="map_canvas" style="height: 300px; width: 800px;">
</div>
<div id="btnCont" style="display: none;">
<button onclick="startAgain();"> Restart Tracking</button>
    <button onclick="stopTracking();"> Stop Tracking</button>
</div>
<script charset="utf-8" src="//mapduck.com/js/geoPosition.js" type="text/javascript"></script>
<script src="//maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>


<script>
    var gmap = null;
    var markers = [];
    var opts = {
        enableHighAccuracy: true,
        timeout: 60000,
        maximumAge: 0
    };
            
    function initialiseMap(){
        var myOptions = {
            minZoom : 3,
            zoom: 10,
            mapTypeControl: true,
            mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
            navigationControl: true,
            navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
            mapTypeId: google.maps.MapTypeId.ROADMAP      
        } 
        gmap = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    }
      
    function initialise(){
        if(geoPosition.init())
        {
            document.getElementById('current').innerHTML="Receiving...";
            geoPosition.getCurrentPosition(showPosition,handle_errors,opts);
        }
        else
        {
            document.getElementById('current').innerHTML="Functionality not available";
        }
    }
            
    function handle_errors(error){
        var error_str='';
        switch(error.code)
        {
            case error.PERMISSION_DENIED: 
                error_str="User(you) did not share your geolocation";
                break;
 
            case error.POSITION_UNAVAILABLE: 
                error_str="Could not detect current position";
                break;
 
            case error.TIMEOUT: 
                error_str="retrieving position timed out";
                break;
 
            default: 
                error_str="unknown error";
                break;
        }
        document.getElementById('current').innerHTML=error_str;
    }
   
    function showPosition(p){
        if(gmap == null){
            document.getElementById('map_canvas').style.display = 'block';
            initialiseMap();
        }
        var latitude = parseFloat( p.coords.latitude );
        var longitude = parseFloat( p.coords.longitude );
        document.getElementById('current').innerHTML="Lat = " + latitude.toFixed(2) +" and Long = " + longitude.toFixed(2);
        var location = new google.maps.LatLng( latitude , longitude);
        gmap.setCenter(location);

        var marker = new google.maps.Marker({
            position: location,
            map: gmap,
            title:"You are here"
        });
        markers.push(marker);
    
        var infowindow = new google.maps.InfoWindow({
            content: "<strong>This is your current location.</strong>"
        });
    
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(gmap,marker);
        });
        document.getElementById('btnCont').style.display = 'block';
    }
   
    function setAllMap(map) {
        for (var i = 0; i &lt; markers.length; i++) {
            markers[i].setMap(map);
        }
    }
    
    function deleteMarkers() {
        setAllMap(null);
        markers = [];
    }
            
    var watchID = navigator.geolocation.watchPosition(trace,handle_errors,opts);
   
    function trace(position){
        geoPosition.getCurrentPosition(position);
        deleteMarkers();
        showPosition(position);
    }
   
    function startAgain(){
        navigator.geolocation.clearWatch(watchID);
        watchID = navigator.geolocation.watchPosition(trace,handle_errors,opts);
    }   
   
    function stopTracking(){
        navigator.geolocation.clearWatch(watchID);
    }
    google.maps.event.addDomListener(window, 'load', initialise);

</script>


Tuesday 20 May 2014

Difference between WebService and API

Difference between WebService and API


S.No
Web Service
API
1
Interaction between two machines over a network. Interaction between two API.
2
Uses SOAP, REST, and XML-RPC as a means of communication. It may use any way to communication
3
Web Services involves calling of system. We can render form in one line, one by one element, element OR  decorator OR error separately.
4
Web service might not contain a complete set of specifications and sometimes might not be able to perform all the tasks that may be possible from a complete API. An API consists of a complete set of rules and specifications for a software program to follow in order to facilitate interaction.
5
All Web services are APIs All APIs are not Web services
6
A Web service always needs a network for its operation API doesn't need a network for its operation
7
WebServices are services available over internet. You can call these services and get so information in your application without know how it works. For example weather webservices gives you information about the city weather. API is a collection of class which provide you some functionality like Google api gives google-search.



Friday 16 May 2014

Zend Framework - Free Google Analytics API

Zend Framework - Free Google Analytics API

After making a successful website, we add an  google analytics code to track the activities on our website. It gives all tracking information from all geo regions on all the pages.
It help us to know daily, monthly, yearly visiter in different countries and list of pages which searched most.

But creating a report on the behalf of analytics data, is difficult stuff because it take a lot of lot of time.

Following are simplest way to get the google analytics data.
        $email = 'ADSENSE_GMAIL_USERNAME';
        $password = 'ADSENSE_GMAIL_PASSWORD';
        /** Get Connection with Analytics Account * */
        $client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Analytics::AUTH_SERVICE_NAME);
        $service = new Zend_Gdata_Analytics($client);
        /** Get Connection with Analytics Account * */
        
        
        /** Get Analytics Account Information * */        
        $profileResults = $service->getDataFeed($service->newAccountQuery()->profiles())->current()->getExtensionElements();
        foreach($profileResults as $profileResult){
            $attributes = $profileResult->getExtensionAttributes();
            $name = $attributes['name']['value'];
            $value = $attributes['value']['value'];
            if($name=='ga:profileId'){
                $profileId = $value;
            }
            echo "$name : $value\n";
        }       
        /** Get Analytics Account Information * */
        
        
        /** Get Analytics Data */         
        $dimensions = array(
            Zend_Gdata_Analytics_DataQuery::DIMENSION_MEDIUM,
            Zend_Gdata_Analytics_DataQuery::DIMENSION_SOURCE,
            Zend_Gdata_Analytics_DataQuery::DIMENSION_BROWSER_VERSION,
            Zend_Gdata_Analytics_DataQuery::DIMENSION_MONTH,
        );

        $query = $service->newDataQuery()->setProfileId($profileId)
                ->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_BOUNCES)
                ->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS)
                ->addFilter("ga:browser==Firefox")
                ->setStartDate('2013-05-01')
                ->setEndDate('2014-05-31')
                ->addSort(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS, true)
                ->addSort(Zend_Gdata_Analytics_DataQuery::METRIC_BOUNCES, false)
                ->setMaxResults(1000);
        echo "\nVisits : Bounce \n\n";
        foreach ($dimensions as $dim) {
            $query->addDimension($dim);
        }
        try{
                   $result = $service->getDataFeed($query); 
        }catch(Exception $e){
            echo $e->getMessage();die;
            
        }

        foreach ($result as $row) {
            echo $row->getMetric('ga:visits') . "\t";
            echo $row->getValue('ga:bounces') . "\n";
        }
        /** Get Analytics Data */


As an above example, you can extract all information from the Google Analytics API and stored in array or Object then can download into csv OR Excel format.




Wednesday 23 April 2014

Google Dynamic Charts - Bar Pie and Line Chart - code snippets

One image express thousand words, that's why we use images in our daily life, Personal & professional.
Reading full report is a difficult task and need hours to understand, but we get the chart of that report Its easy and need only few minutes to understand. That's why we use chart in our professional life.

Chart can have different types and each have its own quality. For Example
Pie Chart: It display percentage values as a slice of a pie.
Bar Chart: It display with rectangular bars with lengths proportional to the values that they represent. The bars can be plotted vertically OR horizontally.
line chart is a two-dimensional scatterplot of ordered observations where the observations are connected.


Google Create different types of chart on the fly. No installtion and no code download is required. Just pass all parameter and your desired chart is ready.

Its very quick. see below few examples. you will understand how Google make easy. 
Pie chart
Pie chart Example
<img alt="Pie chart Example" src="https://chart.googleapis.com/chart?chs=250x100&amp;chd=t:30,20,50&amp;cht=p3&amp;chl=Arun|Kuldeep|Ajit" title="Pie chart Example" />



Bar Chart

Bar chart Example
<img alt="Bar chart Example" src="https://chart.googleapis.com/chart?chs=320x200&amp;cht=bvs&amp;chd=t:_,30,-30,50,80,200&amp;chxt=y" title="Bar chart Example" />


Line Chart

Line chart Example
<img alt="Line chart Example" src="https://chart.googleapis.com/chart?chf=bg,s,FFFFFF00&amp;chxl=1:|16%2F04%2F2014|18%2F04%2F2014|20%2F04%2F2014|

21%2F04%2F2014|23%2F04%2F2014&amp;chxp=0,15,30|1,0,25,50,75,100&amp;chxr=0,0,30&amp;chxs=0,676767,11.5,0,t,676767|

1,6AA9E6,12,0,l,676767&amp;chxt=y,x&amp;chs=416x180&amp;cht=lc&amp;chco=6AA9E6&amp;chd=s:MWYYOOAKYKSWECEWCEEIQ1aESKIUMEEIOICECCCEEEMUYMMGQYQYKKOlWWIGECCCKGGGMMIfKGMKGGEOIGACAAtAGEEIQKMOMI

IQQIISGEECIACGAGUEUUUUcjMfOhKQYWIICGCIIGGIWjrKcjMMKCIMKCECCGIAGGUOSQrA&amp;chls=3&amp;chm=B,6AA9E664,0,0,0|h,E7E7E7,0,0.5,1,-1|h,AAAAAA,0,0,1,1|h,AAAAAA,0,1,1,1|

V,E7E7E7,0,0,1,-1|V,E7E7E7,0,42,1,-1|V,E7E7E7,0,84,1,-1|V,E7E7E7,0,126,1,-1|V,E7E7E7,0,168,1,-1
" title="Line chart Example" />





Tuesday 8 April 2014

Facebook User Profile Get Custom Picture of Facebook User

Facebook User Profile Get Custom Picture of Facebook User


Today, Every one use the Facebook for social networking whether he is Student, Working Women, House wives, IT Professional or Business man etc. Everyone open Facebook account at-least once a day.

Due to huge use of Facebook profiles.  All Web application start integrate the Facebook plugins in their websites.
They Start using plugins like Registration, Like plugin, Comment box, Login/Logout functionalists and Chat implement.

Many times, we need to show the Profile pictures of Facebook users in web page. Sometimes you have to show the custom size of profile picture. If there is requirement of showing the custom images of profile user then you are very right place. Here we are giving you lot of example of custom size.

You can show the profile pictures in unlimited sizes. Just fill the height width parameter in URL and your profile picutre is ready. to show the Profile picture you need 1 parameter only and that is UID. UID is user id and facebook users and its unique.



If we have facebook profile Id, then we can get different facebook profile images with the following URLs.
http://graph.facebook.com/[UID]/picture?type=square
https://graph.facebook.com/[UID]/picture?width=[WIDTH]&height=[HEIGHT]
Here [UID] is Facebook Profile Id and [WIDTH]/[HEIGHT] is width/height



Very Small Profile Image(50 X 50)
Very Small Profile Image(50 X 50)
https://graph.facebook.com/1438566719/picture?width=50&height=50
Profile Thumbnail Profile Thumbnail
http://graph.facebook.com/1438566719/picture?type=square
Large Profile Image (300 X 300)
Large Profile Image (300 X 300)
https://graph.facebook.com/1438566719/picture?width=300&height=300



5 Best Related Posts are Following:1. Facebook comments box for website
2. Facebook login with javascript SDK example
3. Facebook User Profile Get Custom Picture of Facebook User
4. Facebook Login with JavaScript
5. Firebase Chat with Facebook and Twitter Integration

Thursday 3 April 2014

Facebook Login with JavaScript

Follow Simple Steps to Integrate "Facebook Login" with JavasScript in your Web Application.

  • Login in https://www.facebook.com/
  • "Create a New App" in https://developers.facebook.com/
  • Fill all required Information
  • Settings => App PlateForm=>Click on "Website" then add detail
  • In "Status & Review", Click on "Yes" to activate for public


Get the "App Id" and use in Following Example
<html>
    <head>
        <title>Facebook Login Integration with JavaScript</title>
        <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    </head>
    <body>

        <div id="fb-root">
</div>
<script>
            window.fbAsyncInit = function() {
                FB.init({
                    appId      : 'XXXXXXXX',//your appid
                    status     : true, 
                    cookie     : true,
                    xfbml      : true,
                    oauth      : true                    
                });
                FB.Event.subscribe('auth.authResponseChange', function(response) {                    
                    // Here we specify what we do with the response anytime this event occurs. 
                    if (response.status === 'connected') {
                        saveuserdetail();
                    } else if (response.status === 'not_authorized') {
                        // In this case, the person is logged into Facebook, but not into the app, so we call                        
                        FB.login();
                    } else {
                        // In this case, the person is not logged into Facebook, so we call the login()                         
                        FB.login();
                    }
                })  
  
            };
        
            function saveuserdetail() {
                //console.log('Welcome!  Fetching your information.... ');
                FB.api('/me', function(response) {                    
                    console.log(response.toSource());
                    $.ajax({                        
                        type: "POST",
                        url: '/url_to_save_detail',
                        data: response,
                        success: function(msg){
                        console.log(msg);    
                        },
                        dataType: 'json'
                    });
                });
            }
            (function(d){
                var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
                js = d.createElement('script'); js.id = id; js.async = true;
                js.src = "//connect.facebook.net/en_US/all.js";
                d.getElementsByTagName('head')[0].appendChild(js);
            }(document));
        </script>
        <div class="fb-login-button">
Login with Facebook</div>
</body>
</html>



Facebook Login URL:
https://www.facebook.com/dialog/oauth?redirect_uri=websiteLoginURL&display=popup&response_type=code&client_id=appId&ret=login
websiteLoginURL: After login which page of your website should redirect.
appId: Application Id of facebook.com



Sunday 22 September 2013

Soap Interview Questions and Answers

Question:  Explain the SOAP?
Answer: SOAP stands for Simple Object Access Protocol. SOAP is an XML-based protocol for exchanging information between two computers over the internet. It enables you to Remote Procedure Calls (RPC) transported via HTTP.
Following are the SOAP characteristics. 
SOAP is for communication between applications
SOAP is a format for sending messages
SOAP is designed to communicate via Internet
SOAP is platform independent
SOAP is language independent
SOAP is simple and extensible


Question: Where is SOAP used?
Answer: It is used to exchanges the information between two computers over the internet. For this we used the XML in special format to send and receive the Information.


Question: Difference between XML and SOAP?
Answer: XML is language whereas SOAP is protocol. 


Question: Difference between JSON and SOAP?
Answer: JSON is standard to represent human-readable data.  SOAP is a protocol specification for transmitting information and calling web services use XML.


Question: What are the rules for using SOAP?
Answer: http://www.web-technology-experts-notes.in/2012/11/soap.html



Question: What is SOAP Envelope Element?
Answerhttp://www.web-technology-experts-notes.in/2012/11/soap.html



Question: What does SOAP Namespace defines?
Answer: The namespace defines the Envelope as a SOAP Envelope. If a different namespace is used, the application generates an error and discards the message.



Question: What is the SOAP encodings?
Answer: The envelope specified the encoding for the body.  This is a method for structuring the request that is suggested within the SOAP specification, known as the SOAP serialization. It's worth noting that one of the biggest technical complaints against SOAP is that it mixes a specification for message transport with a specification for message structure.  



Question: What does SOAP encodingStyle Attribute defines?
Answer: The encodingStyle attribute is used to define the data types used in the document(s). This attribute may appear on any SOAP element, and applies to the element's contents and all child element(s).


Question: What are the Different Transport Protocols?
Answer:  SOAP, REST,  SMTP, raw TCP Socket.



Question: What is UML?
Answer: Unified Modeling Language



Question: can we send soap messages with attachments.
Answer: Yes, We can send photos/Audio/video with soap messages as an attahcment. SOAP messages can be attached with MIME extensions that come in multipart/related. It is used to send messages using the binary data with defined rules. The SOAP message is carried in the body part with the structure that is followed by the message of the SOAP.



Question: What is the difference between SOAP and other remote access techniques?
Answer: SOAP is simple to use and it is non-symetrical whereas DCOM or CORBA is highly popular and usually have complexity in them. It also has the symmetrical nature in it. 



Question: What are the problems faced by users by using SOAP?

Answer:  There is a problem to use this protocol as firewall is a security mechanism that comes in between. This ock all the ports leaving few like HTTP port 80 and the HTTP port is used by SOAP that bypasses the firewall. It is a serious concern as it can pose difficulties for the users. There are ways like SOAP traffic can be filtered from the firewalls.