Web Service Interview Questions and answers

Source: Internet
Author: User
Web Service Interview Questions and answers

What is a Web service?
Define people and companies have debated the exact definition of Web Services. at a minimum, however, a Web Service is any piece of software that makes itself available over the Internet and uses a standardized XML messaging system.
XML is used to encode all communications to a web service. for example, a client invokes a web service by sending an XML message, then waits for a corresponding XML response. because all communication is in XML, Web services are not tied to any one operating system or programming language -- Java can talk with Perl; Windows applications can talk with Unix applications.
Beyond this basic definition, a Web service may also have two additional (and desirable) properties:
First, a Web service can have a public interface, defined in a common XML grammar. the interface describes all the methods available to clients and specifies the signature for each method. currently, interface definition is accomplished via the Web Service Description Language (WSDL ). (see FAQ number 7 .)
Second, if you create a web service, there shoshould be some relatively simple mechanic for you to publish this fact. likewise, there shoshould be some simple mechanisms for interested parties to locate the service and locate its public interface. the most prominent directory of Web Services is currently available via UDDI, or universal description, discovery, and integration. (see FAQ number 8 .)
Web Services currently run a wide gamut from news syndication and stock-market data to weather reports and package-tracking systems. for a quick look at the range of web services currently available, check out the xmethods directory of Web Services.

what is new about Web Services?
people have been using remote procedure CALS (RPC) for some time now, and they long ago discovered how to send such CILS over HTTP.
SO, what is really new about Web Services? The answer is XML.
XML lies at the core of Web Services, and provides a common language for describing Remote Procedure cals, Web Services, and Web Service directories.
prior to XML, one cocould share data among different applications, but XML makes this so much easier to do. in the same vein, one can share services and code without web services, but XML makes it easier to do these as well.
by standardizing on XML, different applications can more easily talk to one another, and this makes software a whole lot more interesting.

I keep reading about web services, but I have never actually seen one. Can you show me a real Web Service in action?
If you want a more intuitive feel for Web Services, try out the IBM Web Services browser, available on the IBM alphaWorks site. the browser provides a series of web services demonstrations. behind the scenes, it ties together SOAP, WSDL, and UDDI to provide a simple plug-and-play interface for finding and invoking Web Services. for example, you can find a stock-quote service, a traffic-Report service, and a weather service. each service is independent, and you can stack services like building blocks. you can, therefore, create a single page that displays multiple services -- where the end result looks like a stripped-down version of my. yahoo or my. excite.

What is the Web service protocol stack?

The Web Service protocol stack is an evolving set of protocols used to define, discover, and implement web services. The core protocol stack consists of four layers:
Service Transport: This layer is responsible for transporting messages between applications. Currently, this includes des 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 understood at either end. Currently, this includes des XML-RPC and soap.
Service Description: This layer is responsible for describing the public interface to a specific web service. Currently, service description is handled via the WSDL.
Service Discovery: This layer is responsible for centralizing services into a common registry, and providing easy publish/find functionality. Currently, service discovery is handled via the UDDI.
Beyond the essentials of XML-RPC, SOAP, WSDL, and UDDI, the Web service protocol stack provided des a whole zoo of newer, evolving protocols. these include WSFL (Web Services Flow Language), SOAP-DSIG (soap security extensions: digital signature), and USML (UDDI search Markup Language ). for an overview of these protocols, check out Pavel kulchenko's article, Web Services acronyms, demystified, on xml.com.
Fortunately, you do not need to understand the full protocol stack to get started with Web Services. assuming you already know the basics of HTTP, it is best to start at the XML messaging layer and work your way up.

What is XML-RPC?
XML-RPC is a protocol that uses XML messages to perform remote procedure CILS. Requests are encoded in XML and sent via http post; XML responses are embedded in the body of the HTTP response.
More succinctly, XML-RPC = http + XML + Remote Procedure CILS.
Because XML-RPC is platform independent, diverse applications can communicate with one another. For example, a Java client can speak XML-RPC to a Perl server.
To get a quick sense of XML-RPC, here is a sample XML-RPC request to a weather service (with the HTTP headers omitted ):
<? XML version = "1.0" encoding = "ISO-8859-1"?>
<Methodcall>
<Methodname> weather. getweather </methodname>
<Params>
<Param> <value> 10016 </value> </param>
</Params>
</Methodcall>
The request consists of a simple element, which specifies the method name (getweather) and any method parameters (ZIP code ).

