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>

相关文章

1.使用ajax调用varxhr;functioninvoke(){if(window.ActiveXO...
               好不容易把WebService服务器...
1新建一个工程项目用来做服务端增加一个MyService1类文件pac...
packagecom.transsion.util;importjava.io.BufferedReader;i...
再生产wsdl文件时重写描述文件1usingSystem;2usingSystem.Co...
一般情况下,使用eclipse自带的jax-ws生成webservice会自动生...