CN106561032A - Message communication method based on XML - Google Patents

Message communication method based on XML Download PDF

Info

Publication number
CN106561032A
CN106561032A CN201510637422.4A CN201510637422A CN106561032A CN 106561032 A CN106561032 A CN 106561032A CN 201510637422 A CN201510637422 A CN 201510637422A CN 106561032 A CN106561032 A CN 106561032A
Authority
CN
China
Prior art keywords
message
xml
agent
communication
documentbuilderfactory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510637422.4A
Other languages
Chinese (zh)
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd
Original Assignee
ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd filed Critical ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd
Priority to CN201510637422.4A priority Critical patent/CN106561032A/en
Publication of CN106561032A publication Critical patent/CN106561032A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/61Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources taking into account QoS or priority requirements

Abstract

The invention discloses a message communication method based on XML. According to the message communication method based on XML, an XML format encapsulation and analysis mechanism of communication messages of multiple Agent systems is achieved in a way of message transmission, reliable and effective transmission of messages is achieved through a message transfer synchronous control algorithm based on message priority.

Description

A kind of message communication method based on XML
Technical field
A kind of message communication method based on XML relates generally to computer communication aspect field.
Background technology
It is based on network technology, to will be distributed over the Agent on diverse geographic location based on multi-Agent distributed system In being integrated in the consistent environment in a time and space, by the communication between them and interoperability, knowledge and information sharing are realized, so as to complete the solution of complex task.Multi-Agent Distributed system is widely used in such as ecommerce, robot control, Production-Plan and scheduling different field.At present, with regard to multi-Agent The research of distributed system, is concentrated mainly on the communication modes for supporting cooperation, and proposes many cooperation Communication Models.Such as based on the hardened structure of black/white and message based Communication Model.In the multi-Agent Communication Model based on blackboard structure, blackboard provides common work area, Agent Information, data and knowledge can be exchanged.But when Agent number of network nodes increases, the data volume in blackboard can be exponentially increased, causing the communication efficiency of system reduces.In message based Communication Model, by using unified message transmission protocol between Agent, the defect of blackboard system is overcome, improve the ability to communicate of system.But, in the Communication Model of message, how to carry out the transmission and synchronization of message between Agent, it is ensured that the reliability and validity of communication, i.e., ensure that message is reliably submitted to minimum communication time in the case of communication;How to ensure that message is not limited by protocol responses structure, the flexibility for improving system communication remains a difficult point of research.
The main communication that multi-Agent distributed system is realized in the way of message transmission, by the encapsulation of XML forms and parsing using message the transmission of message is realized.Message after encapsulation supports the extension to it due to binding more information, therefore overcomes restriction of the protocol responses structure to message, improves the flexibility of messaging.While in order to keep Agent Between messaging space-time consistency, employ in message transmitting procedure based on the transmission synchronization control algorithm of message priority, it is ensured that the reliable effectively transmission of message.The framework of realizing of system emulation is finally given, and in Win2000 Checking is achieved in system using Java language.
The content of the invention
Retrieved without the application materials found with regard to this system aspects by national patent.
In multi-Agent distributed system, in order to realize the communication between Agent, it is desirable to which each Agent knows other Agent Title, mailing address, PORT COM, collaboration capabilities etc..Therefore, a Communication Agent module is designed in each simulation Agent.The module is responsible for all actions relevant with communication, while the module is also Agent Between an interface being communicated.Each communication module includes information table, message cache pool and a part of communication services manager three.Information table is used for recording Agent In some fundamental characteristics.Information table mainly includes following two parts:(1)Static information table:The static information of storage Agent itself, such as Agent marks, the performance of itself, IP addresses;(2)Multidate information table:Other Agent information under main memory communicating state.In each Agent Start with during other Agent communications, various communicating status informations can be registered in multidate information table, and these information are deleted when exiting, to keep the real-time update of multidate information table;Message cache pool:Agent For storing the message for sending and receiving;Communication services manager:The encapsulation of XML forms and parsing of main responsible message, message synchronization transmission control.Avoid the cause and effect mistake caused due to stationary problem.
Information table, message cache pool, communication services manager and other each several parts are defined as into respectively the form of Java classes;The message for sending is packaged into XML format files, is then transmitted.TCP/IP is adopted in bottom Communications protocol and socket mechanicss of communication realize many simulation Agents The communication of node.Specifically method of operating is:
1. the message encapsulation and parsing based on XML:1)In message transmission, the semantic content of message is the core of Agent communications.Mainly apply FIPA-ACL Message structure [5].By using FIPA-ACL Message, each Agent can be to other Agent Send request or ask service.FIPAACL message structures are a kind of message structures based on primitive, and 3 levels are divided into from outside to inside:envelope、content、message.envelope:The various additional informations of description message transmission, such as sender, recipient;content:The particular content of description message transmission;message:The various parameters of description message transmission, the coded format that such as message is used, agreement of transmission etc..
Every time message only carries out message request with service in the range of intrinsic primitive(As received(accept), request(request)Deng), autgmentability is poor.Therefore, in order to overcome restriction of the protocol responses structure to messaging.Herein this message structure is packaged into into XML forms.The advantage of XML forms is can be with self-defined many XML labelled elements, and XML elements can bind more information, and support extends to it.Meanwhile, the compression transmission of data is easily achieved during transmission, improve efficiency of transmission, that is, network traffics are saved, reduce communication time.Such as in message.dtd In extend the attribute of priority.
Message structure based on XML(message.dtd)It is as follows:
<! ELEMENT acl-message(Msg-type, msg-param)
<! ELEMENT msg-type(agree|request|refuse|accept-proposal|cancel)>
<! ELEMENT agree(#PCDATA)>
……
<! ELEMENT msg-param(#PCDATA)>
<! ATTLIST msg-param sender CDATA #REQUIRED
receiver CDATA #REQUIRED
content CDATA #REQUIRED
in-reply-to CDATA #REQUIRED
language CDATA #REQUIRED
priority CDATA #REQUIRED
>
For example:Agent A are asked(request)Agent B are pushed to a chest.
Transmission message structure(move.xml)It is as follows:
<xml version="1.0">
<! DOCTYPE acl-message SYSTEM "message.dtd">
<acl-message>
<msg-type> request</msg-type>
<msg-param sender="A"
receive="B"
content="action(agent-identifier:name B)(deliver box(loc 12)"
language="fipa-sl"
protocol="fipa-request"
reply-with="order567"
priority="5">
</msg-param>
</acl-message >。
2)The parsing of XML documents
Receiving terminal needs to parse XML documents to recognize specific request message content.The purpose of parsing seeks to read the data required for user from XML documents.The parsing to XML documents is realized using DOM resolvers [6].After document parsing, first determine whether to belong to which type of message, it is then corresponding according to message activation
Action.Analyzing step is as follows:
(1)In javax.xml.parsers.DocumentBuilderFactory In class, newInstance is called()Method, generates a DocumentBuilderFactory object.
DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance();
(2)Using factory Call newDocumentBuilder()Method generates DocumentBuilder
Object.
javax.xml.parsers.DocumentBuilder Build=factory.newDocument-
Builder();
(3)build Object reference public Document parse(File f)The XML documents that method parsing f is specified, and the data with descendants's relation node are analyzed by Element type objects.
Org.w3c.dom.Document dom=build.parse(new File(move.xml));
Element root=dom.getDocumentElement();
(4)Finally, the data call getElementByTagName for parsing(String)Method, recognizes each flag node content.In addition, for the node containing attribute will do special process, allowing the node object to call NamedNodeMapgetAttributes()Method is parsing property content.
NodeList nodelist=root.getElementByTagName(“acl-message”);
NamedNodeMap nnm=nodelist.item(i).getAttributes();// the i-th knot
Point attribute.
2. communication services manager:1) the various affairs that mutually communication will be processed in Agent communication process are realized between simulation Agent.One communication services manager is set in each communication module.Communication services manager plays in systems central role as the hinge of message communication.Communications service management mainly includes the conversion of XML documents with parsing, Agent system administrations, Agent domain name supervisings and message transmitting procedure management.XML documents are changed and parsing:The XML forms encapsulation of completion message and the parsing of XML files;Agent domain name supervisings:Parse and inquire about the information such as title, address and the PORT COM of other Agent;Agent System administration:The cooperating of other intermodules of responsible simulation Agent inside;Message transmitting procedure is managed:Service in mainly completing to communicate is monitored and sent and the transmission control for receiving, such as message transmission Synchronization Control with thread management and message;For other Agent Distribution thread etc..
The function of communication services manager is realized with method by the class that is defined as follows.Service is monitored with thread management to be processed by run methods.Method doComm-Manage is used for the Synchronization Control management of completion message transmission.The XML forms encapsulation of message and parsing are respectively by CreateXml DoConverXml methods and parseXml methods in class is realized.
Communications service management class is defined as:
Class CommServer implements Runnable, IEventHandler
{ CreateXml crxml=new CreateXml();
public void setup(){ // start service is monitored }
pulic void doCommManage(String message){}
public void run(){ // service is monitored and thread management }
public void sent()
{ ZipOutputStream out=new ZipOutputStream(socket.getOutputStream());
out.putNextEntry(new ZipEntry(“message1.xml”));
out.write();// flow write output after data compression;
}
public String receive(){}
public void action() {
synchronized(this){}
// message processing procedure }
}。
2). it is to ensure simulation Agent communicating between nodes over time and space consistent, there is shown herein the transmission control algolithm based on message priority in view of the distributed feature of multi-Agent simulated environment.Packaged message XML file is allowed to enter transformation task ready queue according to priority height first.Priority determines according to transformation task urgency level.
System always allows the task of highest priority to start to perform.When a higher task of priority is reached, it is allowed to by current transmission task temporary suspension, and make high-priority task put into operation immediately.Adopting can meet in this way most urgent message prioritization transmission.If all of process all has identical priority initial value, enter first carry out at first.High-priority task is controlled using synchronized code block strategy when implementing, so as to ensure messaging over time and space consistent.In transmission, for the validity for ensureing to communicate, determined with minimum communication time when using local communication, when using telecommunication.

Claims (9)

1. a kind of message communication method based on XML is characterized in that(1)Static information table:The static information of storage Agent itself, such as Agent marks, the performance of itself, IP addresses;(2)Multidate information table:Other Agent information under main memory communicating state.
2. information table, message cache pool, communication services manager and other each several parts are distinguished according to claim 1
It is defined as the form of Java classes;The message for sending is packaged into XML format files, is then transmitted.
3., according to claim 2 by using FIPA-ACL message, each Agent can send request or ask service to other Agent.
4. XML format is packaged into this message structure according to claim 3.
5. this XML is parsed according to claim 4;Mainly in javax.xml.parsers.DocumentBuilderFactory classes, newInstance is called()Method, generates a DocumentBuilderFactory object;
DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance().
6. newDocumentBuilder is called using factory according to claim 5()Method generates DocumentBuilder objects;
Javax.xml.parsers.DocumentBuilder build=factory.newDocument-Builder().
7. according to the build object reference public Document parse in claim 6(File f)The XML documents that method parsing f is specified, and the data with descendants's relation node are analyzed by Element type objects;
Org.w3c.dom.Document dom=build.parse(new File(move.xml));
Element root=dom.getDocumentElement().
8. the data call getElementByTagName for being parsed according to claim 7(String)Method, recognizes each flag node content.
9. in addition, for the node containing attribute will do special process, allowing the node object to call NamedNodeMapgetAttributes()Method is parsing property content;
NodeList nodelist=root.getElementByTagName(“acl-message”);
NamedNodeMap nnm=nodelist.item(i).getAttributes().
CN201510637422.4A 2015-10-06 2015-10-06 Message communication method based on XML Pending CN106561032A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510637422.4A CN106561032A (en) 2015-10-06 2015-10-06 Message communication method based on XML

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510637422.4A CN106561032A (en) 2015-10-06 2015-10-06 Message communication method based on XML

Publications (1)

Publication Number Publication Date
CN106561032A true CN106561032A (en) 2017-04-12

Family

ID=58485286

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510637422.4A Pending CN106561032A (en) 2015-10-06 2015-10-06 Message communication method based on XML

Country Status (1)

Country Link
CN (1) CN106561032A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108540545A (en) * 2018-03-27 2018-09-14 武汉理工大学 The two-way dual asynchronous transport method of cloud computing environment spatial data based on multi-Agent

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108540545A (en) * 2018-03-27 2018-09-14 武汉理工大学 The two-way dual asynchronous transport method of cloud computing environment spatial data based on multi-Agent
CN108540545B (en) * 2018-03-27 2020-05-08 武汉理工大学 Spatial data bidirectional double asynchronous transmission method in cloud computing environment based on multiple agents

Similar Documents

Publication Publication Date Title
US9331953B2 (en) Device management method, middleware, and machine-to-machine communications platform, device, and system
US20160219125A1 (en) Method and apparatus for implementing subscription notification
JP2007525870A (en) Specifying the management node in the device management system
CN105763619B (en) The method and device that client and server-side are communicated
CN110022289A (en) Data transmission method, apparatus and system
CN101466109B (en) Communication system and method for WiMAX network management
CN113411215B (en) Time-sensitive network centralized user configuration method and system based on OPC UA
CN115150274B (en) Unified configuration method, system and storage medium for time-sensitive network equipment
CN101567861B (en) Data synchronization method and application system between heterogeneous application systems
CN101902473A (en) Method for synchronously updating data based on grid GIS (Geographic Information System)
CN114449459B (en) Message transmission method and platform function application function
CN113596017B (en) Protocol analysis method and device, soft gateway and storage medium
CN112822276A (en) Substation control layer communication method and system for transformer substation, electronic equipment and storage medium
CN105871819B (en) Transfer control method and equipment
CN108446105B (en) Lightweight API Server development framework and development method
US10310851B2 (en) Automated generation of service definitions for message queue application clients
CN113556359B (en) Communication protocol conversion method, device, system and gateway device
CN114448719A (en) Message interaction method, device and system
KR100736081B1 (en) Apparatus for providing web service, apparatus for requesting web service, method for providing web service and method for requesting web service
AU2005208065B2 (en) Defining nodes in device management system
CN104753804A (en) Data stream transmission control method, device and system
CN106561032A (en) Message communication method based on XML
Li et al. Efficient oneM2M protocol conversion platform based on NB-IoT access
CN112954658B (en) Business card system suitable for data exchange of communication protocol layer and data exchange method
CN105554045A (en) Multi-Agent message communication method based on XML

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170412

WD01 Invention patent application deemed withdrawn after publication