Saturday, February 23, 2013

Java WebSerivces Tutorial - Part 01


Java Web Services:

What is a web service?
A web service is a service which is available over internet use a standardized xml messaging system and is not tied to any operating system.

Main purpose of web service:

The business logic can be written once it can be accessed from various User Interface of different operating systems and different devices. Such as Mobile, Computers, etc.

Main Component of Web service :(XML)
The main advantage that a web service provides by means of XML.XML can be accessed and viewed from different Interface without worrying about platform or operating system.
Ex: A web service written in Java can be accessed by a .Net or Perl Client by XML (request & response) vice versa.

In Java they are variety of ways from which we can create, deploy and access web service.
We will be seeing the below concepts:


I.   Basics of Web service:
a.       Web Service Architecture
b.      Basic flow of Web service
c.       SOAP
d.      WSDL
e.       UDDI


II. Java way of handling web services:

a.       JAX-WS  ( Java web service API)
b.      JAX-RPC (Java remote procedure call)
c.       JAXP (Java Parsing API)
d.      JAXM (Java Messaging API)
e.       JAXB (Java XML Binding API)          
f.       JAXR (Java Metadata Registry API)
g.      JAX-RS (Java Restful Services)


They Beginning part would be more concept wise it would be boring but it is important to understand these terminologies.
 

  a. Web Service Architecture :


They are two ways to examine the Web Service Architecture they are:

-          Examining individual role of a each webservie actor
-          Web Service protocol stack

 Roles of Web service :


 It has three components :

Service provider
This is the provider of the web service. The service provider implements the service
and makes it available on the Internet.

Service requestor
This is any consumer of the web service. The requestor utilizes an existing web
service by opening a network connection and sending an XML request.

Service registry
This is a logically centralized directory of services. The registry provides a central
place where developers can publish new services or find existing ones. It therefore
serves as a centralized clearinghouse for companies and their services.

Web Service protocol stack :

They web service protocol stack is still evolving .

It has four main layers

Service Transport :


This layer is responsible for the transporting of Message between Applications currently have HTTP,SMTP,FTP,BEEP.

XML Messaging :


Responsible for encoding message in a common xml format that message can be understood by either end .includes XML-RPC and SOAP.

Service description
This layer is responsible for describing the public interface to a specific web service.
Currently, service description is handled via the Web Service Description Language
(WSDL).

 Service discovery
This layer is responsible for centralizing services into a common registry, and
providing easy publish/find functionality. Currently, service discovery is handled
via Universal Description, Discovery, and Integration (UDDI).
As web services evolve, additional layers may be added, and additional technologies may
be added to each layer.

   b. Basic flow of Web service :


To understand the basic flow we must know this term
SOAP, WSDL, UDDI [We will see in detail about these in later part as for know we will see what is what]

SOAP : Simple Object Access protocol .It is a XML based protocol for exchanging information .It can be used along with variety of protocol  such as HTTP,FTP etc along with various operating system.
Given below is  the simple request & response obtain from a web service created by JAX-WS technique in java. We will cover in detail about JAX-WS in later part.

package test;
import java.util.InputMismatchException;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService()
public class ss {
    @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "input")   // Method name hello accept a String      Paramter
    String input) {
        return input;
    }
}
After deploying this business method .We checks the request and response.

EX : SOAP REQUEST
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns0:hello xmlns:ns0="http://test/">
            <input>Hello World</input>
        </ns0:hello>
    </soap:Body>
</soap:Envelope>

EX: SOAP RESPONSE
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns0:helloResponse xmlns:ns0="http://test/">
            <return>Hello World</return>
        </ns0:helloResponse>
    </soap:Body>
</soap:Envelope>

WSDL :

-          Web Service Description Language.
-          It is a web grammar of specifying a public interface of web service. This public interface can include information on all publicly available functions, data type information for all XML messages, binding information about the specific transport protocol to be used, and address information for locating the specified Service.
-          WSDL is not necessarily tied to a specific XML messaging system, but it does include built-in extensions for describing SOAP services.


UDDI :

-          UDDI currently represents the discovery layer within the web service protocol stack.
-          UDDI was originally created by Microsoft, IBM, and Ariba, and represents a  technical specification for publishing and finding businesses and web services.
-           UDDI consists of two parts. First, UDDI is a technical specification for building a distribute directory of businesses and web services. Data is stored  within a specific XML format. The UDDI specification  includes API details for searching existing data and publishing new data.
-          Second, the UDDI Business Registry is a fully operational implementation of the UDDI  specification.
  
Accessing a Web Service: Service Requester Perspective 
 Find a Web service from UDDI
 Retrieve WSDL or XML-RPC human Instructions
Create a XML-RPC or SOAP Client
Invoke Remote Procedure Call

Creating a Web service: Service Developer Perspective 

                       
   Find the business functionality(business logic)

   Create a XML-RPC or SOAP Service Wrapper

   Create a WSDL or XML RPC Instructions

   Deploy Service

   Register new service via UDDI
                      

In my next post i will be covering in detail about Soap and other parts of Web service basics. so stay tuned and thanks for reading  and please comment your feedback.

                                              Index                                         Next >>     
                             
                                ----------------------------------------------------------------------------
          



Technology Blogs
blogs

