A Brief Description about Web Services
Web Services:
---------------------------
Why we need to go with Webservices?
A: WebServices is one of the Distributed Technology like EJB and RMI.
Problem with EJB and RMI:
-------------------------
-->Language Dependent
-->Robust
-->Heavy Weight
Benefits with WS:
---------------------
WS is Interoperable which means Language Independent and Platform Independent and
provide Enterprise services like other technologies EJB and RMI.
WS flow:
------------
For Example what we need for communication b/w two persons?
like we need
--> Two persons
--> Medium
--> Language
--> Rules (protocol).
like that if two applications need to communicate we need
--> Consumer : which consumes(using) the services
--> Provider : Service provider
--> protocaol : HTTP, FTP and SMTP. ( In internat world we prefer HTTP)
--> Language : XML
--> Medium : both applications should be connected (network).
So the final conclusion is:
"The Consumer will send XML to communicate with Provider over HTTP protocol".
The information or request data should be like
--> Processing information/Authentication information.
--> Business information
For Example
<employee>
<id>E1630</id>
<pwd>*****</pwd>
<name>Brahmaiah</name>
<sal>22000</sal>
</employee>
So to achieve the authentication and business information we will go for SOAP.
SOAP:
---------------------
--> SOAP stands for "Simple Object Access Protocol".
--> SOAP is binding protocol (processing data + business data).
--> But what services are providing by the provider should be explined,to know the services of the Provider,
Consumer can't look into the Provider's code.
--> So Consumer needs the information like
what are the services are providing?
what they will take as input?
what the output they will return?
what url has to call to get the Services?
--> So Procider will explain all these information in one file called WSDL.
WSDL:
----------
--> WSDL stands for "Web Service Description Language".
--> WSDL is an XML document bcos it should be language indepedent any client can understand the services of the Provider.
--> SO WSDL is the document which explains services information, But how can consumer get the WSDL doc and from where?
--> So WSDL document can place in some lacation which Consumer can access them,that location is called UDDI.
UDDI:
-----------
--> UDDI stands for "Universal Description Discovery and Integration".
--> UDDI is the registry where all the WSDl documents resides.
--> UDDI should be interoperable, so it is also developed in XML.
--> UDDI registry also called as XML registry.
what is WS-I?
-------------
--> The WS-I (Web Services Interoperbility) organisation is an association of it industries like
IBM and Microsoft and aim is to provide Web Srvices Specification.
--> Standards given by WS-I to implement Web Services are
Basic Profile 1.0(BP 1.0)
Basic Profile 1.1(BP 1.1)
Basic Profile 2.0(BP 2.0)
Web Services:
---------------
--> Web Services is s/w appllication that confirms the WS-I given specifications.
--> Any program that is distributed in nature, Language Independent and plot form neutral is said to be WebService.
there are so many APIs, implementations for WS-I Standards
Sun has released "JAX-RPC" API for BP 1.0
"JAX-WS" API for BP 1.1
JAX-RPC : Java API's for XML-based Remote Procedure call.
JAX-WS : JAva API for XML webservices
JAX-P : JAva API for XML Processing
JAX-B : JAva Architecture for XML Binding
JAX-R : JAva API for XML Registries
SAAJ : SOAP with Attachments API for java
--> We can use the JAX-P and JAX-B on Consumer side
--> JAX-WS and JAX-RPC on Provicer side
--> JAX-R on UDDI side
--> SAAJ on SOAP side.
Specification From(WS-I) API(from Sun) Implementation from (diff Companies)
------------------------ ------------------- --------------------------------------
BP 1.0 JAX-RPC JAX-PRC-SI(from Sun)
Apache Axis( from ASF)
BP 1.1 JAX-WS JAX-WS-RI (from Sun) --failed to access by .Net
Apache Axis2 (from ASF)
Metro (fro Sun)
CXF(from ASF).(internally using Spring)
NOte : JAX-WS-RI (from Sun) --failed to access by .Net.means failed in Interoperability. So Sun
released "MEtro" Implementation to overcome.
Wed Services Development:
---------------------------
WS Dev can done in two ways
1)Contract first(top-down) approach------- (WSDL-->Services)
2)Contract last(bottom-up) approach-------(Services--> WSDL)
--> Services can develop using any tech's like .Net, java, php and etc.
--> In java Services can develop using any API like JAX-RPC, JAX-WS, RESTFUL.. etc using
any implementations like Sun and Apache.
--> so We can develope
JAX-RPC contract-first approach
JAX-RPC contract-last approach
HTTP protocol Implemented API's
-----------------------------------
--> Servlet API
--> EJB API
End Point:
------------
-->In general Endpoint is a component which receives Consumers request.
--> We use either Servlet or Ejb as an Endpoint.
SO we can say we are developing webservices using
1) JAX-RPC, Servlet endpoint url, Contract first approach
2) JAX-RPC, EJB endpoint url , Contract last
MEP:
--------
MEP stands for "Message Exchanging Patterns".
Consumer can communicate with Provider in 3 ways
1)Synchronous request-reply: Consumer sends the request to the Provider, and Consumer blocks until response comes back from
the provider(it can't proceed further).
2)Asynchronos request-reply : In this Consumer sends the request to the provider and it won't wait for response from Provider and continues
the flow of execution and Consumer will maintain a "Response Listner" which listens response form the Provider.
3)Fire and Forget : Consumer sends the request to the Provider, and consumer will not wait until gets response and it won't bather about
the response.
SO we can say we are developing webservices using
1) JAX-RPC, Servlet endpoint url, Contract first approach Synchronous request-reply
2) JAX-RPC, Servlet endpoint url, Contract first approach Asynchronous request-reply
3) JAX-RPC, Servlet endpoint url, Contract first approach Fire and Forget.
MEF:
-----------
--> MEF stands for " Message Exchanging Formats".
--> Provider can exchange the information using 3 Message Exchanging Formats
1) document-literal
2) rpc-literal
3) rpc-encoded (dafault MEF)
Note:literal means UTF-8 , 16 like that
Consumer and Provider Communication:
-----------------------------------------
Client Object----->Stub--------->Network---------->Skeleton--------->Service Object
Server Object side requirements:
1) Interface for Service Object
2) Service Object
3) Skeleton
Client side requirements:
1)Interface for Service Object
2)Stub
Stub :
----------------
--> Stub is a cilent side proxy for Service object
--> Stub is a java object that implements the same interface which the service object implements
--> Stub is a client socket program which is generated by tools.
Functions by Stub:
---------------------
--> client makes a method call on stub
--> performing marshalling of the i/p args.
--> passing the method call to the skeleton
--> receiving result form skeleton
--> Unmarshalling result frok skeleton
--> return unmarshalled result to the client
Skeleton:
----------------
--> Skeleton is server side proxy for the service object
--> Skeleton is a server socket program and generated by tools.
Functions of Skeleotn:
----------------------
--> receiving method call from the stub
--> unmarshalling mehtod i/p args
--> invoking actual menthod call on the Service object
--> receiving result from the Service object
--> marshalling the result
--> returning the marshalled result to the stub.
Comments
Post a Comment