Showing posts with label wsdl questions. Show all posts
Showing posts with label wsdl questions. Show all posts

Sunday, February 21, 2016

SOA Interview Questions : Service Oriented Architecture Interview Questions Part 4



What is XML ?

Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable. It is defined by the W3C's XML 1.0 Specification
The design goals of XML emphasize simplicity, generality and usability across the Internet. XML was designed to store and transport data, and designed to be self-descriptive.


Sample XML file ?

<?xml version="1.0" encoding="UTF-8"?>
<Message>
    <MessageID>1</MessageID>
    <Operation>Update</Operation>
    <Inventory>                                      
         <Quantity>55</Quantity>          
    </Inventory>
</Message>



What are Main Key Terminology of XML ?

Tag
A markup construct that begins with < and ends with >. Tags come in three flavors:
start-tags; for example: <section>
end-tags; for example: </section>
empty-element tags; for example: <section/>

Element
A logical document component which either begins with a start-tag and ends with a matching end-tag or consists only of an empty-element tag.
The characters between the start- and end-tags, if any, are the element's content, and may contain markup, including other elements, which are called child elements.
An example of an element is
<Greeting>Hello, world</Greeting>
Another is
<line-break />

Attribute
A markup construct consisting of a name/value pair that exists within a start-tag or empty-element tag.
In the example (below) the element img has two attributes, src and desc:
<img src="myimage.jpg" desc='my image' />



What is Data Object model (DOM) ?

The Document Object Model (DOM) is an interface-oriented application programming interface that allows for navigation of the entire document as if it were a tree of node objects representing the document's contents. A DOM document can be created by a parser, or can be generated manually by users.



What is difference between XML & HTML ?

XML was developed to describe data and to focalize on what the data represent.
HTML was developed to display data about to focalize on the way that data looks.
HTML is about displaying data, XML is about describing information.
XML is extensible.The tags used to mark the documents and the structures of documents in HTML are pre-defined.
The author of HTML documents can use only tags that were previously defined in HTML.
The Standard XML gives you the possibility to define personal structures and tags.



What is XML Schema (XSD) ?

An XML Schema describes the structure of an XML document. XSD (XML Schema Definition) is the language used to describe schema. They use a rich datatyping system and allow for more detailed constraints on an XML document's logical structure.


Write a sample Schema File ?

<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org"
            targetNamespace="http://www.example.org" elementFormDefault="qualified">
  <xsd:element name="exampleElement" type="xsd:string">
    <xsd:annotation>
      <xsd:documentation>A sample element</xsd:documentation>
    </xsd:annotation>
  </xsd:element>
</xsd:schema>





What is Inline schema ?

Inline schemas are a way of including the schema within a WSDL file rather than specifying that it be imported. A schema defines the structure of an XML document. A schema is itself an XML document defined with an xsd extension.


Difference between Include and Import in context to XML schema ?

The fundamental difference between include and import is that you must use import to refer to declarations or definitions that are in a different target namespace and you must use include to refer to declarations or definitions that are (or will be) in the same target namespace.



What Is XML Namespace ?

XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation. XML Namespaces enable the same document to contain XML elements and attributes taken from different vocabularies, without any naming collisions occurring.
An XML namespace is declared using the reserved XML attribute xmlns or xmlns:prefix,
xmlns:xhtml="http://www.w3.org/1999/xhtml"


What is targetNamespace ?

<schema xmlns="http://www.w3.org/2001/SchemaXML         targetNamespace="http://www.example.com/name"         xmlns:target="http://www.example.com/name">

The targetNamespace declares a namespace for other xml and xsd documents to refer to this schema. The target prefix in this case refers to the same namespace and you would use it within this schema definition to reference other elements, attributes, types, etc. also defined in this same schema definition.


What is ElementFormDefault ?

The form for elements declared in the target namespace of this schema. The value must be "qualified" or "unqualified". Default is "unqualified". "unqualified" indicates that elements from the target namespace are not required to be qualified with the namespace prefix. "qualified" indicates that elements from the target namespace must be qualified with the namespace prefix.


What is AttributetFormDefault ?


The form for attributes declared in the target namespace of this schema. The value must be "qualified" or "unqualified". Default is "unqualified". "unqualified" indicates that attributes from the target namespace are not required to be qualified with the namespace prefix. "qualified" indicates that attributes from the target namespace must be qualified with the namespace prefix.




Refer Previous post on Interview questions at

1. SOA Interview Questions : Service Oriented Architecture Interview Questions Part 1

