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());
    	}
    
    }
    

      

  • 相关阅读:
    设计模式--22、状态模式
    设计模式--21、备忘录模式
    设计模式--20、迭代器模式
    关于分布式事务、两阶段提交协议、三阶提交协议
    分布式系统的一致性探讨
    分布式系统的BASE理论
    分布式系统的CAP理论
    Kafka集群环境搭建
    Elasticsearch插件head的安装(有坑)
    centos6 x64安装elasticsearch5.5.2启动报错
  • 原文地址:https://www.cnblogs.com/alipayhutu/p/3026832.html
Copyright © 2011-2022 走看看