加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Use Axis2 develop WebServices in Eclipse

发布时间:2020-12-17 02:11:19 所属栏目:安全 来源:网络整理
导读: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 thi
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
  • http://ws.apache.org/axis2/index.html
  • http://wso2.org/library/1719
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 http://ws.apache.org/axis2/index.html
?
download this version named "axis2-1.4.1-bin.zip",then unzip it to some dirctory,here i use "E:Java_devaxis2-1.4.1".
?
setp two
Setting your eclipse's webservices "axis2 preferences" item,set which runtime to E:Java_devaxis2-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!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读