A data processing method based on.NET framework calling POST request

By referencing specific files and defining data interface classes in the .NET framework, combined with DataTable objects, data interaction between .NET and Java systems was achieved, solving the problems of difficult data connectivity and system stability, and improving data integrity and system security.

CN115617424BActive Publication Date: 2025-11-21ANHUI MA STEEL AUTOMATION INFORMATION TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211241513.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-11
Publication Date
2025-11-21
Estimated Expiration
2042-10-11

AI Technical Summary

Technical Problem

Data connectivity between the .NET framework and the Java framework is challenging, especially when connecting to a .NET framework system via a POST request, which can affect the stability and network security of the target system.

Method used

By referencing the Newtonsoft.Json and System.Net files in the web service, defining the SysInfo and DetailInfo data interface classes, using the WebRequest and WebResponse classes for data serialization and deserialization, creating a DataTable object in the .NET source system, and sending POST requests according to the format defined in the interface.

Benefits of technology

This improved data integrity and enhanced the security and stability of the target system, while reducing the burden on interfaces, thus enabling the smooth promotion of the barcode scanning and inventory system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115617424B_ABST
    Figure CN115617424B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method based on calling POST request of.NET framework, and belongs to the technical field of computer network communication interface. The steps of the application are as follows: a general interface class is developed on a Web service, the format of all data in the interface class is defined in advance, the interface class uniformly processes the data to be sent and performs data conversion; secondly, the Web service is referenced in the.NET system, when a source system runs a program, the program creates a data block of the data to be sent and calls the interface in the Web service according to the defined format of the interface class, finally, the defined method on the Web service reads the data in the interface class and interacts with a target JAVA framework system. The application guarantees the integrity of the data, reduces the burden of the interface, greatly improves the safety and stability of the target system, and thus makes the technology smoothly popularized and applied in the code scanning warehousing and inventory system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a computer network communication interface technology field, in particular to a data processing method for calling a POST request based on a.NET framework. BACKGROUND

[0002] With the continuous development of enterprise informatization construction, the integration degree among various information systems is high, and the development of interface middleware among systems becomes an important means for connecting enterprise information systems. The.NET framework and the JAVA framework are the mainstream frameworks of the current information system, but the development languages of the two are completely different, and how to connect the data between the two becomes the key.

[0003] In actual application, enterprise information systems are various and complex, and the information system of the JAVA framework is often connected by using a post request mode, and the mode is easy to realize for two JAVA framework systems, but it is difficult for the.NET framework system. SUMMARY

[0004] The application aims to provide a data processing method for calling a POST request based on a.NET framework, which is simple to operate, and processes the interface data between a C / S system under the.NET framework and JAVA by adjusting the interface technology and related software development, so as to meet the interface specification of JAVA and be suitable for the interface between the C / S system under the.NET framework and the JAVA framework system.

[0005] To achieve the above purpose, the application provides the following technical scheme.

[0006] A data processing method for calling a POST request based on a.NET framework comprises the following steps.

[0007] S1: developing a Web service interface

[0008] S101: referencing Newtonsoft.Json and System.Net files in the Web service, the two files are used for serializing and deserializing data in the.NET to be compatible with js and.NET foreground; and the WebRequest and WebResponse classes encapsulated in the files are used to connect the network protocols between two platforms.

[0009] S102: defining two data interface classes of SysInfo and DetailInfo on the Web service, encapsulating fields by using get and set methods, and not strictly limiting the field definition and quantity, so that the interface class has extensibility and flexibility.

[0010] S103: defining an implementation method postData on the Web service, calling the method must pass in two DataTable objects and the interface-defined Url address, the method receives parameters to create two SysInfo and DetailInfo objects respectively, assign values to the fields in SysInfo, and then loop through the detail data in the detail data block to assign values to the fields in DetailInfo;

[0011] S104: using the JsonConvert.SerializeObject method to perform Jason serialization conversion on the two created SysInfo and DetailInfo objects to generate two strings sysinfoJason and detailinfoJason, and finally splicing the two serialization results into the interface-defined Jason string;

[0012] S2: adjusting the.NET source system, the program implementation steps are as follows:

[0013] S201: before calling the Web service interface method, first create two DataTable objects, and the data items are respectively corresponding to the fields in SysInfo and DetailInfo;

[0014] S202: press the specific data into the two DataTable objects: loop through the business data set to be sent, create DataRow every loop, and add a row to the DataTable object, and assign specific business data to the corresponding column;

[0015] S203: call the postData method on the Web service with the two DataTable objects and the interface-defined Url as parameters, the method will splice the Url and the serialized sysinfoJason and detailinfoJason two json strings into a request body, and finally the request body is sent out through WebRequest to realize the POST request sending.

[0016] Compared with the prior art, the beneficial effects of the present application are:

[0017] The application provides a data processing method based on a.NET framework calling a POST request, which is applied to a cold-rolled product code scanning, warehousing and inventory information system of a cold-rolled general plant of China Baowu Ma Steel Co., Ltd. Before application, when a user uses the system, the docking with a target system is through a direct data access mode, which affects the stability of the operation of the target system and causes network security events. After application, through field tests for many times, the data is uploaded to an interface according to a data block format defined by the interface, the data is processed by an interactive operation of an interface middleware, and finally the data is sent out through a post request, which guarantees the integrity of the data, reduces the burden of the interface, and greatly improves the safety and stability of the target system, so that the technology is successfully applied to the code scanning, warehousing and inventory system. The application technology is widely applied to a special steel company code scanning and checking management system and a medium section code scanning, warehousing and delivery information system. BRIEF DESCRIPTION OF DRAWINGS

