Friday, 2 November 2012

Soap Interview Questions and Answers for Experienced

What is SOAP ?
It is communication protocol based on XML.


What is Full Form of SOAP?
Simple Object Access Protocol.


Why we use it?
It is used to communicate between two applications that is on different operating system and on different language.
SOAP is platform independent.
SOAP is Language Independent.
SOAP is simple and Extensive.


How to use SOAP?
SOAP is communication protocol, that use xml to communicate.
To use SOAP write your xml in some specific format and xml must contain some specific elements.


What are the elements use is SOAP message.?
It has 4 imp elements that are following..
  •  Envelope element: It contain information about this document and message.
  •  Header element: It contain information about  header.
  •  Body element: It contain Message
  •  Fault element: containing errors and status information

What are syntax for SOAP?
Following are the syntax for SOAP..
  •  Encoded using XML
  •  Use the SOAP Envelope namespace
  •  SOAP Encoding namespace
  • A SOAP message must NOT contain a DTD reference
  • A SOAP message must NOT contain XML Processing instructions


What is structure for SOAP?
    <soap:envelope soap:encodingstyle="http://www.w3.org/2001/12/soap-encoding" xmlns:soap="http://www.w3.org/2001/12/soap-envelope">
      <soap:header></soap:header>
      <soap:body>
        <soap:fault></soap:fault>
      </soap:body>
  </soap:envelope>


What is SOAP Envelope Element?
It is root element of a soap and it define about xml document. It have following attributes
encodingStyle : It may appear on any soap element.
<soap-env:envelope soap-env:encodingstyle="http://www.www.org/soap/encoding/" xmlns:soap-env="http://www.www.org/soap/envelope/">
<!-- SOAP body goes here -->
</soap-env:envelope>



What is SOAP Header Element?
SOAP Header: It contain application information (for example payment, authentication).It is optional. It have following attributes:
encodingStyle : It may appear on any soap element.
<soap:encodingStyle="http://php-tutorial-php.blogspot.in/2012/11/soap.html">
mustUnderstand: The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process. If you add mustUnderstand='1' to a child element of the Header element it indicates that the receiver processing the Header must recognize the element. If the receiver does not recognize the element it will fail when processing the Header.
<soap:mustUnderstand="0|1">
actor: It is used to address the header element to a specific endpoint.
<soap:actor="http://php-tutorial-php.blogspot.in/2012/11/soap.html"> 



What is SOAP Body Element?
SOAP Body: It contain the actual SOAP message intended for the ultimate endpoint of the message
<soap:body>
  <m:getblogresponse http:="http:" php-tutorial-php.blogspot.in="php-tutorial-php.blogspot.in" soap.html="soap.html" xmlns:m="">
    <m:blogname>php-tutorial-php.blogspot.com</m:blogname>
  </m:getblogresponse>
</soap:body>





What is SOAP Fault Element?
If a Fault element is present, it must appear as a child element of the Body element. A Fault element can only appear once in a SOAP message.  

Friday, 19 October 2012

Mysql-Group-Concat

Group_concat: its used to concatenate column values into a single string.


Create a table
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) DEFAULT NULL,
  `country` varchar(255) DEFAULT NULL,
  `company` varchar(150) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Following are examples

select group_concat(name) as all_user where country='india'
List all the name separated by comma (,) 
for example: arun,raj,suman,arun,ansh


select group_concat(name SEPARATOR '--') as all_user where country='india'
List all the name separated by double dash(--)
for example: arun--raj--suman--arun--ansh


select group_concat(name order by name asc) as all_user where country='india'
List all the name separated by comma (,) but order by name 
for example: arun,arun,raj,suman,ansh


select group_concat(distinct name) as all_user where country='india'
List all the name separated by comma (,) but with distinc name only
for example: arun,raj,suman,ansh