Hi , Again we are discussing here how to write a webservice, i told you in the previous post that they are many ways you can the write the webservice it's all depends upon what kind of webservice you want.
Well we can write a simple java class with some business method and make that class as webservice that's what we have seen previously http://ayazroomy-java.blogspot.in/2013/07/writing-simple-webservice-using-eclipse.html .There we wrote a class and let eclipse to do all the stuffs such as creating wsdl with XML schemas and deployment in the server and other stuffs.
Now as i told you there are many ways to write a Webservice, Mention below are the approaches to write a webservice.
1. Bottom Up Approach
2. Top Down Approach
1. Bottom Up Approach:
The Bottom Up Approach can be define as :
Step1: Write a Java Class with Business Methods.
Step2: Generate wsdl and XML Schemas from the Java Class.
Step3: Deploy the Class as a Service once it is converted to webservice standard.
Step2 & Step3 can be done using tools and IDE such as Eclipse,NetBeans etc.
2. Top Down Approach:
Step1: Create the XSD or binding required for the WSDL.
Step2: Create the WSDL .
Step3: Generate the Java Class source and Binding Classes from the XSD and WSDL.
Step4 : Write your Business Logic in the Generated Classes so called Skeleton class.
Step5 : Deploy the Service.
Here Step1 & Step 2 are created based upon contract and policies such as government ,Banking,Insurance companies provides based upon that it is created.
To make the Step1 and Step2 to be successful one should be knowing clearly about the WSDL and XML Schema's and there namespace,policy ,WS-Standards,WS-Policy,WS-Security and all.
Step 3 is some what easier then Step1 & Step 2 the Java classes can be created using tools such as Axis2 or by using ID's as Eclipse,NetBeans etc.
Step4 and Step5 they have to done manually by the developer.
Both these approaches have advantages and disadvantages.
Integrity of the WSDL is assured
Useful for long running business critical service development
- Bottom Up Approach:
Easy to use. Simple and less time consuming
No need of in-depth knowledge on WSDL. Useful at development stage
Can be used to make Web services out of legacy systems.
Disadvantages:
Complex than Code First
Need a better understanding on WSDL
- Bottom Up Approach:
Can't guarantee the integrity of the WSDL
So it all depends upon what kind of business you are dealing with and what kind of service approach you want.I hate to say it but if you are going to create a webservice based upon the Top Down approach which need XML Schema and WSDL knowledge you can use the .NET WCF Blue Plug in which comes with Visual Studio 2010. It doesn't mean that you cannot create webservice with this approach in Java ,Yes we can do that Eclipse and NetBeans provides the facilities , but this WCF Blue gives you to create WSDL and XSD on fly.If you know .NET you can use this.
So coming to Our Topic i don't want to confuse more , i like to split the types of Web-services and how can we write them
1.SOAP :
In Java SOAP style webservice can be created using:
- JAX-WS API provided by J2EE .
- Using Simple Java class using eclipse
- Using Axis2 frame work (which has lot of stuff we will discuss in details about Axis2 in later part).
- Using Spring framework
2. REST :
In Java REST Style webservice can be created using :
- JAX-RS API Provided by J2EE.
- Using Jersey framework.
- Using Spring framework.
These are all some of the mostly used mechanisms to create webservice , there are lot of other ways also we can do that but this is sufficient to create any webservice .
In the next tutorial we will see how to create JAX-WS Style webservice with Bottom Up Approach.
Thanks for reading....
<<Previous Next>> Index>>
---------------------------------------------------------------------------------
Well we can write a simple java class with some business method and make that class as webservice that's what we have seen previously http://ayazroomy-java.blogspot.in/2013/07/writing-simple-webservice-using-eclipse.html .There we wrote a class and let eclipse to do all the stuffs such as creating wsdl with XML schemas and deployment in the server and other stuffs.
Now as i told you there are many ways to write a Webservice, Mention below are the approaches to write a webservice.
1. Bottom Up Approach
2. Top Down Approach
The Bottom Up approach we have seen already in the post writing simple webservice with eclipse. and In the next part we will see how to write a webservice using Bottom Up Approach with JAX-WS API Provided by J2EE .
The Bottom Up Approach can be define as :
Step1: Write a Java Class with Business Methods.
Step2: Generate wsdl and XML Schemas from the Java Class.
Step3: Deploy the Class as a Service once it is converted to webservice standard.
Step2 & Step3 can be done using tools and IDE such as Eclipse,NetBeans etc.
2. Top Down Approach:
The Top Down approach is little complicated.
Step1: Create the XSD or binding required for the WSDL.
Step2: Create the WSDL .
Step3: Generate the Java Class source and Binding Classes from the XSD and WSDL.
Step4 : Write your Business Logic in the Generated Classes so called Skeleton class.
Step5 : Deploy the Service.
Here Step1 & Step 2 are created based upon contract and policies such as government ,Banking,Insurance companies provides based upon that it is created.
To make the Step1 and Step2 to be successful one should be knowing clearly about the WSDL and XML Schema's and there namespace,policy ,WS-Standards,WS-Policy,WS-Security and all.
Step 3 is some what easier then Step1 & Step 2 the Java classes can be created using tools such as Axis2 or by using ID's as Eclipse,NetBeans etc.
Step4 and Step5 they have to done manually by the developer.
Both these approaches have advantages and disadvantages.
Advantages:
- Top Down Approach:
Can achieve better performance
Integrity of the WSDL is assured
Useful for long running business critical service development
- Bottom Up Approach:
Easy to use. Simple and less time consuming
No need of in-depth knowledge on WSDL. Useful at development stage
Can be used to make Web services out of legacy systems.
Disadvantages:
- Top Down Approach:
Complex than Code First
Need a better understanding on WSDL
Less performance
Can't guarantee the integrity of the WSDL
So it all depends upon what kind of business you are dealing with and what kind of service approach you want.I hate to say it but if you are going to create a webservice based upon the Top Down approach which need XML Schema and WSDL knowledge you can use the .NET WCF Blue Plug in which comes with Visual Studio 2010. It doesn't mean that you cannot create webservice with this approach in Java ,Yes we can do that Eclipse and NetBeans provides the facilities , but this WCF Blue gives you to create WSDL and XSD on fly.If you know .NET you can use this.
So coming to Our Topic i don't want to confuse more , i like to split the types of Web-services and how can we write them
1.SOAP :
In Java SOAP style webservice can be created using:
- JAX-WS API provided by J2EE .
- Using Simple Java class using eclipse
- Using Axis2 frame work (which has lot of stuff we will discuss in details about Axis2 in later part).
- Using Spring framework
2. REST :
In Java REST Style webservice can be created using :
- JAX-RS API Provided by J2EE.
- Using Jersey framework.
- Using Spring framework.
These are all some of the mostly used mechanisms to create webservice , there are lot of other ways also we can do that but this is sufficient to create any webservice .
In the next tutorial we will see how to create JAX-WS Style webservice with Bottom Up Approach.
Thanks for reading....
<<Previous Next>> Index>>
---------------------------------------------------------------------------------
blogs