/// <summary> /// 发送到MQ /// </summary> /// <param name="i"></param> private void Send2MQ(string i) { SOA.message.Request.Service Service = new SOA.message.Request.Service(); //基本属性 Service.Route.SerialNO = "服务流水码"; Service.Route.ServiceID = "服务码"; Service.Route.SourecSysID = "源系统代码"; Service.Route.ServiceTime = System.DateTime.Now.ToString("yyyyMMddHHmmss"); //复杂对象 List <Node> dicData = new List <Node>(); Node n = new Node(); n.NodeName = "id"; n.NodeValue = i; // n.NodeValue = this.TextBox1.Text.Trim(); dicData.Add(n); XmlDocument m_xml = SOA.message.XmlHelper.InsertNode_xml(Service, "Request", dicData); // 获取服务调用者实例 BaseServiceRequester Requester = new BaseServiceRequester(); XmlDocument g_xml = Requester.execute(m_xml, 500); SOA.message.XmlHelper xh = new XmlHelper(g_xml); string SerialNO = xh.GetValue("/Service/Route/SerialNO"); string ServiceID = xh.GetValue("/Service/Route/ServiceID"); string SourecSysID = xh.GetValue("/Service/Route/SourecSysID"); string ServiceTime = xh.GetValue("/Service/Route/ServiceTime"); List <Node> nodelist = xh.GetNodeObj("/Service/Data/Response"); // List<MQParameter> sendQueueLists = (List<MQParameter>)ob.RentObject(); }
public static XmlDocument InsertNode_xml(SOA.message.Request.Service Service, string ChildNode, List <SOA.message.Request.Node> Content) { try { string xml = XmlUtil.Serializer(typeof(SOA.message.Request.Service), Service); string MainNode = "Service/Data"; //创建一个XML对象 XmlDocument m_xml = new XmlDocument(); //加载XML文件 m_xml.LoadXml(xml); return(InsertNode(m_xml, MainNode, ChildNode, Content)); } catch { return(null); } }