博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Use Axis2 develop WebServices in Eclipse
阅读量:6677 次
发布时间:2019-06-25

本文共 3014 字,大约阅读时间需要 10 分钟。

Axis2, what's that?
At first, we should pay enough sight to Axis2, as which home page say that "
Apache Axis2 is the
 core engine for Web services. It is a complete re-design and re-write of the widely used Apache Axis
 SOAP stack."
 
And this describe
" Apache Axis2 not only supports SOAP 1.1 and SOAP 1.2, but it also has integrated support for the widely popular 
REST style of Web services . The same business logic implementation can offer both a WS-* style interface as well as a 
REST/POX style interface simultaneously.
 
 Apache Axis2 is more efficient, more modular and more 
XML-oriented than the older version. It is carefully designed to support the easy addition of plug-in "modules" that extend their functionality for features such as 
security and 
reliability. "
 
More info can find in
Ok, let's show we case of this cool tool, please allow me call she like this.
 
Case
Here we will implement an CalculateService, which include plus,minus,multiply and divide method.
And we use axis2 1.4.1 to deploy as an Web service.
 
Follow me, let's do it!
 
setp one
Before you do it, you should download axis2 1.4.1 from 
 
download this version named "
axis2-1.4.1-bin.zip", then unzip it to some dirctory, here i use "
E:\Java_dev\axis2-1.4.1".
 
setp two
Setting your eclipse's webservices "
axis2 preferences" item, set which runtime to 
E:\Java_dev\axis2-1.4.1, and now the whole setting is over, next setp is to make this CalculateService.
 
setp three
create an java project, and create an java class named CalculateService, code detail like this
package rong.service; 


/** 
*    
* @author daniel zhou 
* 2009-07-22 
*/
 

public 
class CalculateService { 


  
/** 
    * plus 
    * @param x 
    * @param y 
    * @return 
    */
 

  
public 
float plus(
float x, 
float y) { 

    
return x + y; 

  } 


  
/** 
    * minus 
    * @param x 
    * @param y 
    * @return 
    */
 

  
public 
float minus(
float x, 
float y) { 

    
return x - y; 

  } 


  
/** 
    * multiply 
    * @param x 
    * @param y 
    * @return 
    */
 

  
public 
float multiply(
float x, 
float y) { 

    
return x * y; 

  } 


  
/** 
    * divide 
    * @param x 
    * @param y 
    * @return 
    */
 

  
public 
float divide(
float x, 
float y) { 

    
return x / y; 

  } 



}
 
setp four
When service is over, now we will create it as an web service,
select project and new an other, select "web services".
Attention:
  • In "Sevice implementation" should locate to your just create java class.
  • select your web container (must select runtime to axis2) and select at "start service" point.
  • client type selct web container (must select runtime to axis2)  and "test client" point 
then "next", if you want to create client serive, ok, choose it and next, then all is setting over, start server!
 
Then you will find in you jboss's deploy dirctory, two ear package have been deployed!
 
if you intersted in it, can open ear and have a look.
 
setp five
when server is started, which will open an browser, in which window, it have some test for you to do, like set x=2, and y=33, and click "go" button, the reslut will be show 35 to you!
It cool!
 
Ok, do by yourself, good luck!
    本文转自danni505 51CTO博客,原文链接:http://blog.51cto.com/danni505/181891,如需转载请自行联系原作者
你可能感兴趣的文章
自己封装的数据通信服务组件DotNet.ServiceModel
查看>>
Docker创建虚机和swarm
查看>>
JSON入门学习
查看>>
一个很好的UML工具
查看>>
[转]无需看到你的脸就能认出你——实现Beyond Frontal Faces: Improving Person Recognition Using Multiple Cues...
查看>>
函数Curry化
查看>>
二进制补码,原码,反码和移码
查看>>
Default Constructor 的建构操作
查看>>
函数中的不定长参数研究 *and**
查看>>
hive如何执行mr
查看>>
马士兵hadoop2.7.3_yarn笔记
查看>>
python自编程序实现——robert算子、sobel算子、Laplace算子进行图像边缘提取
查看>>
Extjs5项目进行中:打开新面板并加载数据(三)
查看>>
2012年8月14日 星期二 equals()方法 (冲突备份)
查看>>
20本最好的Linux免费书籍-转
查看>>
敏捷开发的艺术---第一章
查看>>
jQUery事件
查看>>
测试及等等
查看>>
JAVACard 基本数据类型的运算及溢出问题
查看>>
通过Python来操作kylin
查看>>