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

xfire 做webservice总结

发布时间:2020-12-17 02:36:41 所属栏目:安全 来源:网络整理
导读:最近在一个项目中用了webservice做两个系统传输数据,对应数据传输的只是javabean。 一。先创建一个传输的javabean public class AtsEventIncident implements java.io.Serializable { ?// Fields ?/** ? * ? */ ?private static final long serialVersionUI

最近在一个项目中用了webservice做两个系统传输数据,对应数据传输的只是javabean。

一。先创建一个传输的javabean

public class AtsEventIncident implements java.io.Serializable {

?// Fields

?/**
? *
? */
?private static final long serialVersionUID = 8517650101550991383L;? //记得这个序列,如果不加这个就会出现传输的对象有问题



?private String belongSystem;

?private Date needResolveTime;

?private String oldBillNo;

?private String presenter;

。。。。。。

二。建立传输接口

public interface IAlertService {
? public String? sendItil(AtsEventIncident incident);
}

三。实现类,在实现类中用到了IIncidentService ,MwFormDao 。

public class AlertServiceImpl implements IAlertService{
?IIncidentService serv;
?MwFormDao dao;
?commonForm form;
? public String? sendItil(AtsEventIncident ats){
??//String urlStr="http://192.168.129.87:8089/itil/";
?? String urlStr =form.getUrlStr()+"&id=";
???? Incident incident=new Incident();
???? getIncidentData(ats,incident);
???? try {
???serv.createAlarmIncident(incident,"");
????urlStr=urlStr+incident.getId()+","+incident.getBillNo();
????? System.out.println("urlStr--->"+urlStr);
???} catch (Exception e) {
????// TODO: handle exception
???}
??return urlStr;
??
? }

三。新建一个services.xml,对应的目录是 src/xfire/META-INF/xfire

四。在spring配置文件中配置

<bean id="BbtForumService"??class="org.codehaus.xfire.spring.remoting.XFireExporter">??<property name="serviceFactory" ref="xfire.serviceFactory" />??<property name="xfire" ref="xfire" />??<property name="serviceBean" ref="alertServiceImpl" />??<property name="serviceClass"???value="com.thbs.interact.webService.IAlertService" />??<property name="name" value="IncidentService" />?</bean>?<bean id="alertServiceImpl"??class="com.thbs.interact.webService.impl.AlertServiceImpl">??<property name="dao" ref="mwFormDao" />??<property name="serv" ref="incidentService" />??<property name="form" ref="commonForm" />?</bean>

(编辑:李大同)

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

    推荐文章
      热点阅读