Web Services, Remoting Interview Questions and Answers (102) - Page 3

What are the differences between HTML and XML?

• HTML uses predefined element names, such as &ltp, &ltbr, &gt, <p> and <br>. In XML, you create your own element names to identify hierarchical nodes of data.

• XML syntax is much stricter than HTML: such as elements must always have end-tags, element names are case sensitive, attribute values must always be enclosed in quotation marks, and nested elements must be terminated within their parent elements.

• XML identifies data conceptually based on the data content, rather than based on the type of formatting to apply but in HTML it identifies the data based on the formatting.
What are the types of XML parsers?

There are two types of XML parsers. Those are

Nonvalidating Parsers - Parsers which doesn't support validation.

Validating Parsers - Parsers that supports validation.
What is a valid XML document?

XML documents are compared to certain conditions that are specified in a Document Type Definition or schema. A well-formed XML document satisfies all of the requirements of one or more specifications are called a valid XML Document.
Who determines the validity of an XML document?

The XML Schema or a Document Type Definition (DTD) determines the validity of an XML document.
What is Web service protocol stack?

The Web service protocol stack is a set of protocols used to define, discover, and implement Web services. The protocol stack consists of four layers:

Service Transport: This layer is responsible for transferring messages between different applications. It includes HTTP, SMTP, FTP, and newer protocols such as Blocks Extensible Exchange Protocol (BEEP).

XML Messaging: This layer is responsible for encoding messages in a common XML format so that messages can be understand at either end. It includes XML-RPC and SOAP.

Service Description: This layer is responsible for describing the public interface to a specific Web service. This service description is handled via the WSDL.

Service Discovery: This layer is responsible for centralizing services into a common registry, and providing easy functionality. This service discovery is handled via the UDDI.
What is XML-RPC?

XML-RPC is a protocol which uses XML messages to perform Remote Procedure Calls. The requests are encoded in XML format and sent via HTTP POST. The responsible of XML are embedded in the body of the HTTP response.

The XML-RPC is the combination of HTTP + XML + Remote Procedure Calls. It is a platform independent, diverse applications can communicate with one another. For example, a Java client can speak XML-RPC to a Sql server.
What does XML used for ?

NOTE: This is objective type question, Please click question title for correct answer.
Advantage of using a Remote WebService ?

When there is a need of using a webservice and only when the same set of data needs to be accessed by multiple people, or when a user needs to be able to access the same set of data from multiple computers. This Remote Web Service is very much useful.
What is SOAP Protocol?

SOAP is simple object access protocol which acts as a communication protocol to communicated between applications in formatting the messages to be sent across the systems. SOAP is simple and easy to use as well.
What components will be published when deploy a webservice application?

1) Web application directory
2) web.config file
3) .asmx files
4) .disco files
5) Bin folder( containing dlls)
6) Keep alive ( for load balancing)
What is the difference between well formed and valid XML documents?

Well formed documents

They check that there is a root tag, start tag has an end tag, proper casing is there
for the elements. There is no check on the datatypes of the elements, the order in
which they occur or no primary keys or any other constraints.

Valid documents

They are well formed documents. IN addition they also check the datatypes, the order
in which the elements coour occur as well as the primary keys. They follow the rules of a logical
structure (example: a DTD, XSD, XDR)
Which class is inherited by remote objects?

MarshalByRefObject class defined by the System namespace is inherited by remote objects. It is the abstract base class for objects that communicate across application domain boundaries by exchanging messages using a proxy.
What are channels in remoting?

They are the classes whose objects are used to allow applications running in one application domain/process/computer to send data to another application running in another one application domain/process/computer using suitable protocol like Tcp/Http.

example:TcpChannel/HttpChannel

example: TcpChannel can be used to exchange data between an exe of a Console
Application and an exe file of the Windows application.
Differences between DTD and XSD.

DTD : Document Type Definition
XSD : Xml Schema Definition:

Both are a set of rules which define the logical structure(schema) of an Xml Document. example: what is the root element, child element, data types of the elements, attributes,primary key,order of the elements are defined using DTD or XSD.

