SERVER-SIDE DEVELOPMENT 1 SOAP

Web Applications

Web applications are defined by being interactive. You’re supposed to use a web application in order to perform a function and use some of the web applications features. Lots of web applications don’t even have real informative content or data exactly. People are just supposed to use them in order to perform additional tasks, using their features to accomplish something. You use a web application to check your incoming messages, for instance, or play a game.

The browser capabilities involved with web applications are significantly more high-tech, which is one reason why it’s usually harder for people to design a web application than a website. Websites are all about getting more data, and web applications are all about doing things. One of your actions is probably going to be getting more information or learning more information, but the web application helped you perform that action. You got the information from a website.

The user interface of a web application is also usually much more complicated than the user interface of a website. Websites might have tags and categories that you need to understand, but you don’t have to go through and learn any potentially complicated tasks in order to use websites. Web applications often require step-by-step guides, or you’re not going to be able to complete them.

The setup of websites are completely different from web applications in most cases. The rhythm of typing in the address, loading websites, and going back and forth between websites is often absent with web applications.

Web applications, unsurprisingly, are usually harder to design and create than websites. Lots of people have their own websites today, and this was the case even ten years ago. The people who are able to create their own web applications can more easily make money off of them because it takes more work to learn how to code and create a web application.

Web Services

Web service is a technology by which two or more remote web applications interact with each other over network/internet. It can be implemented using Java, .net, PHP etc. Web pages allow people to communicate and collaborate with each other while web services allow programs to communicate and collaborate with each other.

A web service is essentially a collection of open protocols and standards used for exchanging data between applications or systems. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Java and Python, or Windows and Linux applications) is due to the use of open standards (XML, SOAP, HTTP).

All the standard Web Services works using following components:

  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)

It works somewhat like this:

  • The client program bundles the account registration information into a SOAP message.
  • This SOAP message is sent to the Web Service as the body of an HTTP POST request.
  • The Web Service unpacks the SOAP request and converts it into a command that the application can understand.
  • The application processes the information as required and responds with a new unique account number for that customer.
  • Next, the Web Service packages up the response into another SOAP message, which it sends back to the client program in response to its HTTP request.
  • The client program unpacks the SOAP message to obtain the results of the account registration process.
Web Application Web Services User-to-program interaction
User-to-program interaction Program-to-program interaction
Static integration of components Dynamic integration of components
Monolithic service Interoperability

What is WSDL

A simple WSDL page

The WSDL describes services as collections of network endpoints, or ports. The WSDL specification provides an XMLformat for documents for this purpose. 
WSDL is often used in combination with SOAP and an XML Schema to provide Web services over the Internet. A client program connecting to a Web service can read the WSDL file to determine what operations are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the operations listed in the WSDL file using for example XML over HTTP.

Since WSDL files are an XML-based specification for describing a web service, WSDL files are susceptible to attack.[6] To mitigate vulnerability of these files, limiting access to generated WSDL files, setting proper access restrictions on WSDL definitions, and avoiding unnecessary definitions in web services is encouraged.

  • WSDL is used for describing the services available. Primarily used for business to communicate with clients.
  • WSDL is a language for describing how to interface with XML-based services.
  • UDDI uses WSDL as its language

Structure of a WSDL

WSDL is usually taken to describe the available services which it has. The file contains

  • The location of the web service
  • The methods given by the web service.

The main structure is

  • Definition
  • TargetNamespace
  • DataTypes
  • Messages
  • Porttype
  • Bindings
  • service

Elements of a WSDL file

ElementDescription
<message> Defines the data elements for each operation
<portType>
Describes the operations that can be performed and the messages involved.
<binding> Defines the protocol and data format for each port type
<types> Defines the (XML Schema) data types used by the web service

 void addOperation(Operation operation)  Add an operation to this port type.