http://osb-dheeraj.blogspot.com/2016/02/soa-interview-questions-service.html

2. SOA Interview Questions : Service Oriented Architecture Interview Questions Part 2

http://osb-dheeraj.blogspot.com/2016/02/soa-interview-questions-service_16.html

3. SOA Interview Questions : Service Oriented Architecture Interview Questions Part 3

http://osb-dheeraj.blogspot.com/2016/02/soa-interview-questions-service_21.html

SOA Interview Questions : Service Oriented Architecture Interview Questions Part 3


What is WSDL ?

The Web Services Description Language (WSDL) is an XML-based interface definition language that is used for describing the functionality offered by a web service. The WSDL provides a machine-readable description of how the service can be called, what parameters it expects, and what data structures it returns.


Can you write a sample WSDL ?

<?xml version="1.0" encoding="UTF-8" ?>
<definitions targetNamespace="tns:https://www.DemoService.test" xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:tns="tns:https://www.DemoService.test" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
             xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

<!-- Abstract type -->
  <types>
    <xsd:schema targetNamespace="tns:https://www.DemoService.test/types" elementFormDefault="qualified"/>
  </types>

<!-- Abstract Message -->
  <message name="NewMessage">
    <part name="in" element="xsd:any"/>
  </message>
  <message name="NewReturnMessage">
    <part name="return" element="xsd:any"/>
  </message>

<!-- Abstract Port Type -->
  <portType name="DemoServicePortType">
    <operation name="NewOperation">
      <input message="tns:NewMessage"/>
      <output message="tns:NewReturnMessage"/>
    </operation>
  </portType>

<!-- Concrete Binding with SOAP-->
  <binding name="DemoServiceBinding" type="tns:DemoServicePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="NewOperation">
      <soap:operation style="document" soapAction="tns:https://www.DemoService.test/NewOperation"/>
      <input>
        <soap:body use="literal" parts="in"/>
      </input>
      <output>
        <soap:body use="literal" parts="return"/>
      </output>
    </operation>
  </binding>

<!-- Concrete Service location-->
  <service name="DemoService">
    <port name="DemoServicePort" binding="tns:DemoServiceBinding">
      <soap:address location="http://www.example.com"/>
    </port>
  </service>

</definitions>


How are different Elements of WSDL related ?

This can be understood by below representation





Explain different versions of WSDL standards ?

The current version of the specification is 2.0; version 1.1 has not been endorsed by the W3C but version 2.0 is a W3C recommendation.





Explain elements/tags of WSDL ?


WSDL 1.1 Term
WSDL 2.0 Term
Description
Service
Service
Contains a set of system functions that have been exposed to the Web-based protocols.
Port
Endpoint
Defines the address or connection point to a Web service. It is typically represented by a simple HTTP URL string.
Binding
Binding
Specifies the interface and defines the SOAP binding style (RPC/Document) and transport (SOAP Protocol). The binding section also defines the operations.
PortType
Interface
Defines a Web service, the operations that can be performed, and the messages that are used to perform the operation.
Operation
Operation
Defines the SOAP actions and the way the message is encoded, for example, "literal." An operation is like a method or function call in a traditional programming language.
Message
n/a
Typically, a message corresponds to an operation. The message contains the information needed to perform the operation. Each message is made up of one or more logical parts. Each part is associated with a message-typing attribute. The message name attribute provides a unique name among all messages. The part name attribute provides a unique name among all the parts of the enclosing message.
Messages were removed in WSDL 2.0, in which XMLschema types for defining bodies of inputs, outputs and faults are referred to simply and directly.
Types
Types
Describes the data. The XML Schema language (also known as XSD) is used (inline or referenced) for this purpose.


What are  different types of WSDL ?
There are two types of WSDL
1.       Concrete WSDL
Abstract WSDL 


Can you define types of  WSDL ?

 Abstract WSDL contains only Types, Messages and Operations. Abstract WSDL is used by server side components programming.

Concrete WSDL contains all elements of WSDL, such as Types, Messages, Operations , Binding and Service transport specific information (JMS or Http). This is used by client side components. 





Refer Previous post on Interview questions at

1. SOA Interview Questions : Service Oriented Architecture Interview Questions Part 1

http://osb-dheeraj.blogspot.com/2016/02/soa-interview-questions-service.html

2. SOA Interview Questions : Service Oriented Architecture Interview Questions Part 2

http://osb-dheeraj.blogspot.com/2016/02/soa-interview-questions-service_16.html