Web Services - Interview Questions

Dear readers, these Web Services Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of Web Services. As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer −
Web services are open standard (XML, SOAP, HTTP etc.) based Web applications that interact with other web applications for the purpose of exchanging data. Web Services can convert your existing applications into Web-applications.
Following are the features of Web service −
  • It is available over the Internet or private (intranet) networks.
  • It uses a standardized XML messaging system.
  • It is not tied to any one operating system or programming language.
  • It is self-describing via a common XML grammar.
  • It is discoverable via a simple find mechanism.
The basic web services platform is XML + HTTP. All the standard web services work using the following components −
  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)
A web service enables communication among various applications by using open standards such as HTML, XML, WSDL, and SOAP.
You can build a Java-based web service on Solaris that is accessible from your Visual Basic program that runs on Windows.
You can also use C# to build new web services on Windows that can be invoked from your web application that is based on JavaServer Pages (JSP) and runs on Linux.
A web services takes the help of XML to tag the data, format the data.
A web service takes the help of SOAP to transfer a message.
A web service takes the help of WSDL to describe the availability of service.

PHP - Predefined Variables

PHP provides a large number of predefined variables to any script which it runs.PHP provides an additional set of predefined arrays containing variables from the web server the environment, and user input. These new arrays are called superglobals:

All the following variables are automatically available in every scope.

PHP Superglobals

VariableDescription
$GLOBALSContains a reference to every variable which is currently available within the global scope of the script. The keys of this array are the names of the global variables.
$_SERVERThis is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these. See next section for a complete list of all the SERVER variables.
$_GETAn associative array of variables passed to the current script via the HTTP GET method.
$_POSTAn associative array of variables passed to the current script via the HTTP POST method.
$_FILESAn associative array of items uploaded to the current script via the HTTP POST method.
$_REQUESTAn associative array consisting of the contents of $_GET, $_POST, and $_COOKIE.
$_COOKIEAn associative array of variables passed to the current script via HTTP cookies.
$_SESSIONAn associative array containing session variables available to the current script.
$_PHP_SELFA string containing PHP script file name in which it is called.
$php_errormsg$php_errormsg is a variable containing the text of the last error message generated by PHP.

Server variables: $_SERVER

$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these.
VariableDescription
$_SERVER['PHP_SELF']The filename of the currently executing script, relative to the document root
$_SERVER['argv']Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string.
$_SERVER['argc']Contains the number of command line parameters passed to the script if run on the command line.
$_SERVER['GATEWAY_INTERFACE']What revision of the CGI specification the server is using; i.e. 'CGI/1.1'.
$_SERVER['SERVER_ADDR']The IP address of the server under which the current script is executing.
$_SERVER['SERVER_NAME']The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
$_SERVER['SERVER_SOFTWARE']Server identification string, given in the headers when responding to requests.
$_SERVER['SERVER_PROTOCOL']Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0';
$_SERVER['REQUEST_METHOD']Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.
$_SERVER['REQUEST_TIME']The timestamp of the start of the request. Available since PHP 5.1.0.
$_SERVER['QUERY_STRING']The query string, if any, via which the page was accessed.
$_SERVER['DOCUMENT_ROOT']The document root directory under which the current script is executing, as defined in the server's configuration file.
$_SERVER['HTTP_ACCEPT']Contents of the Accept: header from the current request, if there is one.
$_SERVER['HTTP_ACCEPT_CHARSET']Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'.
$_SERVER['HTTP_ACCEPT_ENCODING']Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'.
$_SERVER['HTTP_ACCEPT_LANGUAGE']Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'.
$_SERVER['HTTP_CONNECTION']Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'.
$_SERVER['HTTP_HOST']Contents of the Host: header from the current request, if there is one.
$_SERVER['HTTP_REFERER']The address of the page (if any) which referred the user agent to the current page.
$_SERVER['HTTP_USER_AGENT']This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586).
$_SERVER['HTTPS']Set to a non-empty value if the script was queried through the HTTPS protocol.
$_SERVER['REMOTE_ADDR']The IP address from which the user is viewing the current page.
$_SERVER['REMOTE_HOST']The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.
$_SERVER['REMOTE_PORT']The port being used on the user's machine to communicate with the web server.
$_SERVER['SCRIPT_FILENAME']The absolute pathname of the currently executing script.
$_SERVER['SERVER_ADMIN']The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file.
$_SERVER['SERVER_PORT']The port on the server machine being used by the web server for communication. For default setups, this will be '80'.
$_SERVER['SERVER_SIGNATURE']String containing the server version and virtual host name which are added to server-generated pages, if enabled.
$_SERVER['PATH_TRANSLATED']Filesystem based path to the current script.
$_SERVER['SCRIPT_NAME']Contains the current script's path. This is useful for pages which need to point to themselves.
$_SERVER['REQUEST_URI']The URI which was given in order to access this page; for instance, '/index.html'.
$_SERVER['PHP_AUTH_DIGEST']When running under Apache as module doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client.
$_SERVER['PHP_AUTH_USER']When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user.
$_SERVER['PHP_AUTH_PW']When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the password provided by the user.
$_SERVER['AUTH_TYPE']When running under Apache as module doing HTTP authenticated this variable is set to the authentication type.

Configuring Local PHP Interpreters

The term local PHP interpreter denotes a PHP engine installed on your computer opposite to remote PHP interpreters that can be installed on a remote host or in a virtual environment set up in a Vagrant instance, see Configuring Remote PHP Interpreters.

