用戶點個按鈕如何與服務端交互?
發布的HTTP接口如何訪問數據庫等其他操作?
發布EJB接口,客戶端調用即可
# 1、public定義interface
```
package nc.app.itf;
import java.util.Map;
import nc.vo.pub.BusinessException;
/**
*
* @author Administrator
*
*/
public interface IAppRestService {
public Object doAction(String actionImpl ,Map params)throws BusinessException;
}
```
# 2、private實現interface
```
package nc.app.impl;
import java.util.Map;
import nc.app.itf.IAppRestService;
import nc.vo.pub.BusinessException;
public class AppRestServiceImpl implements IAppRestService {
public Object doAction(String actionImpl, Map params)
throws BusinessException {
return null;
}
}
```
# 3、 配置upm發布接口
tx="CMT" 表示啟用事物,"NONE" 表示不啟用事物
singleton="true" 表示單例 "false" 表示非單例
remote="true" 表示遠程組件
supportAlias="true" 表示支持別名
priority="0" 表示優先級為0
> 通常固定 配置 priority="0" remote="true" singleton="true" supportAlias="true" tx="CMT"
偶爾不需要事物 priority="0" remote="true" singleton="true" supportAlias="true" tx="NONE"
```
<public>
<component priority="0" remote="true" singleton="true" supportAlias="true" tx="CMT">
<interface>nc.app.itf.IAppRestService</interface>
<implementation>nc.app.impl.AppRestServiceImpl</implementation>
</component>
</public>
```

# 4、EJB部署重啟
一般eclipse 重啟項目中間件即可生效,不生效可重啟,檢查upm文件的name是否重復,有些NCHOME有BUG不寫**name="pu20220220"** 會被其他接口覆蓋,默認是取文件名為 **name** 可以不配置**name**
> module name="pu20220220"
