zoukankan      html  css  js  c++  java
  • xfire调用示例

    xfire调用简单示例。

    import java.util.HashMap;
    import org.codehaus.xfire.XFireFactory;
    import org.codehaus.xfire.client.XFireProxyFactory;
    import org.codehaus.xfire.service.binding.ObjectServiceFactory;
    import org.codehaus.xfire.transport.http.CommonsHttpMessageSender;
    
    public class TestXfireCaller {
    	
    	private String ip = "1.1.1.1";
    	private String param1 = "111";
    	private String param2 = "222";
    	private String param3 = "S-Revcore-uncertify";
    	private int param4 = 5;
    	private MsgDeliveryService msgDeliveryService;
    
    	public void init() {
    		try {
    			HashMap<String, String> props = new HashMap<String, String>();
    			props.put(CommonsHttpMessageSender.HTTP_TIMEOUT, "180000");
    
    			org.codehaus.xfire.service.Service service = new ObjectServiceFactory()
    					.create(MsgDeliveryService.class, null,"com.xxx.xxx.management.service", props);
    			XFireProxyFactory factory = new XFireProxyFactory(XFireFactory
    					.newInstance().getXFire());
    			String wsdlUrl2 = "http://" + ip
    					+ ":8080/services/msgDeliveryService";
    			msgDeliveryService = (MsgDeliveryService) factory.create(service,
    					wsdlUrl2);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    	public boolean remoteInterface() {
    		return msgDeliveryService.isMsgDeliveryDelayed(param1, param2, param3,
    				param4);
    	}
    
    	public static void main(String[] args) {
    		TestXfireCaller msgbrokerWSCaller = new TestXfireCaller();
    		msgbrokerWSCaller.init();
    		System.out.println("xfire调用结果=" + msgbrokerWSCaller.remoteInterface());
    	}
    
    }
    

      

  • 相关阅读:
    2-2. 然后是几点(15)
    2-1. 厘米换算英尺英寸(15)
    2-0. 整数四则运算(10)
    忙碌的下半学期
    ACM 第十九天
    ACM 第十八天
    ACM 第十七天
    凸包模板
    极角排序常用方法
    ACM 第十六天
  • 原文地址:https://www.cnblogs.com/alipayhutu/p/3026832.html
Copyright © 2011-2022 走看看