CN108200080B - Remote service communication method - Google Patents

Remote service communication method Download PDF

Info

Publication number
CN108200080B
CN108200080B CN201810055471.0A CN201810055471A CN108200080B CN 108200080 B CN108200080 B CN 108200080B CN 201810055471 A CN201810055471 A CN 201810055471A CN 108200080 B CN108200080 B CN 108200080B
Authority
CN
China
Prior art keywords
client
server
information
request command
file
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.)
Active
Application number
CN201810055471.0A
Other languages
Chinese (zh)
Other versions
CN108200080A (en
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.)
Shenzhou Yunke (Beijing) Technology Co.,Ltd.
Original Assignee
Shenzhen Science And Technology Co ltd Digital Cloud Data
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 Shenzhen Science And Technology Co ltd Digital Cloud Data filed Critical Shenzhen Science And Technology Co ltd Digital Cloud Data
Priority to CN201810055471.0A priority Critical patent/CN108200080B/en
Publication of CN108200080A publication Critical patent/CN108200080A/en
Application granted granted Critical
Publication of CN108200080B publication Critical patent/CN108200080B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a remote service communication method, which comprises the following steps: s1, receiving a request command generated by an application client configuration code sent by a client, analyzing the request command according to the server configuration code, and acquiring a service parameter; the client configuration code and the server configuration code are RPC codes which are generated according to a configuration file and are used for the client and the server respectively; s2, calling corresponding functions from the server configuration codes according to the service parameters to generate an operation result; and S3, returning the operation result to the client. According to the remote service communication method provided by the invention, the configuration codes of the client and the server are generated through the configuration file, so that the problems of parameter mismatching and large code workload caused by the change of the service requirement are solved, the change of the service requirement can be quickly met, the workload of developers is favorably reduced, and the continuous and stable operation of a software development project is realized.

Description