Differences are:-

1)DTD has its own set of keywords for defining a schema

example:
!DOCTYPE for root tag
!ELEMENT for an element
!ATTLIST for an attribute
!ENTITY for defining variables.

XSD uses its own set of namespaces and elements for defining the schema.

2. XSD enables you to create your own data types,DTD does not enable you to define your own customized data types,

3. XSD also allows you to specifies restriction on data .
example: <price></price> tag. we can write only digits here.

In DTD, no such restrictions.

4:Data Types in XSD
1. primitive / fundamental data types:-
string,decimal,float,boolean
2. Custom Data types
i. complex type :- a data type that contains child elements or attributes and
also the mixed contents
ii. simple type :- a data type that contains only values.

DTD has #PCDATA as the data type for the elements.(it is used for string datatype)

5)USES
XSD is used in large XML Data ex: ADO.NET DataSets, Web Services.
DTD is more suitable for small XML Data ex:bookname,companyname etc.
What is CDATA section in an xml document?

CDATA -
Unparsed Character Data
The term CDATA is used about text data that should not be parsed by the XML parser.
example:
Characters like "<" and "&" are illegal in XML elements.

"<" will generate an error because the parser interprets it as the start of a new element.
"&" will generate an error because the parser interprets it as the start of an character entity.

To avoid errors script code can be defined as CDATA.
Everything inside a CDATA section is ignored by the parser.

A CDATA section starts with "<![CDATA[" and ends with "]]>":
EXAMPLE:
<?xml version="1.0"?>
<catalog>
<book>
<bookname>ASP.NET</bookname>
</book>
<script>
<![CDATA[
function demo()
{
alert("hello");
}
]]>
</script>
</catalog>
Difference between an Element and Node in XML .

Element:
It is the main tag that can contain the data.
Node:
It is like a super type of an element

example:
<?xml version="1.0"?>
<catalog>
<book bookid="b001">
<bookname>ASP.NET</bookname>
</book>
</catalog>

In this example:

Elements:
<catalog></catalog>
<book></book>
<bookname>ASP.NET</bookname>

Nodes:
all are nodes
<?xml version="1.0"?>
<catalog>: elements are also nodes.
<book bookid="b001">
<bookname>ASP.NET</bookname>
</book>
</catalog>

1)Processing Instruction:
<?xml version="1.0"?>
It is a node

2)all elements are nodes:

3) The attribute bookid is also a node.

4)data in the element (i.e. ASP.NET is also a Node)
XML DOM Node Types

NodeType Named Constant
1 ELEMENT_NODE
2 ATTRIBUTE_NODE
3 TEXT_NODE
4 CDATA_SECTION_NODE
5 ENTITY_REFERENCE_NODE
6 ENTITY_NODE
7 PROCESSING_INSTRUCTION_NODE
8 COMMENT_NODE
9 DOCUMENT_NODE
10 DOCUMENT_TYPE_NODE
11 DOCUMENT_FRAGMENT_NODE
12 NOTATION_NODE

//Refer to http://www.w3schools.com
Which of these claases are used for type conversion betwen XSD Types and CLR Types?

NOTE: This is objective type question, Please click question title for correct answer.
What is XML serialization?

The XML serialization is suitable for serializing from .NET types to XML files and is used implicitly by ASMX web services. This comes under "System.Xml.Serialization" namespace.

To use the XmlSerializer, you need to instantiate it and call serialize or deserialize with a stream and object instance.
What is SAX ?



SAX

SAX is a simple API for XML Processing.
It is generally an alternative to DOM and it also can be used to parse the XML documents.
This simple API is based on Streaming model

Main Advantage of using SAX over DOM :

SAX does not build an in memory representation of the source XML document so when parsing large amount of XML documents it does not require a large amount of memory or Resources.
What are VSDISCO files and what is the use of it ?



VSDISCO


These files are the DISCO files that eventually support dynamic discovery of Web Services.

Usage of VSDISCO

When we place this VSDISCO file in a directory on our web server it returns references to all ASMX and DISCO files in the host directory.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories