Vous êtes sur la page 1sur 13

Programming Web Services!

Exam questions & Answeres

Lecture 1: SOA and introduction:

1. What is Service Oriented Architecture (SOA)? Which roles and which


operations it assumes?
SOA is an architectural concept where the software components are modeled as
services.
These services will have a well-defined interface through which the other services
can interact with each other to achieve a business purpose. It enables the
publishing and consumption of software services.

The various roles played are as follows


Services Provider: These denotes the entity that develops and deploys the web
services at run-time, create the service description, publishes or registers the
service description to several service registries and handles the incoming service
invocations from service requesters. It can be viewed as the server side of the
client-server relationship, the handles the incoming requests from the service
requester.
Service Requester: This denotes the entity that consumes the web service. Its
responsibility is to find the service description from one or more services registries,
to invoke and bind to the appropriate service provider. It can be viewed as the
“client” side of the client-server relationship.
Service Registry: It acts as a match maker between the service provider and the
service requester. It allows the service provider to publish his service description in
its registry and allows the service requester to search and use the service
description.

The various operations in SOA:


Publish: It is an act of service registration and service advertisement that takes
place between the service provider and the service registry. This operation is done
by the service provider, in which it publishes the description of its web services on
the service registry thereby making it available for the service requesters. In simple
terms, it is an act of moving the web service description to the service registry's
structure.
Find: It is an act of service discovery that takes place between the service
requester and service registry. This operation is done by the service requester. The
service requester provides certain search parameters like type of service, quality of
service etc and the service registry returns those services descriptions that
matches the search criteria.
Bind: It is an act in which the service requester binds with the service provider using
the information from the provider's service description it obtained from the service
registry. It can either be sophisticated and dynamic or static. In this operation, both
the provider and requester communicate with each other directly without the
involvement of the service registry.

V0.1
Programming Web Services! Exam questions & Answeres

2. Show layers and associated Web Services technologies of a Web Service


interoperability stack

3. Is there any difference between SOA and Web services? Justify


The Web services is some kind of SOA. One of the differences is that the Web
services are based on message passing and XML, but SOA could use message
passing or Remote Method Invocation (RMI) or Remote Procedure Call (RPC).

4. Give advantages of Web services as a technology for software integration


a. Operate using open, text-based standards
b. Promote a modular approach to programming
c. Significantly reduce the cost of enterprise applications integrations and B2B
communications
d. Can be implemented incrementally
e. The usage of HTTP enables the web service messages to tunnel through
firewalls of different enterprises.
f. The usage of XML text-based formats for representation of messages
eliminates the byte-order concerns.
g. The expressive nature of attributes and nested elements in XML made it
easier to represent complex data structures.
h. The implementation of SOA style enabled the applications to locate and bind
with the service providers dynamically thereby providing maximum flexibility.

5. Firewalls present a special challenge to integrating inter-enterprise


systems. How is this problems solved for web services?
Firewalls allow the HTTP messages to pass through them. So, we write our own
XML text- based protocol message and place it on HTTP and send it across the
firewall. This approachof wrapping our SOAP message with the HTTP so that it can
safely pass through the firewall is called as HTTP Tunneling.
V0.1
Programming Web Services! Exam questions & Answeres

6. Explain what is “Software as a service”? What is its main difference with


traditional software? (2010)
Software as Service (Saas) is
a software application delivery model
where
• a software vendor develops a software application
• hosts the software application and
• operates the application
for use by its customers

The main difference between Saas and traditional software is that customers do not
pay for owning the software, but rather for using it.

7. Explain the difference between human-centric, application-centric and


automated web
Invocation: In human-centric approach the humans should invoke the service
explicitly. In application- centric, the middle ware layer invokes the service. In the
automated web, both the discovery! and invocation of service are done by the
middle ware layer.

Location: In human-centric approach, the humans should have a knowledge of the


exact location of the service. In both application-centric and automated web,
humans do not need to have the location of the service.

coupling: The human-centric approach is faster and tightly coupled, whereas both
application-centric and automated web are loosely coupled and relatively slower.

8. What are the advantages of web services technology over the traditional
distributed computing technologies like CORBA, RMI and COM ?

Invocation: CORBA / RMI / COM are synchronous method invocation techniques,


where as Web services are asynchronous.

Communication: Web services uses a simple text-based XML messaging to


communicate, whereas! CORBA / RMI / COM does not use XML messaging.

Coupling: CORBA / RMI / COM makes the application integration tightly coupled,
whereas Web services makes application integration loosely coupled thereby
allowing it to be highly flexible. - CORBA / RMI / COM support only RPC whereas
web services support both RPC and document-centric messaging.

Integration: CORBA / RMI / COM are suitable for intra-enterprise application


integration, whereas Web service is suitable for inter-enterprise application
integration.

V0.1
Programming Web Services! Exam questions & Answeres

9. Show the web services protocol stack.

10.Explain the interaction between service requester, SOAP, WSDL and UDDI
in realizing a web service application.
10.1 The service requester queries the UDDI registry to find a service
! matching the search parameters.
10.2 The UDDI returns the location of the WSDL for the appropriate service.
10.3 The requester accesses the WSDL and gets the necessary data to invoke
! and use the Web service.
10.4 The requester creates a SOAP-message request and sends it to the web
! service.
10.5 The web service processes the incoming SOAP-message !request and
! sends back the SOAP-message response to the service ! requester.

11.What are the various service discovery approaches? Explain their


advantages and disadvantages. Which of these approaches are being
used in SOA ? Service discovery approaches are:

• Registry approach.
• Registry first and the you can get some information.
• It has centralized register
• Indexed approach. (Google)
• They registry the index of services, like google.
• It doesn't has centralized register.
• Peer-To-Peer approach.
• Services stores in some nodes. Then it know some neighbors. When it has
to find some services, it ask to the neighbors. If they know, then finish; it
not, the neighbors will ask to their neighbors.
• Some times it can't guarantee that it can find the right services.

Registry approach is centralized and therefore faster than the other approaches. It
has the limitation that only the services registered in the registry are available.
V0.1
Programming Web Services! Exam questions & Answeres

Indexed approach involves the searching through out the web and therefore it is
slower. But the requester is left with a wider window of accessing many other web
services.

In Peer-To-Peer approach, the search is to be done on only those peers attached to


the registry. Thus it is relatively faster than indexed approach and relatively slower
than the registry approach. The requester can only access the services registered
in the peers.

SOA uses the registry approach.

12.List the properties of SOA?


1. Logical view of sources
2. Message exchange between requester and provider
3. Meta data description oriented
4. Small number of operations, large and complex messages
5. Network orientation
6. Platform neutral

13.What are the differences between Web services and Application Service
Providers?

Centralization: Web services is a decentralized approach. ASP is a centralized


approach.

Permission: The service requester needs the permission of ASP to use a service.
Whereas the service requester does not need the permission to use a service in a
web service.

Granularity: Web Services can have different granularity, but ASP cannot.

14.Compare the component based model and web service model.

Coupling: CB models are tightly coupled. WS models are loosely coupled.


Integration: CB models are for intra-enterprise applications. WS models are for
inter-enterprise applications.
Protocols and technologies: CB uses different protocols and technologies. The
Web services model uses common protocols and technologies.

V0.1
Programming Web Services! Exam questions & Answeres

Lecture 2: XML
1. Explain why do we have different XML parsing models?

It is because that XML parsing needs to do trade-off between memory efficiency,


computational efficiency and ease of programming.

2. What are the input(s) and output(s) of an XML Schema compiler? How
many times we need to invoke schema compiler during parsing?

Input(s): XML schema.


Output(s): un-marshaling and marshaling modules specific to the schema.

We need to invoke the XML schema compiler only once.

3. What are the main parsing models? Give their advantages and
disadvantages.

Parsing models are: Push, Pull, One-Step and Hybrid.


Push: (SAX)
• Advantages:
• Least usage of memory.
• Simple to handle.
• Disadvantage:
• It is a single-pass parsing technique hence no random access of nodes.
• It is read-only (in case of SAX).

Pull:
• Advantage:
• Disadvantage:

One-step:
• Advantage:
• Easy to manipulate XML documents.
• Parsing done in a single step.
• Disadvantage:
• More memory usage.

Hybrid:
• Advantage: Efficient usage of time and memory.
• Disadvantage:

Model Memory efficiency Computation Ease of program.


efficiency

Pull High Highest Low

V0.1
Programming Web Services! Exam questions & Answeres

Model Memory efficiency Computation Ease of program.


efficiency

Push (SAX) High High Low

One-Step Low Low High


(DOM)

Hybrid Medium Medium High

4. We considered 4 parsing models for XML. Briefly explain them and suggest
in which cases each of them is more suitable to use. (2010)

The parsing models are Push, Pull, One-Step and Hybrid.

Pull parsing:
• The application always has to ask the parser to give it the next piece of
information about the document.
• The XML community has not yet defined standard APIs for pull parsing.

Push parsing (SAX)


• The parser sends notifications to the application about the types of XML
document pieces.
• The push parsing is also commonly known as event-based parsing.
• Standard: Simple API for XML (SAX)

One-step parsing (DOM)


• The parser reads the whole XML document and generates a data structure
and describing its contents.
• The data structure is typically deeply nested
• The W3C has defined a Document Object Model (DOM)

Hybrid parsing
• This approach combines characteristics of the other three parsing models
• For example, combining pull parsing with one-step parsing.
• The application thinks itʼs working with a one-step parser, but as the
application keeps accessing more objects on the DOM tree, the parsing
continues incrementally.

5. What is the difference between import and include in XML schema reuse?
How?
Namespace collision: Using include you can retrieving the definitions but it makes
no namespace changes. Using import it merges schemas from multiple
namespaces into one schema. With import is possible to merge the contents of the

V0.1
Programming Web Services! Exam questions & Answeres

namespace into other namespace. You just have to specify the new namespace
when you are importing.

Different documents: With include, the fully qualified name of the elements needs
to be used. Then, if we include different document you cannot hide this fact.
Whereas on using import, this fact can be hidden cause we do not need to use the
fully qualified name.

6. What is well-formedness and what is validity of an XML document? Who


checks them and what kind of information is required for their checking?

An XML document is said to be well-formed if it is conformant with the XML syntax


rules.

An XML document is said to be valid if it is conformant with the applied format as


defined either in a Document Type Definition (DTD) document or a XML schema
document.

The XML parser checks for both well-formed ness and validity of the XML
document.

To check the well-formedness the parser needs the XML document alone.
To check the validity of the document the parser needs the XML document and
either its DTD or schema document.

7. Why might we need name spacing of attributes in an XML document? Give


an example.

We need name spacing of attributes for the following reasons.


• To avoid the recognition problem where the parser can understand the
semantic meaning of attributes.
• To avoid the collision problem where two identical attributes are used for
mentioning of distinct entities in the same document.
• To extend the information provided by an XML element without having to make
changes directly to its document type.

Consider a scenario where we have 2 elements “<order>” and “<item>”. If we need


to have an attribute named “priority” for both the elements. In order to clearly
understand their peculiar usage we need to use unique namespace for the attribute
in each element.

8. Show how you represent phone number “+46 8 790 04 13” in XML using
elements and using attributes? Give advantages and disadvantages of one
representation compare to another?

V0.1
Programming Web Services! Exam questions & Answeres

Using Elements: <ContactNo> <CountryCode>46</CountryCode> AreaCode>87</


AreaCode> <PhoneNo>900413</PhoneNo></ContactNo>
Using Attributes: <ContactNo CountryCode=”46” AreaCode=”87”
PhoneNo=”900413”> </ContactNo>

Some disadvantage of Attribute regard to elements are:


1. Not multiple values: It cannot contain multiple values
2. Not easily expansion: Itʼs not easily expandable
3. Not usable to describe structures
4. Harder to be manipulated by program code.

9. Compare advantages and disadvantages of DOM and SAX approaches to


XML parsing.

• DOM is in memory structure, SAX is not


• SAX is simpler than DOM in many ways
• SAX is event-based API
• DOM parser in space while SAX parses in time

10. Explain difference between document centric and data-centric XML.


Which one is used in Web Services? Compare them.

• Ratio markup: The ratio of markup to content in data-centric is much higher


than in document-centric XML
• Machine-generated: Data-centric often includes a machine-generated
information
• Structure: The document and tags are highly structured in data-centric.
• Data structure: Data-centric is easily related to a data structure
• Living Time: Data-centric usually living shorter time than document-centric

Data-centric XML is used in web services

11. Explain the idea of XML schema compiler.

V0.1
Programming Web Services! Exam questions & Answeres

The XML schema compiler is a tool that analyzes the XML schema and code-
generates the corresponding marshalling and un-marshalling modules.

It needs to be invoked only once.


Later the application can use the code-generated modules without requiring the
schema compiler.

12. What are the 2 XML processing techniques? Explain the differences
between them. Give examples for both.

The 2 processing techniques are


• Syntax oriented processing – SAX and DOM
• Data oriented processing - JAXB

XML Structure: Syntax oriented processing depends on the XML structure.


Applications have to work with elements, attributes and pieces of text. Whereas
data centric approach does not depend on the XML structure.
XML Schema compiler: Syntax oriented approach does not use any XML schema
compiler where data-centric uses XML schema compiler.

13. What is the difference between a pre-defined data type and constructed
data type.

Pre-defined data type are the data types that are already defined in the XML. eg:
string, positiveInteger, date, time etc.

Constructed data type can be any new data types which are constructed from the
pre-defined data types.

14. What is the difference between simpleType and complexType elements in


XML schema.

A simple element is an XML element that can contain only text. It cannot contain
any other elements or attributes.

A complex element is an XML element that contains other elements and/or


attributes.

15. Discuss about restrictions and extensions in XML schema.

Restriction implies that the values that an XML element contains are bound to
certain rules as defined in the schema document. For e.g. : The usage of
“xsd:enumeration” restricts the XML elementʼs values to limited set of values.
Similarly the usage if “xsd:pattern” restricts the XML elementʼs values to a certain
pattern.
V0.1
Programming Web Services! Exam questions & Answeres

Extensions imply that the existing functionality of an element can be extended to an


additional set of functionality as defined in the XML schema.

16. List the basic schema reusability mechanisms in XML schema? Explain
the difference between intra-document reusability and inter-document
reusability.

Reusability mechanisms:
• Element reference
• Attribute reference
• Model groups reference
• Schema includes
• Schema imports

In intra-document reusability the elements are reused in the same schema


document.
In inter-document reusability the elements of a schema document are reused in a
different document.

17. Which mechanisms for re-use in XML do you know? Briefly explain each
of them. (2010)

We can classify the mechanism to reuse XML into two types: Intra-XML reuse and
Inter-XML reuse.

The Intra-XML reusage refers to the mechanism that reuse a part of the same
document. In this case, the keyword "ref" is used.

The inter-XML reusage refers to the mechanism that reuse a part of other
document as their own. There are two types: "include" and "import".

When we use "include" we are reusing a part of other XML document without
changing its original namespace. But if we want to reuse parts of different
documents that have the same namespace, then the namespace collision could be
avoid using "import". With "import" we can merge the components of the
namespace and assign them new namespace

18. What is the role of “targetNamespace” attribute in XMl Schema


description?
The targetNameSpace attribute of a schema elements identifies the namespace of
the documents that will conform to the schema.

It indicate where the element defined by this schema come from.


V0.1
Programming Web Services! Exam questions & Answeres

19. Explain why do we have different XML parsing models?


The reasons there are so many different models for parsing XML have to do with
trade- offs between memory efficiency, computational efficiency, and ease of
programming.

V0.1
Programming Web Services! Exam questions & Answeres

Lecture 3: SOAP
12. Give advantages of using SMTP for transporting SOAP messages.
•! Buffering and queuing of messages with reliable dispatch thereby
asynchronous mode of transfer.
•! MIME types can be attached and sent along. •! Email can support one-to-one
and one-to-many participant configurations. •! Internet e-mail server
infrastructure is highly scalable.
• Email messages have extensible headers that can be used to transmit context
information outside the SOAP messages.

V0.1

Vous aimerez peut-être aussi