现在的位置: 首页 > 综合 > 正文

MyEclipse创建WebService

2013年11月19日 ⁄ 综合 ⁄ 共 643字 ⁄ 字号 评论关闭

使用Eclipse的话还要装web tool platform很多东西,用MyEclipse一步到位,创建WebService很方便。

MyEclipse中有自己的Tomcat,要把事先在电脑上独立安装的Tomcat关掉。

1.File->New->Web Service Project

Project Name取为webservice,Framework使用XFire

下一步使用默认配置即可。

勾上HTTP Client Library

选择Yse即可。MyEclipse8.6使用的JDK最高版本是5,而我本机上已经装到6了

2.在src下添加一个包org.demo.webservice,再添加一个接口IAdd,和一个类Add

?
1
2
3
4
5
6
package org.demo.webservice;
 
public interface IAdd
{
 
    public abstract int add(int num1,int num2);
}
?
1
2
3
4
5
6
7
8
package org.demo.webservice;
 
public class Add
implements IAdd{
 
    public int add(int num1,int num2){
        return num1+num2;
    }
}

3.配置webservice包下面的services.xml。

?
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=

抱歉!评论已关闭.