Remote service communication method
Technical Field
The invention relates to the technical field of remote data processing, in particular to a remote service communication method.
Background
Inter-process communication (IPC) is the basis for the design and implementation of distributed systems, and IPC connects the concurrent processes of the distributed systems, which are connected through a network, to form a system. IPC is used both to exchange data and information and to coordinate process activities.
There are several models of interaction between processes, each corresponding to different abstractions of the IPC. The most common of which include shared storage, Remote Procedure Calls (RPCs), and message passing.
Wherein the RPC works according to the following method: when an application A needs to exchange information with another remote application B or requires B to provide assistance, A will generate a request locally to inform B to receive information or provide corresponding service through a communication link, and B will return confirmation information or result to A after completing relevant processing. RPC emphasizes that two applications communicating must be identical in environment and platform and must be running at the same time.
When performing remote calls, a tight coupling between applications is required, the communication line must be kept in good condition all the time during the communication, and a large amount of programming work for the underlying communication must be performed. The replacement of new and old systems, the change of development platforms or environments, and the introduction of new requirements for new functions may require the redevelopment of existing codes and the corresponding change of communication protocols. However, the redevelopment of the existing code and the change of the communication protocol require programmers to be familiar with related concepts and to design control flows by themselves, and the client and the service process must be matched with each other and must be in a running state, so that certain technical difficulties exist.
Disclosure of Invention
The invention provides a remote service communication method for solving the problems in the prior art.
In one aspect, the present invention provides a remote service communication method, including: s1, receiving a request command generated by an application client configuration code sent by a client, analyzing the request command according to the server configuration code, and acquiring a service parameter; the client configuration code and the server configuration code are RPC codes which are generated according to a configuration file and are used for the client and the server respectively; s2, calling corresponding functions from the server configuration codes according to the service parameters to generate an operation result; and S3, returning the operation result to the client.
Preferably, the configuration file is an XML file, and the configuration file includes service parameter information, port information, client information, and server information.
Preferably, the method further comprises the following steps: s01, traversing the configuration file to obtain each service parameter information, port information and server information in the configuration file; s02, integrating the service parameter information into a service parameter list, integrating the port information into a port character string, and integrating the service side information into a service side dictionary; and S03, generating a server configuration code corresponding to the server dictionary by applying the service parameter list and the port character string.
Preferably, the request command is composed of a request data length and request data; the request data includes a communication protocol type, a service parameter and a preset byte.
Preferably, the step S1 further includes: receiving a request command sent by a client, and applying for a memory space according to the length of request data in the request command; writing the request data in the request command into the memory space; and analyzing the data in the memory space to obtain service parameters.
Preferably, the step S3 further includes: and converting the operation result into a network communication packet, and calling a start _ snd () function to return the network communication packet to the client.
Preferably, the configuration file comprises a file header and a file body; the file header consists of an XML statement and a DTD file type statement; the file body comprises the service parameter information, the port information, the client information and the server information; in the service parameter information, the type of a communication protocol is synchronous or asynchronous, the type of the value of a service parameter comprises at least one of string, char, ulong, uint, pool and void, and the type of the service parameter is input, output or input and output; in the port information, the port number is a string type.
In another aspect, the present invention provides a remote service communication method, including: s1, converting the user request into a request command by the application client configuration code, and sending the request command to the server, so that the server can analyze the request command according to the server configuration code, obtain the service parameter, call the corresponding function from the server configuration code according to the service parameter, generate the running result, and return; the client configuration code and the server configuration code are RPC codes which are generated according to a configuration file and are used for the client and the server respectively; and s2, receiving the operation result returned by the server.
Preferably, the configuration file is an XML file, and the configuration file includes service parameter information, port information, client information, and server information.
Preferably, the method further comprises the following steps: s01, traversing the configuration file, and acquiring each service parameter information, port information and client information in the configuration file; s02, integrating the service parameter information into a service parameter list, integrating the port information into a port character string, and integrating the client information into a client dictionary; s03, generating the client configuration code corresponding to the client dictionary by using the service parameter list and the port character string.
According to the remote service communication method provided by the invention, the configuration codes of the client and the server are generated through the configuration file, so that the problems of parameter mismatching and large code workload caused by the change of the service requirement are solved, the change of the service requirement can be quickly met, the workload of developers is favorably reduced, and the continuous and stable operation of a software development project is realized.
Drawings
Fig. 1 is a flowchart illustrating a teleservice communication method according to an embodiment of the present invention;
FIG. 2 is a diagram of a synchronous communication protocol architecture in accordance with an embodiment of the present invention;
FIG. 3 is a block diagram of an asynchronous communication protocol in accordance with an embodiment of the present invention;
FIG. 4 is a flow chart of configuration code generation according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
The remote service communication method provided by the invention is divided into a client and a server for explanation, and firstly, the remote service communication method of the server is explained as follows:
fig. 1 is a flowchart illustrating a remote service communication method according to an embodiment of the present invention, and as shown in fig. 1, the remote service communication method includes: s1, receiving a request command generated by an application client configuration code sent by a client, analyzing the request command according to the server configuration code, and acquiring a service parameter; the client configuration code and the server configuration code are RPC codes which are generated according to a configuration file and are used for the client and the server respectively; s2, calling corresponding functions from the server configuration codes according to the service parameters to generate an operation result; and S3, returning the operation result to the client.
Specifically, first, the client application client configures a code to generate a request command, and sends the request command to the server. Wherein the client configuration code is a Remote Procedure Call protocol code for the client generated from the configuration file, and the Remote Procedure Call protocol (RPC) is a protocol for requesting a service from a Remote computer program over a network without knowledge of underlying network technology.
And the server receives the request command, analyzes the request command by applying a server configuration code, and acquires the service parameters contained in the request command. The server side configuration code is a remote procedure call protocol code for the server side generated according to the configuration file.
And then, the server calls a function corresponding to the service parameter from the server configuration code according to the service parameter analyzed from the request command in the last step, and generates an operation result.
And finally, the server returns the operation result to the client, and the client receives the operation result.
In the embodiment of the invention, the configuration codes of the client and the server are generated through the configuration file, so that the problems of parameter mismatching and large code workload caused by the change of the service requirement are solved, the change of the service requirement can be quickly met, the workload of developers is favorably reduced, and the continuous and stable operation of a software development project is realized.
Based on the above specific embodiment, a remote service communication method is provided, where the configuration file is an XML file, and the configuration file includes service parameter information, port information, client information, and server information.
Specifically, the configuration file is an XML (extensible Markup language) file, which is a Markup language for marking an electronic file to have a structure, in an electronic computer, a mark refers to an information symbol that can be understood by the computer, and through such a mark, various information, such as articles, can be processed between the computers. It can be used to mark data, define data types, and is a source language that allows a user to define his or her own markup language.
The configuration file comprises service parameter information, port information, client information and server information.
The service parameter information is used for defining format specifications of service parameters, the port information is used for defining a communication port, the client information is used for defining a code type and a code name generated by a client, and the server information is used for defining a code type and a code name generated by a server.
In the embodiment of the invention, the configuration file realizes the configuration of the service parameters, the ports, the client and the server, and provides conditions for the unification of the codes of the client and the server.
Based on any of the above specific embodiments, a remote service communication method further includes: s01, traversing the configuration file to obtain each service parameter information, port information and server information in the configuration file; s02, integrating the service parameter information into a service parameter list, integrating the port information into a port character string, and integrating the service side information into a service side dictionary; and S03, generating a server configuration code corresponding to the server dictionary by applying the service parameter list and the port character string.
Specifically, before the server receives the request command and analyzes the request command by applying the server configuration code, the server configuration code needs to be generated and provided to the server for calling.
The method for generating the configuration code of the server side according to the configuration file comprises the following steps:
firstly, reading and traversing the configuration file to acquire all service parameter information, port information and server information in the configuration file;
secondly, integrating the service parameter information, the port information and the server information obtained by traversing the configuration file in the above steps respectively: and integrating all the service parameter information into a service parameter list, neutralizing all the port information into a port character string, and integrating all the server information into a server dictionary.
And finally, generating a server side configuration code corresponding to the server side dictionary by applying the service parameter list and the port character string, and providing the server side configuration code for the server side to call.
For example, the integration form of the service parameter information, the port information, the client information and the server information is as follows:
Figure BDA0001553629890000061
the functions are a service parameter list, the port is a port character string, the client is a client dictionary, and the server is a server dictionary.
Further, the configuration file comprises a file header and a file body; the file header consists of an XML statement and a DTD file type statement; the file body comprises the service parameter information, the port information, the client information and the server information; in the service parameter information, the type of a communication protocol is synchronous or asynchronous, the type of the value of a service parameter comprises at least one of string, char, ulong, uint, pool and void, and the type of the service parameter is input, output or input and output; in the port information, the port number is a string type.
For example, the XML statement is as follows:
<<?xml version="1.0"encoding="utf-8"?>>
wherein, "<? "indicates the start of an instruction,"? "indicates the end of a command," XML "indicates that the current file is an XML file," version ═ 1.0 "indicates that the file uses the XML1.0 standard, and" encoding ═ utf-8 "indicates the character set used by the file.
The communication protocol type is synchronous sync or asynchronous async.
In the service parameter list, taking open as an example, each label of open is parsed into the following format:
[[{'func_name':'open','type':'sync','pt_params':[],'params':[{'param_name':'dev_path','param_value':'string','param_type':'in'},{'param_name':'fd','param_value':'ulong','param_type':'out'}]},{……}]
the function name is open, the function type is synchronous, the value of the service parameter dev _ path is string type, the type of dev _ path is input, the value of the service parameter fd is ulong type, and the type of fd is output.
Port, client, server are parsed as follows:
8088
{'namespace':'nbd','type':'C++','filename':'nbd_client'}
{'namespace':'nbd','type':u'C++','filename':'transfer_server'}
the port is 8088, the name space of the client is nbd, the language type of the client is C + +, the code name of the client is nbd _ client, the name space of the server is nbd, the language type of the server is C + +, and the code name of the server is transfer _ server.
In the embodiment of the invention, the configuration file is used for generating the configuration code of the server, the configuration file is used for generating the configuration code of the client, and the configuration file is used for configuring the client and the server, so that the unification of the codes of the client and the server is realized.
Based on any one of the above embodiments, a teleservice communication method, where the request command is composed of a request data length and a request data; the request data includes a communication protocol type, a service parameter and a preset byte.
Specifically, the request command comprises two parts of request data length and request data. The length of the requested data is len stored in a file header, and a data area is arranged behind the file header, namely the requested data.
The request data includes a communication protocol type, a service parameter and a preset byte. The preset bytes include condition, void and the like, and are used for communication negotiation and correspond to pointer addresses in the memory.
The types of the request data include: the pool occupies one byte, the uint occupies 4 bytes, the ulong occupies 8 bytes, the void occupies 8 bytes, the char occupies 8 bytes, and string is self-defined in length.
Based on any of the foregoing embodiments, a method for teleservice communication, where the step S1 further includes: s11, receiving a request command sent by a client, and applying for a memory space according to the length of request data in the request command; s12, writing the request data in the request command into the memory space; and S13, analyzing the data in the memory space by applying the server configuration code, and acquiring the service parameters.
Specifically, after a client side applies a client side configuration code to generate a request command and sends the request command to a server side, the server side receives the request command, extracts a request data length from the request command, and applies for a memory space according to the request data length. In the embodiment of the invention, a data () function is called to apply for the memory.
And then, extracting the request data in the request command, and writing the request data into the memory applied in the last step. Taking the open function as an example, the first 8 bytes of the corresponding request command are the request data length len, and the request data is the following. The memory head func _ type of the request data is sync, namely synchronous processing, the middle is a service parameter dev _ path, the type of the service parameter dev _ path is character type, and the back is two pointer types of condition and void, and the two pointer types point to the data () function.
And finally, the server analyzes the request data written into the memory space in the last step through the server configuration code to obtain the service parameters.
In the embodiment of the invention, a specific process of analyzing the request command by the application server configuration code is provided, and conditions are provided for realizing the unification of the client and server codes.
Based on any of the foregoing embodiments, a method for teleservice communication, where the step S3 further includes: and converting the operation result into a network communication packet, and calling a start _ snd () function to return the network communication packet to the client.
Subsequently, the present invention is explained for a remote service communication method of a client:
based on any of the above embodiments, a remote service communication method, s1, converting a user request into a request command by using a client configuration code, and sending the request command to a server, so that the server can analyze the request command according to the server configuration code, obtain a service parameter, call a corresponding function from the server configuration code according to the service parameter, generate an operation result, and return the operation result; the client configuration code and the server configuration code are RPC codes which are generated according to a configuration file and are used for the client and the server respectively; and s2, receiving the operation result returned by the server.
Specifically, first, the client application client configures a code to generate a request command, and sends the request command to the server. The client configuration code is a remote procedure call protocol code for the client generated according to the configuration file.
And the server receives the request command, analyzes the request command by applying a server configuration code, and acquires the service parameters contained in the request command. The server side configuration code is a remote procedure call protocol code for the server side generated according to the configuration file.
And then, the server calls a function corresponding to the service parameter from the server configuration code according to the service parameter analyzed from the request command in the last step, and generates an operation result.
And finally, the server returns the operation result to the client, and the client receives the operation result returned by the server.
In the embodiment of the invention, the configuration codes of the client and the server are generated through the configuration file, so that the problems of parameter mismatching and large code workload caused by the change of the service requirement are solved, the change of the service requirement can be quickly met, the workload of developers is favorably reduced, and the continuous and stable operation of a software development project is realized.
Based on the above specific embodiment, a remote service communication method is provided, where the configuration file is an XML file, and the configuration file includes service parameter information, port information, client information, and server information.
Specifically, the configuration file is an XML (extensible Markup language) file, which is a Markup language for marking an electronic file to have a structure, in an electronic computer, a mark refers to an information symbol that can be understood by the computer, and by this mark, various information such as articles and the like can be processed between the computers. It can be used to mark data, define data types, and is a source language that allows a user to define his or her own markup language.
The configuration file comprises service parameter information, port information, client information and server information.
The service parameter information is used for defining format specifications of service parameters, the port information is used for defining a communication port, the client information is used for defining a code type and a code name generated by a client, and the server information is used for defining a code type and a code name generated by a server.
In the embodiment of the invention, the configuration file realizes the configuration of the service parameters, the ports, the client and the server, and provides conditions for the unification of the codes of the client and the server.
Based on any of the above specific embodiments, a remote service communication method further includes: s01, traversing the configuration file, and acquiring each service parameter information, port information and client information in the configuration file; s02, integrating the service parameter information into a service parameter list, integrating the port information into a port character string, and integrating the client information into a client dictionary; s03, generating the client configuration code corresponding to the client dictionary by using the service parameter list and the port character string.
Specifically, before a client side configuration code is applied to a client side to generate a request command and the request command is sent to a server side, a client side configuration code needs to be generated and provided for the client side to call.
The method for generating the client configuration code according to the configuration file comprises the following steps:
firstly, reading and traversing the configuration file to acquire all service parameter information, port information and client information in the configuration file;
secondly, integrating the service parameter information, the port information and the client information obtained by traversing the configuration file in the above steps respectively: and integrating all the service parameter information into a service parameter list, neutralizing all the port information into a port character string, and integrating all the client information into a client dictionary.
And finally, generating a server side configuration code corresponding to the server side dictionary by applying the service parameter list and the port character string, and providing the server side configuration code for the server side to call.
For example, the integration form of the service parameter information, the port information, the client information and the server information is as follows:
Figure BDA0001553629890000111
the functions are a service parameter list, the port is a port character string, the client is a client dictionary, and the server is a server dictionary.
Further, the configuration file comprises a file header and a file body; the file header consists of an XML statement and a DTD file type statement; the file body comprises the service parameter information, the port information, the client information and the server information; in the service parameter information, the type of a communication protocol is synchronous or asynchronous, the type of the value of a service parameter comprises at least one of string, char, ulong, uint, pool and void, and the type of the service parameter is input, output or input and output; in the port information, the port number is a string type.
For example, the XML statement is as follows:
<<?xml version="1.0"encoding="utf-8"?>>
wherein, "<? "indicates the start of an instruction,"? "indicates the end of a command," XML "indicates that the current file is an XML file," version ═ 1.0 "indicates that the file uses the XML1.0 standard, and" encoding ═ utf-8 "indicates the character set used by the file.
The communication protocol type is synchronous sync or asynchronous async.
In the service parameter list, taking open as an example, each label of open is parsed into the following format:
[[{'func_name':'open','type':'sync','pt_params':[],'params':[{'param_name':'dev_path','param_value':'string','param_type':'in'},{'param_name':'fd','param_value':'ulong','param_type':'out'}]},{……}]
the function name is open, the function type is synchronous, the value of the service parameter dev _ path is string type, the type of dev _ path is input, the value of the service parameter fd is ulong type, and the type of fd is output.
Port, client, server are parsed as follows:
8088
{'namespace':'nbd','type':'C++','filename':'nbd_client'}
{'namespace':'nbd','type':u'C++','filename':'transfer_server'}
the port is 8088, the name space of the client is nbd, the language type of the client is C + +, the code name of the client is nbd _ client, the name space of the server is nbd, the language type of the server is C + +, and the code name of the server is transfer _ server.
In the embodiment of the invention, the client configuration code is generated through the configuration file, the server configuration code is generated through the configuration file in the same way, and the client and the server are configured through the application configuration file, so that the unification of the client and the server codes is realized.
Based on any one of the above embodiments, a teleservice communication method, where the request command is composed of a request data length and a request data; the request data includes a communication protocol type, a service parameter and a preset byte.
Specifically, the request command comprises two parts of request data length and request data. The length of the requested data is len stored in a file header, and a data area is arranged behind the file header, namely the requested data.
The request data includes a communication protocol type, a service parameter and a preset byte. The preset bytes include condition, void and the like, and are used for communication negotiation and correspond to pointer addresses in the memory.
The types of the request data include: the pool occupies one byte, the uint occupies 4 bytes, the ulong occupies 8 bytes, the void occupies 8 bytes, the char occupies 8 bytes, and string is self-defined in length.
In order to better understand and apply a teleservice communication method proposed by the present invention, the following examples are made, and the present invention is not limited to the following examples.
Xml is written first.
The configuration file is an XML file and consists of a file header and a file body. Wherein the file header is composed of an XML statement and a DTD file type statement.
The file body comprises the content of the XML file, the XML element is a basic unit of the content of the XML file, and the format of the XML element is as follows:
< tag name Attribute name 1 ═ Attribute value … … > content >
The configuration file is used for defining a function between the server and the client, for example, a function open is defined in the func name of the configuration file, the client generates an open C + + function, the user calls the open function, the open function is transmitted to the server through an internal protocol after the analysis is finished, the server analyzes the open function of the configuration file, and the open function of the client is called to return to the client, so that a cycle is formed.
Fig. 2 is a structure diagram of a synchronous communication protocol according to a specific embodiment of the present invention, and as shown in fig. 2, the content of a communication protocol corresponding to any function func generated by the configuration file is as follows:
the method comprises the steps of constructing lt _ data _ t, determining the size of a developed memory according to the sending content, transmitting input and output parameters except for the fact that the output parameters do not need to be transmitted, calculating the length, and calling a data () function to develop the memory. And then writing the parameters to be written into the opened memory. For example, in the open () function, the buffer header is 8 bytes len, followed by the memory, the memory header function _ type is the synchronization processing sync, the middle is the length of the service parameter dev _ path, the type is a character type, followed by two pointer types, i.e., condition and void, and points to the data () function.
Fig. 3 is a block diagram of an asynchronous communication protocol according to an embodiment of the present invention, wherein the asynchronous communication protocol is reduced in condition pointer type from the synchronous communication protocol, as shown in fig. 3, compared to fig. 2.
Next, fig. 4 is a flow chart of generating configuration codes according to a specific embodiment of the present invention, and as shown in fig. 4, the configuration files are applied to generate server-side configuration codes and client-side configuration codes:
1) and operating the code generator, reading the written configuration file, traversing funcs, ports, servers and clients of the configuration file, and generating a list, characters or a dictionary.
2) Calling the generation _ client _ h.py, the generation _ client _ cpp.py and the client C + + file corresponding to the file field of the client, and redirecting to an output folder to generate the client.h.and client. cpp files;
and calling the generation _ server _ cpp. py and the generation _ server _ h. py to generate a server C + + file corresponding to the filename field of the server, and redirecting to an output folder to generate client server.
And then, the client side applies the client.h and the client.cpp to generate a request command and sends the request command to the server side.
And the server receives the request command, and analyzes the request command by applying server.h and server.cpp to obtain the service parameters contained in the request command.
And then, the server calls a function corresponding to the service parameter from the server configuration code according to the service parameter analyzed from the request command in the previous step, namely, the server creates a derived class inheriting a server _ handle virtual base class and generates an operation result.
Finally, the code generator will then convert the running result into a packet of the network communication protocol, and then return the result to the client by calling the start _ snd () function of session
In the example, the configuration codes of the client and the server are generated through the configuration file, so that the problems of parameter mismatching and large code workload caused by the change of the service requirement are solved, the change of the service requirement can be quickly met, the workload of developers is favorably reduced, and the continuous and stable operation of a software development project is realized.
Finally, the method of the present application is only a preferred embodiment and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A teleservices communication method, comprising:
s1, receiving a request command generated by an application client configuration code sent by a client, analyzing the request command according to the server configuration code, and acquiring a service parameter; the client configuration code and the server configuration code are RPC codes which are generated according to a configuration file and are used for the client and the server respectively;
s2, calling corresponding functions from the server configuration codes according to the service parameters to generate an operation result;
s3, returning the operation result to the client;
the configuration file is an XML file and comprises service parameter information, port information, client information and server information;
the receiving a request command generated by an application client configuration code sent by a client, analyzing the request command according to a server configuration code, and acquiring service parameters includes:
the running code generator reads the compiled configuration file, traverses funcs, ports, servers and clients of the configuration file and generates a list, characters or a dictionary; the clients are client side dictionaries, and the servers are server side dictionaries;
applying the funcs and the port, calling generation _ client _ h.py and generation _ client _ cpp.py to generate a client C + + file corresponding to the client file field of the client, and redirecting to an output folder to generate client.h and client.cpp files;
applying the funcs and the port, calling generation _ server _ cpp.py and generation _ server _ h.py to generate a server C + + file corresponding to the filename field of the server, and redirecting to an output folder to generate server h and server.
The filename field is a code name;
the client side applies the client.h and the client.cpp to generate a request command and sends the request command to the server side;
and the server receives the request command, analyzes the request command by applying the server.h and the server.cpp, and acquires the service parameters contained in the request command.
2. The method of claim 1, further comprising:
s01, traversing the configuration file to obtain each service parameter information, port information and server information in the configuration file;
s02, integrating the service parameter information into a service parameter list, integrating the port information into a port character string, and integrating the service side information into a service side dictionary;
and S03, generating a server configuration code corresponding to the server dictionary by applying the service parameter list and the port character string.
3. The method of claim 1, wherein the request command is comprised of a request data length and a request data;
the request data includes a communication protocol type, a service parameter and a preset byte.
4. The method according to claim 3, wherein the S1 further comprises:
receiving a request command sent by a client, and applying for a memory space according to the length of request data in the request command;
writing the request data in the request command into the memory space;
and analyzing the data in the memory space to obtain service parameters.
5. The method according to claim 1, wherein the S3 further comprises:
and converting the operation result into a network communication packet, and calling a start _ snd () function to return the network communication packet to the client.
6. The method of claim 1, wherein the configuration file comprises a file header and a file body;
the file header consists of an XML statement and a DTD file type statement;
the file body comprises the service parameter information, the port information, the client information and the server information;
in the service parameter information, the type of a communication protocol is synchronous or asynchronous, the type of the value of a service parameter comprises at least one of string, char, ulong, uint, pool and void, and the type of the service parameter is input, output or input and output;
in the port information, the port number is a string type.
7. A teleservices communication method, comprising:
s1, converting the user request into a request command by the application client configuration code, and sending the request command to the server, so that the server can analyze the request command according to the server configuration code, obtain the service parameter, call the corresponding function from the server configuration code according to the service parameter, generate the running result, and return; the client configuration code and the server configuration code are RPC codes which are generated according to a configuration file and are used for the client and the server respectively;
the method for acquiring the service parameters comprises the following steps that the application client configuration code converts a user request into a request command, and sends the request command to a server, so that the server can analyze the request command according to the server configuration code to acquire the service parameters, and the method comprises the following steps:
the running code generator reads the compiled configuration file, traverses funcs, ports, servers and clients of the configuration file and generates a list, characters or a dictionary; the clients are client side dictionaries, and the servers are server side dictionaries;
applying the funcs and the port, calling generation _ client _ h.py and generation _ client _ cpp.py to generate a client C + + file corresponding to the client file field of the client, and redirecting to an output folder to generate client.h and client.cpp files;
applying the funcs and the port, calling generation _ server _ cpp.py and generation _ server _ h.py to generate a server C + + file corresponding to the filename field of the server, and redirecting to an output folder to generate server h and server.
The filename field is a code name;
the client side applies the client.h and the client.cpp to generate a request command and sends the request command to the server side;
the server receives the request command, and analyzes the request command by applying the server.h and the server.cpp to obtain the service parameters contained in the request command;
s2, receiving the operation result returned by the server;
the configuration file is an XML file and comprises service parameter information, port information, client information and server information.
8. The method of claim 7, further comprising:
s01, traversing the configuration file, and acquiring each service parameter information, port information and client information in the configuration file;
s02, integrating the service parameter information into a service parameter list, integrating the port information into a port character string, and integrating the client information into a client dictionary;
s03, generating the client configuration code corresponding to the client dictionary by using the service parameter list and the port character string.
CN201810055471.0A 2018-01-19 2018-01-19 Remote service communication method Active CN108200080B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810055471.0A CN108200080B (en) 2018-01-19 2018-01-19 Remote service communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810055471.0A CN108200080B (en) 2018-01-19 2018-01-19 Remote service communication method

