Web Services And APIs

 In progress


Webservices And API Integration Basics

-------------------------------------------------------------




Webservices :


Webservices are synchronous services. Because immediately we send the request, we get the response.


API (Application Program Interface)



In the above image, from the local system, we send a request to the API ( a program to calculate the addition) which is located in a remote server through HTTP.

In return, we get the response of the added value as part of the response over HTTP.API is nothing but a program that performed the requested task by taking the request value processing them and returning the response.


Requirement :

I have a .java application and also an application built with .net.i wanted to connect with each other. But they are two different applications built with different technologies. So to communicate with 2 different applications built in totally different languages is difficult to interact with.


we need a common set of standards or protocols defined so that we can easily communicate. We can integrate and loosely coupled two different applications. So web services come into the picture.

Then how to integrate? What should be a common way to integrate or interact?

So we XML (for soap)/ JSON as a common way to interact between the platforms.



What is an HTTP client?

This is the consumer which consumes web services. Click below link to reach at Java Doc to learn HTTP Client.

HTTP Client Java Dov


HTTP Client helps consume the web services from the producer.  It can be used to request HTTP resources over the network. It supports HTTP/1.1 and HTTP/2, both synchronous and asynchronous programming models, handles request and response bodies as reactive-streams, and follows the familiar builder pattern.



SOAP

We have a website that defines the API in form of  WSDL (XML or JSON).

We will install a tool POSTMAN.

Specify the URL first.

Will follow the WSDL and create a soap request. Need to select POST from the dropdown.

there are different tabs in postman as header, body .... etc. We need to specify all those things thereby following the WSDL mentioned on that website.

Then send your data to the URL of that website.


API Token : 

Click below to know about the Authentication token process for API.

API token


Note

Reactive Streams

New in 1.0.3 is that the JDK9 [adapter library] is included in the main jar.

Corresponding code artifacts are available on Maven Central:

<dependency>
  <groupId>org.reactivestreams</groupId>
  <artifactId>reactive-streams</artifactId>
  <version>1.0.3</version>
</dependency>
<dependency>
  <groupId>org.reactivestreams</groupId>
  <artifactId>reactive-streams-tck</artifactId>
  <version>1.0.3</version>
</dependency>
<dependency>
  <groupId>org.reactivestreams</groupId>
  <artifactId>reactive-streams-tck-flow</artifactId>
  <version>1.0.3</version>
</dependency>
<dependency>
  <groupId>org.reactivestreams</groupId>
  <artifactId>reactive-streams-examples</artifactId>
  <version>1.0.3</version>
</dependency>

#webservices
#integration
#webservicesandintegration
#wisdel
#api

Comments

Popular posts from this blog

Git Commands With Output Log

Java Interview Preparation (conceptual)

Java 8 Function Interface