Here is a sample XML-RPC response from the weather service:

<? XML version = "1.0" encoding = "ISO-8859-1"?>
<Methodresponse>
<Params>
<Param>
<Value> <int> 65 </int> </value>
</Param>
</Params>
</Methodresponse>
The response consists of a single element, which specifies the return value (the current temperature). In this case, the return value is specified as an integer.
In each ways, the XML-RPC is much simpler than soap, and therefore represents the easiest way to get started with Web Services.
The official XML-RPC specification is available at XML-RPC.com. Dozens of XML-RPC implementations are available in Perl, Python, Java, and Ruby. See the XML-RPC home page for a complete list of implementations.

 

 

What is soap?
Soap is an XML-based protocol for exchanging information between computers. although soap can be used in a variety of messaging systems and can be delivered via a variety of transport protocols, the main focus of soap is remote procedure CILS (RPC) transported via HTTP. like XML-RPC, soap is platform independent, and therefore enables diverse applications to communicate with one another.

To get a quick sense of soap, here is a sample SOAP request to a weather service (with the HTTP headers omitted ):

<? XML version = '1. 0' encoding = 'utf-8'?>
<SOAP-ENV: Envelope
Xmlns: SOAP-ENV = "http://www.w3.org/2001/09/soap-envelope"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xmlns: XSD = "http://www.w3.org/2001/XMLSchema">
SOAP-ENV: Body>
<NS1: getweather
Xmlns: NS1 = "urn: Examples: weatherservice"
SOAP-ENV: encodingstyle = "http://www.w3.org/2001/09/soap-encoding
<Zipcode xsi: TYPE = "XSD: string"> 10016 </zipcode>
</NS1: getweather>
SOAP-ENV: Body>
SOAP-ENV: envelope>
As you can see, the request is slightly more complicated than XML-RPC and makes use of both XML Namespaces and XML schemas. much like XML-RPC, however, the body of the request specifies both a method name (getweather), and a list of parameters (zipcode ).

Here is a sample soap response from the weather service:


xmlns: SOAP-ENV = "http://www.w3.org/2001/09/soap-envelope"
xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns: XSD = "http://www.w3.org/2001/XMLSchema">

xmlns: NS1 = "urn: Examples: weatherservice"
SOAP-ENV: encodingstyle = "http://www.w3.org/2001/09/soap-encoding">
65


The response indicates a single integer return value (the current temperature ).
The World Wide Web Consortium (W3C) is in the process of creating a soap standard. the latest working draft is designated as soap 1.2, and the specification is now broken into two parts. part 1 describes the soap messaging framework and envelope specification. part 2 describes the soap encoding rules, the SOAP-RPC convention, and HTTP binding details.

What is WSDL?

The Web Services Description Language (WSDL) currently represents the service description layer within the web service protocol stack.
In a nutshell, WSDL is an XML grammar for specifying a public interface for a web service. This public interface can include the following:

Information on all publicly available functions.
Data Type information for all XML messages.
Binding information about the specific transport protocol to be used.
Address information for locating the specified service.

WSDL is not necessarily tied to a specific XML messaging system, but it does include built-in extensions for describing soap services.

below is a sample WSDL file. this file describes the public interface for the weather service used in the soap example above. obviusly, there are using details to understanding the example. for now, just consider two points.
first, the elements specify the individual XML messages that are transferred between computers. in this case, we have a getweatherrequest and a getweatherresponse. second, the element specifies that the service is available via soap and is available at a specific URL.