35 comments:

  1. Very nice and helpfull tutorial... its very easy to understand.. keep up the good work...

    waiting for the next article in this series..

    ReplyDelete
  2. nice tutorial to understand the basic structure . . .waiting for the next article on Webservice...

    ReplyDelete
  3. very nice tutorial. i need this tutorials in a pdf / document file. please reply to my mail id senthilmurugangsm@gmail.com.

    ReplyDelete
  4. Very simple & easy to understand. Covers much information in a single document than other tutorial on some popular websites. Thanks for sharing such a good article.

    ReplyDelete
  5. great tutorial ... keep do it I'm your fan.

    ReplyDelete
  6. Ahaa, its good dialogue on the topic of this paragraph at this place
    at this blog, I have read all that, so at this time me also commenting here.


    Also visit my blog Beats Monster

    ReplyDelete
  7. Hey! I realize this is somewhat off-topic however I had to ask.
    Does running a well-established website such as yours take a lot of work?
    I am brand new to writing a blog however I do write in my journal everyday.
    I'd like to start a blog so I can share my personal experience and views online.
    Please let me know if you have any kind of ideas or tips for
    new aspiring blog owners. Appreciate it!

    My web blog - work at home jobs in pa

    ReplyDelete
  8. Hurrah! Finally I got a weblog from where I know how to actually get helpful facts
    concerning my study and knowledge.

    Also visit my weblog: Louis Vuitton Bags

    ReplyDelete
  9. I'm gone to inform my little brother, that he should also
    go to see this website on regular basis to obtain updated
    from most up-to-date information.

    My blog post ... purchase twitter followers

    ReplyDelete
  10. Hello, Neat post. There is a problem along with your web site in web explorer, would check
    this? IE nonetheless is the marketplace leader and a large portion of
    other folks will pass over your great writing due
    to this problem.

    Feel free to visit my web blog :: Christian Louboutin Heels

    ReplyDelete
  11. You should be a part of a contest for one of the greatest sites online.
    I most certainly will highly recommend this site!

    My homepage; Christian Louboutin

    ReplyDelete
  12. These are really great ideas in regarding blogging.
    You have touched some pleasant points here. Any way keep up wrinting.


    My web-site - Louis Vuitton Replica

    ReplyDelete
  13. Heya! I realize this is sort of off-topic however I had to ask.
    Does managing a well-established blog such as yours take a lot of work?
    I'm brand new to blogging but I do write in my journal every day.
    I'd like to start a blog so I will be able to share my own experience and feelings online.

    Please let me know if you have any kind of suggestions or tips
    for new aspiring blog owners. Appreciate it!

    Here is my page :: Discount Christian Louboutin

    ReplyDelete
  14. Greetings from California! I'm bored to death at work so
    I decided to browse your blog on my iphone during lunch
    break. I really like the information you provide here
    and can't wait to take a look when I get home. I'm surprised at how fast your
    blog loaded on my phone .. I'm not even using WIFI, just 3G ..
    Anyhow, great blog!

    Here is my weblog; Christian Louboutin

    ReplyDelete
  15. Hello to all, the contents present at this web page are actually amazing for
    people knowledge, well, keep up the good work fellows.


    my site; Cheap Christian Louboutin

    ReplyDelete
  16. Heya this is kind of of off topic but I was wanting to
    know if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I'm starting a blog soon but have no coding experience
    so I wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

    my weblog law enforcement motorcycle pants

    ReplyDelete
  17. When some one searches for his essential thing, thus he/she wishes to be available that in detail, so that thing is maintained over here.


    My web site; sports betting lawsuit lesniak and christie

    ReplyDelete
  18. Nice blog, here I had an opportunity to learn something new in my interested domain of java. I have an expectation about your future post so please keep updates.JAVA Course in Chennai

    ReplyDelete
  19. Thanks for sharing the information. It is very useful for my future. keep sharing
    baixar facebook
    baixar whatsapp
    unblocked games

    ReplyDelete
  20. Thanks a lot ! I also share java codes on my blog if you want to check it out: http://berksoysal.tk

    ReplyDelete
  21. Nice post. Very useful information. I really thankful for this post. Keep posting. best java classes in pune

    ReplyDelete
  22. I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog. 
    rpa training in bangalore
    best rpa training in bangalore
    RPA training in bangalore
    rpa course in bangalore
    rpa training in chennai
    rpa online training

    ReplyDelete
  23. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.
    Devops Training courses
    python Training in chennai
    Devops Training in Bangalore

    ReplyDelete
  24. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

    AWS TRAINING IN BTM LAYOUT | AWS TRAINING IN BANGALORE
    AWS Training in Marathahalli | AWS Training in Bangalore

    ReplyDelete
  25. You made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us
    python Online training in chennai
    python Online training in bangalore
    python interview question and answers

    ReplyDelete
  26. I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing..
    Believe me I did wrote an post about tutorials for beginners with reference of your blog. 




    Selenium training in bangalore
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete
  27. Thanks for sharing detail this blog...any student more information visit here
    Java Training in Delhi

    ReplyDelete
  28. Nice Article. Thanks for sharing such useful information.

    ReplyDelete
  29. Thank you so much for sharing this amazing post..The post is too useful and constructive and also i have try this in my website. please read more, I am a new blogger. i have a blog i will refer back to this site for steps and tips.

    ReplyDelete