Publications (2)

Publication Number Publication Date
CN108200080A CN108200080A (en) 2018-06-22
CN108200080B true CN108200080B (en) 2021-03-16

Family

ID=62590380

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810055471.0A Active CN108200080B (en) 2018-01-19 2018-01-19 Remote service communication method

Country Status (1)

Country Link
CN (1) CN108200080B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542357B (en) * 2018-12-03 2022-03-08 郑州云海信息技术有限公司 Command parameter assembling method, system, equipment and computer storage medium
CN109871289B (en) * 2019-02-01 2020-03-10 北京顺丰同城科技有限公司 Remote Procedure Call (RPC) service generation method and device
CN112199219A (en) * 2020-11-17 2021-01-08 南开大学 Cross-language operation remote calling method
CN115314536B (en) * 2022-08-03 2024-02-02 平安付科技服务有限公司 Remote command execution method and device, storage medium and computer equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840334A (en) * 2010-04-16 2010-09-22 中国电子科技集团公司第二十八研究所 Software component service packaging method
CN105426172A (en) * 2015-10-30 2016-03-23 北京金海明天软件技术有限公司 XML analysis technique and template language based dynamic WEB page generation method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8966235B2 (en) * 2006-10-24 2015-02-24 Kent E. Dicks System for remote provisioning of electronic devices by overlaying an initial image with an updated image
CN101764843A (en) * 2009-12-28 2010-06-30 福建星网锐捷网络有限公司 Processing method and system for remote process call, client end and server
CN102375755A (en) * 2010-08-17 2012-03-14 鸿富锦精密工业(深圳)有限公司 Data model object deletion identification device and use method thereof
CN103051728B (en) * 2013-01-10 2015-07-08 太仓市同维电子有限公司 Remote-procedure calling method
CN104133745A (en) * 2013-04-30 2014-11-05 鸿富锦精密工业(深圳)有限公司 Electronic device with test function, test method and system
EP3192020A4 (en) * 2014-09-12 2018-02-14 Quickvault Inc. Method and system for forensic data tracking

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840334A (en) * 2010-04-16 2010-09-22 中国电子科技集团公司第二十八研究所 Software component service packaging method
CN105426172A (en) * 2015-10-30 2016-03-23 北京金海明天软件技术有限公司 XML analysis technique and template language based dynamic WEB page generation method