[0018] Figure 1 The application is a flowchart. DETAILED DESCRIPTION

[0019] The technical solutions in the embodiments of the application will be clearly and completely described with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the application.

[0020] Please refer to Figure 1 The application provides a data processing method based on a.NET framework calling a POST request, which comprises the following steps:

[0021] S1: developing a Web service interface:

[0022] S101: referencing Newtonsoft.Json and System.Net files in the Web service, the two files are used to serialize and deserialize data in the.NET to be compatible with js and.NET foreground; and WebRequest (Internet data access request) and WebResponse (Internet data access response) classes encapsulated in the files are used to pass through network protocols between the two platforms.

[0023] S102: Define two data interface classes, SysInfo (request body field class) and DetailInfo (http main information field class) on the Web service, encapsulate the fields using get and set methods, and do not strictly limit the field definition and quantity. According to the actual business requirements, the number of fields can be increased or decreased, so that the interface class has extensibility and flexibility;

[0024] S103: Define the implementation method postData (send data method) on the Web service. The method must be called with two DataTable (data table) objects and the Url address defined by the interface. After receiving the parameters, the method creates SysInfo and DetailInfo objects, assigns values to the fields in SysInfo, and then loops through the detail data in the detail data block to assign values to the fields in DetailInfo.

[0025] S104: Use the JsonConvert.SerializeObject method (serialize json string method) to serialize the SysInfo and DetailInfo objects to generate two strings, sysinfoJason and detailinfoJason. Finally, concatenate the two serialization results to form the Jason string defined by the interface.

[0026] S2: Adjust the.NET source system, and the program implementation steps are as follows:

[0027] S201: Before calling the Web service interface method, first create two DataTable (data table) objects, with data items corresponding to the fields in SysInfo and DetailInfo.

[0028] S202: Press the specific data into the two DataTable objects: loop through the business data set to be sent (this data set can be a specific format string, array, data table, etc.), create DataRow (data row) for each loop, and add the row to the DataTable object. Assign specific business data to the corresponding column.

[0029] S203: Call the postData method on the Web service with the two DataTable (data table) objects and the Url defined by the interface as parameters. This method will concatenate the Url and the serialized sysinfoJason and detailinfoJason json strings into a request body. Finally, the request body is sent out through WebRequest (Internet access data request), implementing the POST request sending.

[0030] The embodiment proposes that a Web service is first built between the two systems, so that the two systems can communicate with each other; a general interface class is developed on the Web service, the format of all data in the interface class is defined in advance, the interface class uniformly processes the data to be sent, and performs data conversion, and all data operations are implemented based on the interface class; secondly, the Web service is referenced in the.NET system, when the source system runs the program, the program creates a data block of the data to be sent and calls the interface in the Web service according to the format defined by the interface class, finally the defined method on the Web service reads the data in the interface class and interacts with the target JAVA framework system.

[0031] In summary, the data processing method based on the.NET framework calling the POST request of the application, through multiple tests on the spot, by uploading the data to the interface according to the data block format defined by the interface, the data interaction operation is processed by the interface middleware, and finally sent out through the post request, which guarantees the integrity of the data, reduces the burden of the interface, and greatly improves the security and stability of the target system, so that the technology is successfully applied in the code scanning warehousing and inventory system.

[0032] The above is only the preferred embodiment of the application, but the protection scope of the application is not limited to this, any person skilled in the art can make equivalent replacement or change according to the technical solution and the inventive concept of the application within the technical range disclosed by the application, which should be covered in the protection scope of the application.

Claims

1. A data processing method for calling POST requests based on the .NET framework, characterized in that, Includes the following steps: S1: Develop Web service interfaces: S101: Reference the Newtonsoft.Json and System.Net files in the web service. The purpose of these two files is to serialize and deserialize data in .NET to ensure compatibility between JavaScript and the .NET front-end; at the same time, use the WebRequest and WebResponse classes encapsulated in the files to establish network protocols between the two platforms. S102: Define two data interface classes, SysInfo and DetailInfo, on the Web service. Use get and set methods to encapsulate the fields. The definition and number of fields are not strictly limited. Fields can be added or removed according to actual business needs, making the interface class extensible and flexible. S103: Define the implementation method postData on the Web service. When calling this method, two DataTable objects and the URL defined in the interface must be passed in. After receiving the parameters, the method creates two objects, SysInfo and DetailInfo, respectively. The fields in SysInfo are assigned values. Then, the detailed data in the detailed data block is traversed in a loop to achieve the assignment of values ​​to the fields in DetailInfo. S104: Use the JsonConvert.SerializeObject method to perform JSON serialization on the two created SysInfo and DetailInfo objects to generate two strings sysinfoJason and detailinfoJason. Finally, concatenate the two serialization results into the JSON string defined by the interface. S2: Adjusting the .NET source system, the steps for program implementation are as follows: S201: Before calling the Web service interface method, you must first create two DataTable objects, where the data items are the fields in SysInfo and DetailInfo respectively; S202: Push the specific data into two DataTable objects: Loop through the business dataset to be sent, create a DataRow in each loop, add rows to the DataTable object, and assign the specific business data to the corresponding columns; S203: Call the postData method on the web service with two DataTable objects and the URL defined in the interface as parameters. This method will concatenate the URL and the serialized JSON strings sysinfoJason and detailinfoJason into a request body. Finally, the request body is sent out through WebRequest to realize the POST request.

Citation Information

Patent Citations

  • Interface method for realizing mutual parameter transmission of Winform and Web through Json serialization manner

    CN105893059A

  • Interface test method based on post request

    CN108900369A