WCF Interview Questions Part 3

Which styles of models are supported in WCF?

“WCF service supports 2 styles of models:

RPC style: In RPC style we can use the serialize types and it provides the feature that is available for local calls.

Message style: In message style WCF allows the message header to be customized and it also allows us to define the security for body and header messages.”

How can you generate proxies using Svcutil in WCF?

SvcUtil is a command line utility. You should write the following command to generate proxy:

What is the usage of “receive Timeout” property in WCF?

The “receive Timeout” property is used to get/set the time interval to makes a connection active.

WCF Interview Questions

Write an example to demonstrate the working of the Web Service Provider.

“Here is the example of a Web Service Provider:

using System;
using System.Web.Services;
using System.Xml.Serialization;

[WebService(Namespace=””http://localhost/MyWebServices/””)]
public class FirstService : WebService{
[WebMethod]
public int Add(int a, int b) {
return a + b;
}

[WebMethod]
public String SayHello() {
return “”Hello World””;
}
} “

Explain the role of web service requestor/ consumer.

The role of Web Service Requestor / Consumer is to utilize the pre-existing web service provided by the Web Service Provider/ Publisher. Web Service Requestor/ Consumer request the Web Service provider for the information by sending a SOAP message to the Web Service provider. Then in-Turn Web Service Publisher sends the requested information back to the requestor in the form of a SOAP message.

Explain the role of web service provider/ Publisher.

The role of a Web Service provider is to implement web service and make it available to the web service requestor/ consumer.

Advance WCF Interview Questions

How are the terms “Platform independent” and “Diverse Application” are related to each other in the context of XML-RPC?

The terms “Platform independent” and “Diverse Application” were related to each other because XML-RPC uses HTTP for transporting SOAP messages over the web. The HTTP is a universal standard protocol for exchanging information on the Web. Hence, it leads to Cross Platform support/ Platform independent. So because it is Platform independent, it leads to the diverse application capable of accessing the web services.

How many Communication protocols can be used to implement a SOAP message? Is SOAP messages are tied to any protocol?

“Communication protocol refers to the protocols which were used to transmit information over the web. By using Transport protocols, applications from the different background can quickly communicate with each other without knowing the inside functioning of the various systems. HTTP (Hyper-Text Transfer Protocol) can be used to implement a SOAP message whereas FTP (File Transfer Protocol) can be used as the reliable transport mechanism. SMTP and BEEP can also be used for transport mechanism.

SOAP message is not tied to any protocol. It can use any of the open Transport protocol.”

What are the steps involved in accessing a web service?

“These are the steps involved in accessing a web service:

Client application bundled the information and into a SOAP message.
SOAP message sends to the server as a body of Hyper-Text markup language using POST method.
Web service unpacks the SOAP message and converts it into a command understandable by the application.
Application processes the information and in turn bundled the info and send it back to the client as a SOAP message.
A Client then unpacks the SOAP message to obtain the results.”

WCF Interview Questions

Explain different HTTP methods supported by RESTful web services?

“Enlisted below are some common HTTP methods along with their functions that are supported by RESTful web services.

GET: Read-only access to the resource.
PUT: Creation of new resource.
DELETE: Removal of a resource.
POST: Update of an existing resource.
OPTIONS: Get supported operations on the resource.
HEAD: Returns HTTP header only, nobody.”

Which language does UDDI use?

The UDDI uses the language known as WSDL (Web Service Description Language).

What are the requirements to access a Web Service?

The requirement for accessing web services from any application is that should support XML-based request and response. Hence there is no need to install any app for accessing web services.

Advance WCF Interview Questions

Explain BEEP?

“The BEEP stands for Blocks Extensible Exchange Protocol. BEEP is an alternative to HTTP and FTP. BEEP is determined as building new protocols for the variety of applications such as instant messaging, network management, file transfer. It is termed as new Internet Engineering Task Force (IETF) which is layered directly over TCP.

Some of the Build-in features of BEEP protocol are listed below:

Authentication
Security
Error handling
Initial Handshake Protocol”

What is XML-RPC?

“The RPC is Remote Procedure Call. It is the method used for calling a procedure or function available on any remote computer on the web.

XML-RPC refers to a simple protocol used to perform RPCs by using XML messaging. It is an excellent tool for connecting different environments and also establishing connections between wide varieties of computers.”

Explain web service architecture?

“The web service framework includes three different layers.

The roles of these layers are:

Service Provider: Role of Service provider is to make the web service which makes it accessible to the client applications over the Web.
Service Requestor: Service requestor refers to any consumer of web service like any client application. Client applications are written in any language contact web service for any functionality by sending XML request over the available network connection.
Service Registry: Service Registry is the centralized directory System which helps to locate the web services for client applications. Used to find the existing web services, as well as developers, can also create the brand new one web service also.
The Service Provider uses the interface named as ?Publish? interface of Service Registry to make the existing web services available to client applications. With all the information provided by the service registry, service requestor able to find or invoke services.”

WCF Interview Questions

Explain web service protocol stack and its layers?

“The web services consist of four layers, as mentioned below:

Service transport:

This layer is the first layer in the web services protocol stack used in transporting XML files between various clients applications. Protocols used in the layer is as follows:

HTTP (Hypertext transfer protocol)
SMTP (Simple Mail Transfer Protocol)
FTP (File Transfer Protocol)
BEEP (Block Extensible Exchange Protocol)
XML Messaging:

This layer is the second layer in the web services protocol stack based on XML model where messages are encoded in common XML format which can be understandable to other client applications. This layer includes the following protocols:

XML – RPC
SOAP (Simple Object Access Protocol)
Service Description:

This layer provides the service description to the public interface like the location of web service, Available functions, And the data types for XML messaging. This layer only includes one language:

WSDL: WSDL stands for Web Service Description Language.
Service Discovery:

This layer in the Web Services protocol stack is used to publish or finding web services over the web. This layer includes:

UDDI (Universal Description, Discovery, and integration).”

What is the need of element in the SOAP document?

“The element is used as the root element of every SOAP message.

The Root element is known as the first element in the XML Document.

The envelope, in turn, separated into two parts. One is the header part and second is the body part. The header contains the routing data which stores the source and destination address of the client. So the body includes the actual data.”

What is meant by SOAP message?

“The SOAP message refers to the data sent to the application from web services. SOAP message is an XML document which is sent through web services to provide data to the client application written in any programming language.

SOAP message sends via using hypertext transfer protocol.”

Advance WCF Interview Questions

What is a remote procedure call (RPC)?

The Remote procedure calls refer to the calls made to the methods which are hosted by related web service.

What is the usage of Service Discovery layer in Web Service Protocol Stack?

“The Service Discovery layer is used for centralizing services into a universal registry and providing easy publish/find functionality.

Currently, service discovery is handled via Universal Description, Discovery, and Integration (UDDI).”

What is the usage of Service Transport Layer in Web service protocol stack?

“The Service Transport Layer is used to transport messages between applications.

This layer includes Hypertext Transport Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), File Transfer Protocol (FTP), and newer protocols like Blocks Extensible Exchange Protocol (BEEP).”

WCF Interview Questions

What do you mean by synchronicity?

Synchronicity is used to bind the client to the execution of the service. In synchronous invocations, the client blocks and waits for the service to complete its operation before continuing. On the other hand, synchronous operations facilitate a client to invoke a service and then execute different functions.

What are the advantages of having XML based Web services?

Using XML eliminates any networking, operating system, or platform binding. So Web Services based applications are highly interoperable application at their core level.

Explain the loosely coupled architecture of web services.

A consumer of a web service is not tied to that web service directly. The web service interface can change over time without compromising the client’s ability to interact with the service. A tightly coupled system implies that the client and server logic are closely tied to one another, implying that if one interface changes, the other must be updated. Adopting a loosely coupled architecture tends to make software systems more manageable and facilitates simpler integration between different systems.

Advance WCF Interview Questions

What is Interoperability in Web services?

The Web services facilitate various applications to communicate with each other and share data and services among themselves. Other applications can also use the web services. For example, a VB or .NET application can communicate with a Java web services and vice versa. Web services are used to make the application platform and technology independent.

What is the usage of WSDL in a web service?

WSDL is used in web service to describe the availability of service.

What is the advantage of XML in web service?

In Web service, an XML is used to tag the data, format the data.

WCF Interview Questions

What tools are used to test web services?

“The tools used to test web services are:

SoapUI tool for testing SOAP and RESTful web services
Poster for fire fox browser
Postman extension for Chrome

What are the advantages of RESTful web services?

“These are some of the important advantages of RESTful web services:

Fast – The Web Services are fast because there is no strict specification of SOAP. It consumes less bandwidth and resource.
Language Independent – The web services can be written in any programming language.
Platform Independent – The web services can be executed on any platform.
Can use SOAP – The web services can use SOAP web services as the implementation.
Allows different data format – The web service permits different data format such as Plain Text, HTML, XML, and JSON.”

What is RESTful web services?

The REST stands for Representational State Transfer. It is an architectural style. It is not a protocol like SOAP.

Advance WCF Interview Questions

What is UDDI?

The UDDI stands for Universal Description, Discovery and Integration. It is a XML based framework for describing, discovering and integrating web services. It contains a list of available web services. WSDL is the part of UDDI. 

What is WSDL?

“The WSDL stands for Web Services Description Language. It is an XML document containing information about web services such as method name, method parameter. The Client needs a data dictionary which contains information about all the web services with methods names and parameters list to invoke them for the web services. The Web Service Description Language bridge up this gap, by providing all necessary information to the client.

Some Important elements used in Web Services Description language are as follows:

: The message element in WSDL is used to define all different data elements for each operation performed by the web service.
: The port type element is used to determine the operation which can be performed by the web service. This operation can have two messages one is input and the second one is the output message.
: This element contains the used protocol.”

What are the main features of SOAP?

“The following list specifies the features of SOAP:

SOAP is a communication protocol.
SOAP communicates between applications.
SOAP is a format for sending messages.
SOAP is designed to communicate via Internet.
SOAP is platform independent.
SOAP is language independent.
SOAP is simple and extensible.
SOAP allows you to get around firewalls.
SOAP developed as a W3C standard.”

WCF Interview Questions

What are the disadvantages of SOAP web services?

“These are some of the important disadvantages of SOAP web services:

Slow – It uses XML format that must be parsed to be read and defines many standards that must be followed while developing the SOAP applications. So it is slow and consumes more bandwidth and resource.
WSDL Dependent – It uses WSDL and doesn’t have any other mechanism to discover the service.”

What are the advantages of SOAP web services?

“These are some of the important advantages of SOAP web services:

WS Security – SOAP defines its security known as WS Security.
Language Independent – Its web services can be written in any programming language
Platform Independent – Its web services can be executed on any platform.”

What are the main features of web services?

“Following is a list of main features of web services:

It is available over the Internet or private (intranet) networks.
It uses a standardized XML messaging system.
It is not tied to any one operating system or programming language.
It is self-describing via a common XML grammar.
It is discoverable via a simple find mechanism.”

Advance WCF Interview Questions

What are the advantages of web services?

“These are some of the important advantages of web services:

Interoperability: With the help of web services, an application can communicate with other application developed in any language.
Reusability: We can expose the web service so that other applications can use it.
Modularity: With the help of web service, we can create a service for a specific task such as tax calculation.
A Standard protocol for every application program: Web services use standard protocol so that all the client applications written in different languages can understand it. This Standard protocol helps in achieving cross-platform.
Cheaper cost for communication: Web services uses SOAP over HTTP so that anybody can use existing internet for using web services.”

How to set different status code in HTTP response?

“For setting HTTP status code other than 200, we have to use javax.ws.rs.core.Response class for response. Below are some of the sample return statements showing it’s usage.

return Response.status(422).entity(exception).build();
return Response.ok(response).build(); //200″

What is the use of @XmlRootElement annotation?

Xml Root Element annotation is used by JAXB to transform java object to XML and vice versa. So we have to annotate model classes with this annotation.

WCF Interview Questions

Name important annotations used in JAX-WS API?

“Some of the important annotations used in JAX-WS API are:

@WebService
@SOAPBinding
@WebMethod”

Name some frameworks in Java to implement SOAP web services?

We can create SOAP web services using JAX-WS API, however some of the other frameworks that can be used are Apache Axis and Apache CXF. Note that they are not implementations of JAX-WS API, they are totally different framework that work on Servlet model to expose your business logic classes as SOAP web services.

What is JAX-WS API?

JAX-WS stands for Java API for XML Web Services. JAX-WS is XML based Java API to build web services server and client application. It’s part of standard Java API, so we don’t need to include anything else which working with it.

Advance WCF Interview Questions

What is the use of Accept and Content-Type Headers in HTTP Request?

“These are important headers in Restful web services. Accept headers tells web service what kind of response client is accepting, so if a web service is capable of sending response in XML and JSON format and client sends Accept header as “application/xml” then XML response will be sent. For Accept header “application/json”, server will send the JSON response.

Content-Type header is used to tell server what is the format of data being sent in the request. If Content-Type header is “application/xml” then server will try to parse it as XML data. This header is useful in HTTP Post and Put requests.”

Can we maintain user session in web services?

Web services are stateless so we can’t maintain user sessions in web services.

What are different ways to test web services?

“SOAP web services can be tested programmatically by generating client stubs from WSDL or through software such as Soap UI.

REST web services can be tested easily with program, curl commands and through browser extensions. Resources supporting GET method can be tested with browser itself, without any program.”

WCF Interview Questions

What is a Resource in Restful web services?

Resource is the fundamental concept of Restful architecture. A resource is an object with a type, relationship with other resources and methods that operate on it. Resources are identified with their URI, HTTP methods they support and request/response data type and format of data.

What are disadvantages of REST web services?

“Some of the disadvantages of REST are:

Since there is no contract defined between service and client, it has to be communicated through other means such as documentation or emails.
Since it works on HTTP, there can’t be asynchronous calls.
Sessions can’t be maintained.”

What is REST Web Services?

“REST is the acronym for Representational State Transfer. REST is an architectural style for developing applications that can be accessed over the network. REST architectural style was brought in light by Roy Fielding in his doctoral thesis in 2000.

REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services. REST doesn’t specify any specific protocol to use, but in almost all cases it’s used over HTTP/HTTPS. When compared to SOAP web services, these are lightweight and doesn’t follow any standard. We can use XML, JSON, text or any other type of data for request and response.”

Advance WCF Interview Questions

What is difference between Top Down and Bottom Up approach in SOAP Web Services?

“In Top Down approach first WSDL document is created to establish the contract between web service and client and then code is written, it’s also termed as contract first approach. This is hard to implement because classes need to be written to confirm the contract established in WSDL. Benefit of this approach is that both client and server code can be written in parallel.

In Bottom Up approach, first web service code is written and then WSDL is generated. It’s also termed as contract last approach. This approach is easy to implement because WSDL is generated based on code. In this approach client code have to wait for WSDL from server side to start their work.”

What are the points that should be considered by ports while binding?

“WSDL allows extensibility elements that are used to specify binding information. Below are a few important points that should be kept into consideration while binding.

A port must not

Specify more than one address.
Specify any binding information other than address information.”

WCF Part 1WCF Part 2
Back to top