Also Published As

Publication number Publication date
CN108200080A (en) 2018-06-22

Similar Documents

Publication Publication Date Title
CN108200080B (en) Remote service communication method
US6757899B2 (en) Dynamic CORBA gateway for CORBA and non-CORBA clients and services
CN110198247B (en) Interface test method and system
CN108337236A (en) A kind of gRPC call methods and device based on Protobuf and HTTP/1.1
US7607128B2 (en) Method and system for enabling a server application to be executed in the same virtual machine as a client application using direct object oriented programming method calls
CN101341724B (en) System and method for history driven optimization of web services communication
US6874021B1 (en) Techniques for configuring network devices with consistent forms for getting and setting device properties
CN111988171B (en) Method, proxy server and system for calling SOAP Web service based on RESTful style request
US20020038349A1 (en) Method and system for reusing internet-based applications
KR20160000542A (en) Method and apparatus for gernerating data distribution service application
CN115408169A (en) Remote procedure calling method, device, equipment and readable storage medium
JP2000047964A (en) Data transfer method on network, its device, its system, and recording medium having recorded data transfer program on network thereon
US20040167960A1 (en) Network service interceptor
CN112667204A (en) Data processing method and device for microservice application and computer equipment
Deri Network Management for the 90s
CN116668520A (en) Gateway-based service arrangement method, system, equipment and storage medium
CN111984679B (en) Access method, device, host, system and medium of hardware acceleration database
KR101270746B1 (en) Apparatus and Method for mediating web service
van Engelen gSOAP 2.7. 0 User Guide
Catani Extending LabVIEW Aptitude for Distributed Controls and Data Acquisition
Lewis et al. The role of XML in TMN evolution
CN108418901A (en) High performance remote procedure calling (PRC) method based on PHP
EP1305710A1 (en) Type conversion technique facilitating remote service invocation
Zhu Developing web-based mapping applications through distributed object technology
Wu Experiments with internet accessible mathematical computation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220328

Address after: No. 407, floor 4, No. 9, No. 9, shangdijiu street, Haidian District, Beijing 100085

Patentee after: Shenzhou Yunke (Beijing) Technology Co.,Ltd.

Address before: 518131 F3, 11th floor, No. 8 Kefa Road, Yuehai Street, Nanshan District, Shenzhen City, Guangdong Province

Patentee before: Shenzhen science and Technology Co.,Ltd. digital cloud data

TR01 Transfer of patent right