Configuring a local PHP interpreter in PhpStorm

Open the Settings dialog box by choosing File | Settings, then click PHP under Languages & Frameworks. The PHP page opens.
On the PHP page that opens, click the browseButton button next to the Interpreter drop-down list in the Development environment section.


  • In the Interpreters dialog box that opens, click the Add toolbar button add   in the left-hand pane, then choose Local on the context menu. If you already have a local interpreter configured in PhpStorm, it is also shown on the menu and the menu item changes to Other Local.
  • In the right-hand pane of the dialog box, specify the PHP interpreter's settings.
  • In the Name text box, type the identifier to distinguish the interpreter from others, for example, php_installation_.
  • Specify the PHP engine installation directory in the PHP Home field. Type the path manually or click the Browse button browseButton   and choose the location in the Choose PHP Home dialog box, that opens.
  • PhpStorm displays the version of the PHP engine detected in the specified folder and the debugger associated with this PHP engine in the php.ini file.
  • Optionally, customize the configuration settings of the installation in the Advanced area. In the Configuration options field, compose a string of configuration directives to be passed through the -d command line option and thus add new entries to the php.ini file. To do that, click the Browse button browseButton.png next to the Configuration options field, and then create a list of entries in the Configuration Directives dialog box, that opens.
  • To add a new entry, click the Add button add.png. In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value text boxes respectively.
  • You can add as many entries as you need, just keep in mind that they will be transformed into a command line with its length limited to 256 characters.
  • To delete an entry, select it in the list and click the Remove button delete.png.
  • To change the order of entries, use the Up arrowUp.png  and Down arrowDown.png buttons.

PHP Update Data of MySQL

After data insert , select and delete , data updation is also necessary for any web application.
Update syntax
update  table_name
set     column1= value1, column2=value2,coulmn_n=value_n
where   column_name=Value ;

and PHP Query would be as follow :
$query = "UPDATE table_name
          SET column1='value1',column2='value2'
          WHERE column_name=any_value";


database : dbtuts
table : users
here i use following details for this tutorial

CREATE DATABASE `dbtuts` ;
CREATE TABLE `dbtuts`.`users` (
`user_id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`first_name` VARCHAR( 25 ) NOT NULL ,
`last_name` VARCHAR( 25 ) NOT NULL ,
`user_city` VARCHAR( 45 ) NOT NULL
) ENGINE = InnoDB;

i hope you should know that how to select data from database , so i come to the point.
first of all select the data from database table and display it on page.
Suppose following is the data :

data.php


mysql_connect("localhost","root","");
mysql_select_db("dbtuts");
$sql_query="SELECT * FROM users";
$result_set=mysql_query($sql_query);
?>


   
   
First Name

   
Last Name

   
City

   
Edit

   
     if(mysql_num_rows($result_set)>0)
 {
  while($row=mysql_fetch_row($result_set))
  {
   ?>
           
           
           
           
           


           
              }
 }
 else
 {
  ?>
       
       
There's No data found !!!

       
         }
 ?>

PHP Calendar Class

This is a PHP calendar class, suitable for use in both PHP 3 and PHP 4.
It is very customisable and has the following features:
  • Month View
  • Year View
  • Specify start day of week
  • Specify start month of year for Year View
  • Highlight today's date
  • Forward and Backward navigation between months and years
  • Individual days within a month may be optionally linked to another page.
  • Appearance set by CSS style sheet.
Download Source File

Publish a unlimited free ads click here

PDT Update Sites

PDT Update Sites

For the latest information on how to install PDT, see Installing PDT.

Using Eclipse 3.4's Install Manager

To install these plugins, point your Install Manager at this site.

Using Eclipse 3.3's Update Manager

To install these plugins, point your Update Manager at this site. For more on how to do this,click here.

Modifying vs. replacing documents

Updates

Updates can be one of the most complicated operation available with MongoDB. They combine a query with an action, modifying documents that match the criteria. They are also extremely powerful, allowing you to change documents quickly and replace them altogether. They are done in-place (when possible) with little overhead.

Modifying vs. replacing documents

There are two types of updates you can use: modifying updates and replacing updates. Modifying updates contain $-operators and change fields in a document: they might increment counters, push new elements onto an array, or change the type of a field.
For example, a modifying update could add a new field to a document.
/** suppose documents look like:
 * {"username" : "...", "password" : "...", "email" : "..."}
 */
$coll->update(array("username" => "joe"), array('$set' => array("twitter" => "@joe4153")));/** now the document will look like:
 * {"username" : "joe", "password" : "...", "email" : "...", "twitter" : "@joe4153"}
 */
?>
Replacing updates replace the entire matching document with a new document. They are generally not as efficient as using $-modifiers, but can be very usefully for complex operations or updates that can't be expressed in terms of $-operators.
For example, a replacing update can completely change the structure of a document.
/** suppose documents look like:
 * {"username" : "...", "password" : "...", "email" : "..."}
 */
$coll->update(array("username" => "joe"), array("userId" => 12345"info" => array(
    
"name" => "joe""twitter" => "@joe4153""email" => "..."), "likes" => array()));/** now the document will look like:
 * {
 *     "userId" : 12345,
 *     "info" : {
 *         "name" : "joe",
 *         "twitter" : "@joe4153",
 *         "email" : "..."
 *     },
 *     "likes" : []
 * }
 */
?>