xfire的webservice示例

阅读更多
1、首先将xfire需要的jar包上传的项目中。
xfire的webservice示例_第1张图片

项目的结构图:
xfire的webservice示例_第2张图片

2、在web.xml文件中配置xfire信息



	
		XFireServlet
		
			org.codehaus.xfire.transport.http.XFireConfigurableServlet
		
	
	
		XFireServlet
		/servlet/XFireServlet/*
	
	
		XFireServlet
		/services/*
	
	
	
		com.fysh.listener.PropListener
	



代码中配置了一个监听器,我使用监听器加载jdbc的信息保存在内存中。
3、定义接口并实现
package com.fysh.service;

public interface FyshService {
	
	/**
	 * 门诊审核信息
	 * @param xml_mz_ycxx
	 * @return
	 */
	public String upload_mz_ycxx(String xml_mz_ycxx);
	
	/**
	 * 住院审核信息
	 * @param xml_zy_ycxx
	 * @return
	 */
	public String upload_zy_ycxx(String xml_zy_ycxx);
	
	/**
	 * 门诊信息反馈
	 * @param xml_mz_ycxx
	 * @return
	 */
	public String download_mz_ycxx(String xml_mz_ycxx);
	
	/**
	 * 住院信息反馈
	 * @param xml_zy_ycxx
	 * @return
	 */
	public String download_zy_ycxx(String xml_zy_ycxx);
	
	
	/**
	 * 阀值信息
	 * @param xml_mz_fzxx
	 * @return
	 */
	public String download_fzxx(String xml_fzxx);
	
}

接口的实现类
package com.fysh.service.impl;

import java.util.Map;

import com.fysh.dao.FyshDao;
import com.fysh.service.FyshService;

public class FyshServiceImpl implements FyshService {
	
	

	/**
	 * 获取门诊审核反馈信息
	 */
	public String download_mz_ycxx(String xml_mz_ycxx) {
		String resXml="";
		FyshDao dao = new FyshDao();
		Map resMap = dao.getMzYcxx(xml_mz_ycxx);
		for (String key : resMap.keySet()) {
			resXml = resXml +"<"+key+">"+resMap.get(key)+"";
		}
		resXml = resXml + "";
		return resXml.toLowerCase();
	}

	/**
	 * 获取住院审核反馈信息
	 */
	public String download_zy_ycxx(String xml_zy_ycxx) {
		String resXml="";
		FyshDao dao = new FyshDao();
		Map resMap = dao.getZyYcxx(xml_zy_ycxx);
		for (String key : resMap.keySet()) {
			resXml = resXml +"<"+key+">"+resMap.get(key)+"";
		}
		resXml = resXml + "";
		return resXml.toLowerCase();
	}
	
	/**
	 * 提交门诊审核信息
	 */
	public String upload_mz_ycxx(String xml_mz_ycxx) {
		String resXml="";
		FyshDao dao = new FyshDao();
		boolean resFlag = dao.saveMzYcxx(xml_mz_ycxx);
		resXml = resXml+resFlag +"";
		return resXml.toLowerCase();
	}
	
	/**
	 * 提交住院审核信息
	 */
	public String upload_zy_ycxx(String xml_zy_ycxx) {
		String resXml="";
		FyshDao dao = new FyshDao();
		boolean resFlag = dao.saveMzYcxx(xml_zy_ycxx);
		resXml = resXml+resFlag +"";
		return resXml.toLowerCase();
	}
	
	/** 
	 * 获取阀值信息
	 */
	public String download_fzxx(String xml_fzxx) {
		String resXml="";
		FyshDao dao = new FyshDao();
		Map resMap = dao.getFzxx(xml_fzxx);
		for (String key : resMap.keySet()) {
			resXml = resXml +"<"+key+">"+resMap.get(key)+"";
		}
		resXml = resXml+"";
		return resXml.toLowerCase();
	}

}


4、调用的类
XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());
		Client client = new Client(new URL("http://localhost:8080/fysh_webservice/services/fysh?wsdl"),FyshService.class);
 String xml_zy_fk="31011411734534532";
	   System.out.println(((FyshService)factory.create(client)).download_zy_ycxx(xml_zy_fk));
  • xfire的webservice示例_第3张图片
  • 大小: 23 KB
  • xfire的webservice示例_第4张图片
  • 大小: 23.8 KB
  • 查看图片附件

你可能感兴趣的:(xfire的webservice示例)