Introduction
Web service is a well-defined, self-contained software function provided over the internet. The web service is explained in detail in this post (link to post) that explains questions such as "What is a web service?", "What are the components of a web service?", etc.
Background
Enterprises containing existing legacy applications and databases might need to exploit the new technologies in order to serve their business needs. For example an Enterprise in Retail space would have been using several applications erstwhile for their business need. But if it wants to move on to multichannel retail then software which suites that purpose have to be explored and adopted. Here the existing applications have to be maintained as well as new applications needs to get integrated. Then the need for EAI (Enterprise Architecture Integration) comes into picture. Several integration technologies have been used in Enterprise Architectures. EAI (Enterprise Architecture Integration) is a term used for creating plans, methods and tools for modernizing and consolidating the applications in enterprises. Service Oriented Architecture (SOA) is one of the integration method used in EAI. In SOA web services are used for integration.
Types of Web Services:
There are basically two types of web services.
- SOAP (Simple Object Access Protocol) web service
- RESTful (Representational State Transfer) web service
In this post, we will be discussing SOAP web service in detail.
SOAP is a protocol used for accessing the web services. A web service which implements the standards of SOAP are named as SOAP web services. XML is used as its message format for communication. Since XML is language and platform independent SOAP web services facilitate communication between heterogeneous software components of an Enterprise Architecture. WSDL (Web services definition language) is used to describe the interface provided by the web service.
SOAP specification defines the messaging framework consisting the below:
- Processing model
- Extensibility model
- Underlying protocol binding framework
- Message construct
Processing Model
Below figure depicts the SOAP processing model
SOAP processing model describes how a SOAP message is passed on to its destination, i.e. Ultimate SOAP receiver, from the Initial Sender; SOAP nodes; SOAP message path and how a receiver processes the SOAP message. SOAP provides a distributed processing model and hence before reaching the final node it might also go through some intermediary nodes.
-
SOAP Nodes: A SOAP node can be the initial sender or ultimate receiver or the intermediary node which acts as both receiver and sender. The ultimate SOAP receiver has to process the SOAP message according to the processing model.
-
SOAP Actors and SOAP Nodes: In processing a SOAP message SOAP nodes are said to be acting as SOAP actors. These are identified by an URI known as the SOAP actor name. Purpose of the SOAP actor name is to identify the SOAP node.
-
SOAP Header Blocks: Header elements are optional and are added if there are any special requirements. For example, if the "Actor" attribute is specified in the header then it means that particular actor is going to perform some action on the SOAP message and then forward it to the next node. Digital signature can be specified for any password protected service. If the actor attribute is not specified then it is assumed that the ultimate SOAP receiver is the target node. If the "mustUnderstand" node is set to "true" then the header block is mandatory.
-
Process the SOAP messages as per the standards
Example:
Message Format:
SOAP message is an XML document containing the various elements as explained below:
-
Envelope: This field is mandatory in the XML document. Defines start and end of the message. Also, this is used to identify the XML document as a SOAP message.
-
Header: This field is optional. This part of the message contains header information.
-
Body: This field is mandatory. Contains body of the message comprising of call and other information needed for execution such as input parameters. The response body contains the relevant information needed by the SOAP client.
-
Fault: This is an optional field providing information about the exceptions occurred during processing of the message.
Below figure shows the SOAP fault example:
Advantages
- Platform independent
- Language independent
- Different transport protocols can be used. Standard stacks use HTTP but others such as SMTP can also be used.
- SOAP based web services are useful when below points are required:
- Asynchronous processing
- Reliability
- Stateful operations where state of the web service is needed in subsequent operations.
Disadvantages
- Slower than other middleware technologies because of verbose XML format used by SOAP
- There will be some firewall latency added as the firewall will analyse the HTTP transport. This is because the firewalls might not understand the difference between HTTP/Web browser and HTTP/SOAP
Hi SeetaRam,
I have written a small test case using seleinium web driver by following the videos in online using eclipse getting below error message
This is the test case I have written
package automation;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FirstTestCase {
public static void main(String[] args)
{
WebDriver driver=new FirefoxDriver();
}
}
While running I am getting error message as below
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:238)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:127)
at automation.FirstTestCase.main(FirstTestCase.java:11)
Not sure where I went wrong. Could you please assist me.
Also tell me what topics need to be covered in Java to write proper test case in Selenium
Hi Ramya,
The error message is not properly copied above. Can you please copy entire stack trace?