<? XML version = "1.0" encoding = "UTF-8"?>
<Definitions name = "weatherservice"
Targetnamespace = "http://www.ecerami.com/wsdl/WeatherService.wsdl"
Xmlns = "http://schemas.xmlsoap.org/wsdl"
Xmlns: Soap = "http://schemas.xmlsoap.org/wsdl/soap"
Xmlns: TNS = "http://www.ecerami.com/wsdl/WeatherService.wsdl"
Xmlns: XSD = "http://www.w3.org/2001/XMLSchema">
<Message name = "getweatherrequest">
<Part name = "zipcode" type = "XSD: string"/>
</Message>
<Message name = "getweatherresponse">
<Part name = "temperature" type = "XSD: int"/>
</Message>

<Porttype name = "weather_porttype">
<Operation name = "getweather">
<Input message = "TNS: getweatherrequest"/>
<Output Message = "TNS: getweatherresponse"/>
</Operation>
</Porttype>


transport = "http://schemas.xmlsoap.org/soap/http"/>



encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/"
namespace = "urn: Examples: weatherservice "
Use =" encoded "/>


encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/"
namespace = "urn: Examples: weatherservice "
Use =" encoded "/>


<Service name = "weather_service">
<Documentation> WSDL file for weather service </documentation>
<Port binding = "TNS: weather_binding" name = "weather_port">
<Soap: Address
Location = "http: // localhost: 8080/soap/servlet/rpcrouter"/>
</Port>
</Service>
</Definitions>
Using WSDL, a client can locate a web service, and invoke any of the publicly available functions. with WSDL-aware tools, this process can be entirely automated, enabling applications to easily integrate new services with little or no manual code. for example, check out the glue platform from the mind electric.
WSDL has been submitted to the W3C, But it currently has no official status within the W3C. See this W3C page for the latest draft.

 

 

What is UDDI?
UDDI (Universal Description, discovery, and integration) currently represents the discovery layer within the web services protocol stack.
UDDI was originally created by Microsoft, IBM, and Arba, and represents a technical specification for publishing and finding businesses and Web services.
At its core, UDDI consists of two parts.
First, UDDI is a technical specification for building a distributed directory of businesses and Web services. data is stored within a specific XML format, and the UDDI specification between des API details for searching existing data and publishing new data.
Second, the UDDI business registry is a fully operational implementation of the UDDI specification. launched in May 2001 by Microsoft and IBM, the UDDI registry now enables anyone to search existing UDDI data. it also enables any company to register themselves and their services.
The data captured within UDDI is divided into three main categories:
White Pages: This includes des general information about a specific company. For example, business name, business description, and address.
Yellow Pages: This includes des general classification data for either the company or the service offered. For example, this data may include industry, product, or geographic codes based on standard taxonomies.
Green pages: This includes des technical information about a web service. Generally, this includes des a pointer to an external specification, and an address for invoking the web service.
You can view the Microsoft UDDI site, or the ibm uddi site. The complete UDDI specification is available at uddi.org.
Beta versions of UDDI Version 2 are available:
Hewlett Packard
IBM
Microsoft
SAP

how do I get started with Web Services?
the easiest way to get started with Web Services is to learn XML-RPC. check out the XML-RPC specification or read my book, Web Services essen. O 'Reilly has also recently released a book on programming Web Services with XML-RPC by Simon St. laurent, Joe Johnston, and EDD dumbill.
once you have learned the basics of XML-RPC, move onto SOAP, WSDL, and UDDI. these topics are also covered in Web Services essen. for a comprehensive treatment of soap, check out O 'Reilly's programming Web Services with soap, by Doug Tidwell, James Snell, and Pavel kulchenko.

Does the W3C support any web service standards?
The World Wide Web Consortium (W3C) is actively pursuing standardization of web service protocols. in September 2000, the W3C established an XML protocol activity. the goal of the group is to establish a formal standard for soap. A draft version of soap 1.2 is currently under review, and progressing through the official W3C recommendation process.
On January 25,200 2, the W3C also announced the formation of a Web service activity. this new activity will include the current Soap work as well as two new groups. the first new group is the Web Services Description Working Group, which will take up work on WSDL. the second new group is the Web Services Architecture Working Group, which will attempt to create a cohesive framework for Web service protocols.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.