xfire 做webservice总结

最近在一个项目中用了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>

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值