org.w3c.dom.Element getDocumentationElement() Get the documentation element.
 Operation getOperation(java.lang.String name, java.lang.String inputName, java.lang.Strig outputName) 
          Get the specified operation.
 java.util.List getOperations() Get all the operations defined here.
 QName getQName() Get the name of this port type.
 boolean isUndefined() 
           
 void setDocumentationElement(org.w3c.dom.Element docEl)Set the documentation element for this document.
 void setQName(QName name)Set the name of this port type.
 void setUndefined(boolean isUndefined) 

portType

  • PortType is an abstraction part of WSDL.
  • An abstract set of operations supported by one or more endpoints.

binding

  • Binding is an concrete part of WSDL.
  • Describes how the operation is invoked by specifying concrete protocol and data format specifications for the operations and messages.

SOAP Binding:
SOAP binding allows either document or rpc style with either encoding or literal. Encoding indicates how a data value should be encoded in an XML format (These rules specify how “something” is encoded/serialized to XML and then later decoded/de-serialized from XML back to “something”). Literal means that the data is serialized according to a schema (this is just plain XML data).

HTTP GET & POST binding:

WSDL includes a binding for HTTP 1.1’s GET and POST verbs in order to describe the interaction between a Web Browser and a web site.

MIME binding

WSDL includes a way to bind abstract types to concrete messages in some MIME format.

Simple Object Access Protocol or SOAP is used as the messaging protocol. This is used to exchange data over networks. HTTP is an application protocol and SOAP resides in this HTTP protocol as the HTTP payload.

SOAP is encoded as an XML document, these are the elements used in the structure of the SOAP messages.

Element Description
Envelope Identifies the XML document as a SOAP message
Header Contains header information
Body Contains call, and response information.
Fault Provides information about errors that occurred while processing the message

A SOAP message package contains the primary SOAP message in XML format as well as other entities in any data format (for example, gif, jpg, xml, etc.) that are not in defined in the SOAP envelope but are related to the message. As shown in the figure to the right the SOAP message package is constructed using MIME’sMultipart/related media type with each part embedded within a MIME boundary (defined in the Context-Type header). Each MIME part has header information such as Context-Type that specifies the type of the data embedded in this MIME part, Content Transfer-encoding to specify the encoding used for this MIME part, and Content-ID and/or Content-Location as an identifier to refer this content from any where in the MIME package. The root part of the MIME message contains the SOAP envelope with Content-Type set to text/xml .

Some of the annotations in JAX-WS, providing examples

@WebService

This JAX-WS annotation can be used in 2 ways. If we are annotating this over a class, it means that we are trying to mark the class as the implementing the Web Service, in other words Service Implementation Bean (SIB). Or we are marking this over an interface, it means that we are defining a Web Service Interface (SEI), in other words Service Endpoint Interface.

@SOAPBinding

This annotation is used to specify the SOAP messaging style which can either be RPC or DOCUMENT. This style represents the encoding style of message sent to and fro while using the web service.

@WebMethod

@WebMethod JAX-WS annotation can be applied over a method only. This specified that the method represents a web service operation. For its demonstration

The @Path Annotation

Now, the URI to the book resource is /api/books and the URL would be http://localhost:8080/webcontext/api/books.&nbsp;It is the convention to name the resource as a noun and in the plural.

@POST HTTP Method Annotation

The POST HTTP method is commonly used to create a resource. This example code persists the new book object in the database.

REFERENCES

https://en.wikipedia.org/wiki/Web_application

https://www.tutorialspoint.com/webservices/what_are_web_services.htm

https://www.tutorialspoint.com/wsdl/wsdl_introduction.htmhttps://www.w3schools.com/xml/xml_wsdl.asp

https://www.quora.com/What-is-the-difference-between-web-service-and-web-application

https://www.w3.org/TR/2007/REC-wsdl20-20070626/

https://www.ibm.com/support/knowledgecenter/SSQ2R2_14.0.0/com.ibm.etools.est.doc/concepts/csfdef001.html

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close