XFire可以很好的集成到SPRing中,Spring的代碼已經做了這方面的集成。
首先,我們先創建我們的Web服務,采用接口和實現類的方式:
接口MathService.java:
package com.kuaff.xfire.samples;
public interface MathService
{
public long add(int p1, int p2);
}
實現類:
package com.kuaff.xfire.samples;
public class MathServiceImpl implements MathService
{
public long add(int p1, int p2)
{
return p1 + p2;
}
}
META-INF/xfire/service.xml文件可以省略了,因為web服務的定義在xfire-servlet.xml中可以找到。
新聞熱點
疑難解答