A method, device, medium and program product for determining enumeration value

By parsing the node tree structure of the WSDL document, obtaining and traversing the enumeration nodes, the difficulty in obtaining the enumeration value of simple type parameters in the WSDL service interface is solved, and the accurate parsing and use of the enumeration value is achieved.

CN115442204BActive Publication Date: 2024-10-01SHANGHAI HARND TECH DEV CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211031144.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-26
Publication Date
2024-10-01
Estimated Expiration
2042-08-26

AI Technical Summary

Technical Problem

In the automated script maintenance of WSDL service interfaces, there are difficulties in obtaining enumeration values ​​in simple type parameter settings. It is difficult for existing tools to effectively parse and obtain enumeration values ​​as parameter values.

Method used

By parsing the node tree structure in the Web Services Description Language (WSDL) document, we obtain the root node, mode node and simple type node, traverse the enumeration nodes under the restriction node, determine the enumeration value data, and obtain the WSDL document Defined enumeration value.

Benefits of technology

It achieves accurate parsing and acquisition of enumeration values ​​in WSDL documents, solves the problem of obtaining enumeration values ​​for simple type request parameters, and can directly put enumeration values ​​into the parameter request body as default assignments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115442204B_ABST
    Figure CN115442204B_ABST
Patent Text Reader

Abstract

The purpose of the present application is to provide a method, device, medium and program product for determining enumeration values, the method comprising: parsing the node tree structure in a network service description language document to obtain the root node of the network service description language document, if there is a mode node under the root node, obtaining at least one simple type node under the mode node; if there is a restriction node under the at least one simple type node, traversing one or more enumeration nodes under the restriction node, and determining the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes. When the present application is used, an enumeration value can be directly taken out from the enumeration value data as the default assignment of the simple type node and put into the parameter request body, so as to solve the problem of obtaining the enumeration value of the simple type request parameter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a technology for determining enumeration values. Background Art

[0002] In addition to the common Restful interface, the current interface testing also requires testing of the WSDL service interface. For the WSDL service interface, in addition to interface verification through interface testing tools that support the soap protocol (SoapUI, postman, etc.), there is also a relatively more independent, flexible and highly extensible automated script maintenance for interface testing. The focus of automated script maintenance for the WSDL service interface is to parse the WSDL document to obtain the interface and the corresponding request body and response body. Among them, when the simpleType parameter defined in the WSDL document is set with an enumeration value, it is necessary to obtain the enumeration value as the parameter value and put it in the parameter request body. Summary of the invention

[0003] One object of the present application is to provide a method, device, medium and program product for determining an enumeration value.

[0004] According to one aspect of the present application, a method for determining an enumeration value is provided, the method comprising:

[0005] By parsing the node tree structure in the network service description language document, a root node of the network service description language document is obtained, and if a mode node exists under the root node, at least one simple type node under the mode node is obtained;

[0006] If there is a restriction node under the at least one simple type node, traverse one or more enumeration nodes under the restriction node, and determine the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes.

[0007] According to one aspect of the present application, a computer device for determining an enumeration value is provided, the device comprising:

[0008] A module, configured to parse a node tree structure in a network service description language document to obtain a root node of the network service description language document, and if a pattern node exists under the root node, obtain at least one simple type node under the pattern node;

[0009] Module one and module two are used for traversing one or more enumeration nodes under the restriction node if there is a restriction node under the at least one simple type node, and determining the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes.

[0010] According to one aspect of the present application, a computer device for determining an enumeration value is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the operation of any of the methods described above.

[0011] According to one aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the operation of any of the methods described above is implemented.

[0012] According to one aspect of the present application, a computer program product is provided, including a computer program, which implements the steps of any of the above methods when executed by a processor.

[0013] Compared with the prior art, the present application parses the node tree structure in a network service description language (WSDL) document to obtain the root node of the network service description language document. If a pattern node exists under the root node, at least one simple type node under the pattern node is obtained; if a restriction node exists under the at least one simple type node, one or more enumeration nodes under the restriction node are traversed, and the enumeration value data corresponding to the network service description language document is determined according to the node values ​​of the one or more enumeration nodes. Thus, the present application can obtain the enumeration value data composed of the node values ​​of all enumeration nodes under the simple type node which has enumeration value restriction and is the child node of the pattern node defined in the WSDL document. When in use, an enumeration value can be directly taken out from the enumeration value data and put into the parameter request body as the default assignment of the simple type node, thereby solving the problem of obtaining the enumeration value of the simple type request parameter. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0015] Figure 1 A flow chart of a method for determining an enumeration value according to an embodiment of the present application is shown;

[0016] Figure 2 A flow chart of a method for determining an enumeration value according to an embodiment of the present application is shown;

[0017] Figure 3 A structural diagram of a computer device for determining an enumeration value according to an embodiment of the present application is shown;

[0018] Figure 4 An exemplary system is shown that can be used to implement the various embodiments described in this application.

[0019] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0020] The present application is described in further detail below in conjunction with the accompanying drawings.

[0021] In a typical configuration of the present application, the terminal, the device of the service network and the trusted party all include one or more processors (eg, a central processing unit (CPU)), an input / output interface, a network interface and a memory.

[0022] Memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash memory. Memory is an example of a computer-readable medium.

[0023] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, Phase-Change Memory (PCM), Programmable Random Access Memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of random access memory (RAM), Read-Only Memory (ROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0024] The devices referred to in this application include but are not limited to terminals, network devices, or devices formed by integrating terminals and network devices through a network. The terminal includes but is not limited to any mobile electronic product that can interact with a user (for example, interact with a user through a touchpad), such as a smart phone, a tablet computer, etc. The mobile electronic product can use any operating system, such as an Android operating system, an iOS operating system, etc. Among them, the network device includes an electronic device that can automatically perform numerical calculations and information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a programmable logic device (PLD), a field programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc. The network device includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud composed of a plurality of servers; here, the cloud is composed of a large number of computers or network servers based on cloud computing (Cloud Computing), wherein cloud computing is a type of distributed computing, a virtual supercomputer composed of a group of loosely coupled computer sets. The network includes but is not limited to the Internet, wide area network, metropolitan area network, local area network, VPN network, wireless self-organizing network (Ad Hoc network), etc. Preferably, the device may also be a program running on the terminal, network device, or a device formed by integrating the terminal and network device, network device, touch terminal, or network device and touch terminal through a network.

[0025] Of course, those skilled in the art should understand that the above-mentioned devices are only examples, and other existing or future devices that are applicable to the present application should also be included in the scope of protection of the present application and are included here by reference.

[0026] In the description of the present application, “plurality” means two or more, unless otherwise clearly and specifically defined.

[0027] Figure 1A flow chart of a method for determining an enumeration value according to an embodiment of the present application is shown, and the method includes step S11 and step S12. In step S11, the computer device parses the node tree structure in the network service description language document to obtain the root node of the network service description language document, and if there is a mode node under the root node, obtains at least one simple type node under the mode node; in step S12, if there is a restriction node under the at least one simple type node, the computer device traverses one or more enumeration nodes under the restriction node, and determines the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes.

[0028] In step S11, the computer device parses the node tree structure in the network service description language document to obtain the root node of the network service description language document, and if there is a mode node under the root node, obtains at least one simple type node under the mode node. In some embodiments, the network service description language (Web Services Description Language, wsdl) document is a document written in XML, which can be used to describe a certain Web Service and how to access the Web Service. It can describe the interface provided by the network service, the location of the interface and how to access (call) the interface. In some embodiments, the network service description language document includes multiple different types of nodes, which are organized together according to the tree data structure, and the network service description language uses these nodes to describe a certain network service. In some embodiments, the link address of the network service description language document is first obtained, the network service description language document is loaded according to the link address, and a predetermined parsing library (for example, libraries based on python3 for parsing network service description language documents include suds-jurko and zeep) is used to parse the node tree structure in the network service description language document to obtain the root node in the node tree structure, namely, the definitions node or the wsdl:definitions node, where "wsdl" refers to the namespace prefix of the network service description language defined in the root node, for example, xmlns:wsdl="http: / / shcemas.xmlsoap.org / wsdl / ", and the command spaces corresponding to different versions of the network service description language may be different. Currently, there are versions 1.1 and 2.0. The version difference is reflected in the different node tags (tags) defined in the network service description language document. Here, version 1.1 is taken as an example. In some embodiments, it is determined whether there is a schema node, namely, a schema node or an xs:schema node under the root node, where "xs" refers to the namespace prefix of the XML schema definition defined in the schema node, for example, xmlns:xs=" http: / / www.w3.org / 2001 / XML SchemaDifferent versions of XML schema definition may correspond to different command spaces. XML schema definition is a document standard published by W3C to define WSDL data types. There are three versions (1999, 2000 / 10, 2001). Here, the 2001 version is taken as an example. The tags of all nodes under the schema node need to reference the namespace prefix, for example, the "xs:element" node, where the node B under node A involved in this application means that node B is a child node or descendant node of node A (for example, a child node of a child node). In some embodiments, if there is a schema node under the root node, at least one simple type node under the schema node, i.e., a simpleType node or an xs:simpleType node, is obtained.

[0029] In step S12, if there is a restriction node under the at least one simple type node, the computer device traverses one or more enumeration nodes under the restriction node, and determines the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes. In some embodiments, for each simple type node, if the simple type node has a child node that is a restriction node, i.e., a restriction node or an xs:restriction node, all enumeration nodes, i.e., enumeration nodes or xs:enumeration nodes, under the restriction node are traversed to obtain the node value of each enumeration node and put it into the enumeration value data corresponding to the network service description language document. For example, a simple type node includes two enumeration nodes.<xs:enumeration value=“EveryMin”> and<xs:enumeration value=“EveryHour”> , then put the corresponding node values ​​"EveryMin" and "EveryHour" into the enumeration value data. This application can obtain the enumeration value data consisting of the node values ​​of all enumeration nodes under the simple type node that has enumeration value restrictions and is the child node of the pattern node defined by the wsdl document. When used, an enumeration value can be directly taken from the enumeration value data as the default assignment of the simple type node and put into the parameter request body, which can solve the problem of obtaining the enumeration value of the simple type request parameter.

[0030] In some embodiments, the step S11 includes: the computer device parses the node tree structure in the network service description language document to obtain the root node of the network service description language document, and if there is a type node under the root node, and there is a mode node under the type node, obtain at least one simple type node under the mode node. In some embodiments, first determine whether there is a type node, i.e., a types node or a wsdl:types node, under the root node, where "wsdl" refers to the namespace prefix of the network service description language defined in the root node, and then determine whether there is a mode node under the type node.

[0031] In some embodiments, the method further includes: the computer device obtains the schema node under the root node according to the preset XML schema definition namespace information and the network service description language namespace information. In some embodiments, it is necessary to preset the namespace information of the XML schema definition (XML Schema Definition, xsd) and the namespace information of the network service description language (Web Service Description Language, wsdl), the namespace information of the XML schema definition includes a first namespace prefix (for example, "xsd") and its corresponding first link address, the namespace information of the network service description language includes a second namespace prefix (for example, "wsdl") and its corresponding first link address, the first link address is used to identify the version of the xsd, and the second link address is used to identify the version of the wsdl, xsd is a document standard published by W3C for defining WSDL data types, with three versions (1999, 2000 / 10, 2001), and wsdl is a standard format for describing web services, currently there are 1.1 and 2.0 versions, for example, "xsd": http: / / www.w3.org / 2001 / XML Schema , #XSD 2001 version, "wsdl": "http: / / schemas.xmlsoap.org / wsdl / ", #WSDL 1.1 version. In some embodiments, based on the XML schema definition namespace information and the network service description language namespace information, the schema node under the type node under the root node, that is, the "wsdl:types / xsd:schema" node, can be found, that is, the "wsdl:types" type node is a child node of the root node, and the "xsd:schema" schema node is a child node of the type node.

[0032] In some embodiments, the at least one simple type node includes at least one first type node; wherein, obtaining the at least one simple type node under the pattern node includes: obtaining the first node type of at least one first element node under the pattern node; obtaining at least one first simple type node under the pattern node whose corresponding node name matches the first node type. In some embodiments, first obtain at least one first element node under the pattern node, i.e., an element node or an xs:element node, and then search for at least one first simple type node whose corresponding node name matches the first node type of one of the at least one first element node in the pattern node among one or more first simple type nodes, i.e., simpleType nodes or xs:simpleType nodes. For example, the first element node is<xs:element name=“queryFlowData”type=“queryFlowData”> , the node type of the first element node is "queryFlowData". In some embodiments, the node name of the first simple type node matches the first node type, which may mean that the node name and the first node type are the same string, or, if the first node type includes a custom namespace prefix, the match may also mean that the node name and the first node type after the custom namespace prefix is ​​removed are the same string. For example, if the first simple type node is<xs:simpleType name=“queryFlowData”> , then the node name of the first simple type node is "queryFlowData", and the first element node is<xs:element name=“queryFlowData”type=“tns:queryFlowData”> , where "tns" is a custom namespace prefix defined in the pattern node, for example, xmlns:tns="http: / / ***.***", it can be determined that the node name of the first simple type node matches the first node type of the first element node.

[0033] In some embodiments, the first node type includes a custom namespace prefix in the pattern node. In some embodiments, the first node type of the first element node needs to include a custom namespace prefix defined in the pattern node. If the first node type of the first element node does not include the custom namespace prefix, the first element node and the first node type will be ignored, and no processing will be performed on the first element node and the first node type. For example, if xmlns:tns="http: / / ***.***" is defined in the pattern node, that is, the custom namespace prefix is ​​"tns", then the at least one first element node needs to satisfy that the first node type of each first element node needs to include the custom namespace prefix "tns". For example, the first element node is<xs:element name=“queryFlowData”type=“tns:queryFlowData”> .

[0034] In some embodiments, the at least one simple type node includes at least one second type node; wherein the method further comprises: the computer device obtains a complex type node whose corresponding node name under the pattern node matches the first node type; if a sequence node exists under the complex type node, obtains the second node type of at least one second element node under the sequence node; obtains at least one second simple type node whose corresponding node name under the pattern node matches the second node type. In some embodiments, a complex type node, i.e., a complexType node or an xs:complexType node, whose corresponding node name matches the first node type of one of the at least one first element nodes is searched under the pattern node, wherein the match may refer to the node name being the same string as the first node type, or, if the first node type includes a custom namespace prefix (e.g., "tns"), the match may also refer to the node name being the same string as the first node type after the custom namespace prefix is ​​removed. In some embodiments, if there is a sequence node, i.e., a sequence node or an xs:sequence node, under the complex type node, a second node type of at least one second element node, i.e., an element node or an xs:element node, under the sequence node is obtained, and the second node type needs to include a custom namespace prefix (for example, "tns") defined in the pattern node. If the second node type of a second element node does not include the custom namespace prefix, the second element node and the second node type will be ignored, and no processing will be performed on the second element node and the second node type, wherein the second element node is the same or similar to the first element node described above, and will not be repeated here, and then at least one second simple type node whose corresponding node name matches the second node type is searched in one or more second simple type nodes under the pattern node, wherein the second simple type node is the same or similar to the first simple type node described above, and will not be repeated here.

[0035] In some embodiments, the determining of the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes includes: determining the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes and the node name of the at least one simple type node. In some embodiments, for each simple type node under the pattern node, the node name of the simple type node, i.e., the node value of each enumeration node under the simple type node, is placed in the enumeration value data corresponding to the network service description language document. For example, the simple type node<xs:simpleType name=“flowAccuracy”> The following includes two enumeration nodes,<xs:enumeration value=“EveryMin”> and<xs:enumeration value=“EveryHour”> , the node name "flowAccuracy" and the corresponding node values ​​"EveryMin" and "EveryHour" are put into the enumerated value data. In some embodiments, the enumerated value data stores the mapping relationship between the node name and the node value, and one or more node values ​​corresponding to a certain node name can be found in the enumerated value data.

[0036] In some embodiments, the enumeration value data includes one or more key-value pairs, the key data of each key-value pair is the node name of a simple type node, and the value data of the key-value pair is an enumeration value sequence composed of node values ​​of one or more enumeration nodes under the simple type node. In some embodiments, the enumeration value data includes one or more key-value pairs (for example, a Dict dictionary data structure), the key data (key) of each key-value pair is the node name of a simple type node, and the value data (value) of the key-value pair is an enumeration value sequence composed of node values ​​of one or more enumeration nodes under the simple type node (for example, a list data structure or an array data structure).

[0037] In some embodiments, the method further includes: the computer device determines whether there is at least one import node under the root node; if so, obtains the document link address of other external network service description language documents imported by the at least one import node, and loads the other external network service description language documents according to the document link address; obtains one or more second enumeration nodes by parsing the node tree structure in the other external network service description language documents, and updates the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more second enumeration nodes. In some embodiments, it is also determined whether there is an import node, i.e., an import node or a wsdl:import node, under the root node. If so, obtains the document link address of other external network service description language documents imported by the import node. For example, the import node is<wsdl:import location=“XXX”> , then the document link address of the other external network service description language document imported by the entry node is the "XXX". In some embodiments, the other external network service description language document is loaded, and the node tree structure in the other external network service description language document is parsed to obtain one or more second enumeration nodes, and the node value of each second enumeration node is also put into the enumeration value data corresponding to the network service description language document. The specific parsing method is the same or similar to the method of parsing the node tree structure in the network service description language document described above, and will not be repeated here.

[0038] In some embodiments, the method further comprises: the computer device obtains the interface node in the network service description language document, if there is at least one first request parameter of a simple type corresponding to the parameter type in the interface node, according to the type name of the simple type, searching the enumeration value data for at least one enumeration value corresponding to the type name, and determining the default value of the first request parameter according to the at least one enumeration value. In some embodiments, the interface node under the root node in the node tree structure of the network service description language document, i.e., the operation node, is obtained, if there is at least one first request parameter (input element) of a simpleType type corresponding to the interface node, then according to the type name of the simple type, searching the enumeration value data corresponding to the type name in the network service description language document for at least one enumeration value (i.e., the node value of the enumeration node), and then determining the default value of the first request parameter according to the at least one enumeration value, for example, randomly taking an enumeration value from the at least one enumeration value and assigning it to the first request parameter, and assembling the parameter request body corresponding to the interface node, and initiating the corresponding network request based on the parameter request body.

[0039] In some embodiments, wherein the step of searching the enumeration value data for at least one enumeration value corresponding to the type name and determining the default value of the first request parameter according to the at least one enumeration value comprises: searching the enumeration value sequence corresponding to the type name in the enumeration value data, wherein the enumeration value sequence includes at least one ordered enumeration value; and using the enumeration value ranked first in the enumeration value sequence as the default value of the first request parameter. In some embodiments, according to the type name of the simple type, the enumeration value sequence corresponding to the type name is searched in the enumeration value data corresponding to the network service description language document, wherein the enumeration value sequence includes at least one ordered enumeration value (i.e., the node value of the enumeration node), and then the enumeration value ranked first in the enumeration value sequence is assigned to the first request parameter.

[0040] In some embodiments, the method further includes: if there is at least one second request parameter whose corresponding parameter type is a complex type in the interface node, determining whether there is a target sub-request parameter whose corresponding parameter type is a simple type in at least one sub-request parameter corresponding to the complex type; if so, based on the type name of the simple type, searching the enumerated value data for at least one second enumeration value corresponding to the type name, determining a second default value of the target sub-request parameter based on the at least one second enumeration value, and determining a default value of the second request parameter based on the second default value and the parameter name of the target sub-request parameter. In some embodiments, an interface node, i.e., an operation node, under a root node in a node tree structure of the network service description language document is obtained. If there is at least one corresponding second request parameter (inputelement) of complexType in the interface node, determine whether there is a corresponding target sub-request parameter of simpleType in at least one sub-request parameter corresponding to the complex type. If so, search for at least one enumeration value (i.e., a node value of an enumeration node) corresponding to the type name in the enumeration value data corresponding to the network service description language document according to the type name of the simple type. Then, according to the at least one enumeration value, determine a default value of the target sub-request parameter. For example, assign the first enumeration value in the at least one enumeration value to the target sub-request parameter. Then, according to the default value and parameter name of the target sub-request parameter, determine a default value of the second request parameter. The parameter request body corresponding to the interface node is assembled based on this, and a corresponding network request is initiated based on the parameter request body.

[0041] Figure 2 A flow chart of a method for determining an enumeration value according to an embodiment of the present application is shown.

[0042] like Figure 2 Described, step 1 is to input the wsdl link to be parsed, and initialize the zeep.Client (client) object as the input parameter of the encapsulation method by using the zeep parsing library, step 2 is to parse the element (ie node) tree structure defined by the wsdl document in the encapsulation method, find the restriction node under the simpleType node of the child element of xsd:schema, and obtain the enumeration enumeration value, step 3 is to determine whether there is a wsdl:import node under the root node, and if so, obtain the external wsdl link defined by the node, and then return to step 1, iterate the previous method flow twice, step 4 is to summarize the Dict dictionary data of the enumeration enumeration values ​​obtained in steps 2 and 3, and return it as the output parameter of the enumeration method.

[0043] Figure 3 A computer device structure diagram for determining enumeration values ​​according to an embodiment of the present application is shown, and the device includes a first module 11 and a second module 12. The first module 11 is used to parse the node tree structure in the network service description language document to obtain the root node of the network service description language document, and if there is a pattern node under the root node, obtain at least one simple type node under the pattern node; the first module 12 is used to traverse one or more enumeration nodes under the restriction node if there is a restriction node under the at least one simple type node, and determine the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes.

[0044] A module 11 is used to parse the node tree structure in the network service description language document to obtain the root node of the network service description language document, and if there is a mode node under the root node, obtain at least one simple type node under the mode node. In some embodiments, the network service description language (Web Services Description Language, wsdl) document is a document written in XML, which can be used to describe a certain Web Service and how to access the Web Service. It can describe the interface provided by the network service, the location of the interface and how to access (call) the interface. In some embodiments, the network service description language document includes multiple different types of nodes, which are organized together according to the tree data structure, and the network service description language uses these nodes to describe a certain network service. In some embodiments, the link address of the network service description language document is first obtained, the network service description language document is loaded according to the link address, and a predetermined parsing library (for example, libraries based on python3 for parsing network service description language documents include suds-jurko and zeep) is used to parse the node tree structure in the network service description language document to obtain the root node in the node tree structure, namely, the definitions node or the wsdl:definitions node, where "wsdl" refers to the namespace prefix of the network service description language defined in the root node, for example, xmlns:wsdl="http: / / shcemas.xmlsoap.org / wsdl / ", and the command spaces corresponding to different versions of the network service description language may be different. Currently, there are versions 1.1 and 2.0. The version difference is reflected in the different node tags (tags) defined in the network service description language document. Here, version 1.1 is taken as an example. In some embodiments, it is determined whether there is a schema node, namely, a schema node or an xs:schema node under the root node, where "xs" refers to the namespace prefix of the XML schema definition defined in the schema node, for example, xmlns:xs=" http: / / www.w3.org / 2001 / XML SchemaDifferent versions of XML schema definition may correspond to different command spaces. XML schema definition is a document standard published by W3C to define WSDL data types. There are three versions (1999, 2000 / 10, 2001). Here, the 2001 version is taken as an example. The tags of all nodes under the schema node need to reference the namespace prefix, for example, the "xs:element" node, where the node B under node A involved in this application means that node B is a child node or descendant node of node A (for example, a child node of a child node). In some embodiments, if there is a schema node under the root node, at least one simple type node under the schema node, i.e., a simpleType node or an xs:simpleType node, is obtained.

[0045] Module 12 is used to traverse one or more enumeration nodes under the restriction node if there is a restriction node under the at least one simple type node, and determine the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes. In some embodiments, for each simple type node, if the simple type node has a child node that is a restriction node, i.e., a restriction node or an xs:restriction node, then all enumeration nodes, i.e., enumeration nodes or xs:enumeration nodes, under the restriction node are traversed to obtain the node value of each enumeration node and put it into the enumeration value data corresponding to the network service description language document. For example, a simple type node includes two enumeration nodes.<xs:enumeration value=“EveryMin”> and<xs:enumeration value=“EveryHour”> , then put the corresponding node values ​​"EveryMin" and "EveryHour" into the enumeration value data. This application can obtain the enumeration value data consisting of the node values ​​of all enumeration nodes under the simple type node that has enumeration value restrictions and is the child node of the pattern node defined by the wsdl document. When used, an enumeration value can be directly taken from the enumeration value data as the default assignment of the simple type node and put into the parameter request body, which can solve the problem of obtaining the enumeration value of the simple type request parameter.

[0046] In some embodiments, the module 11 is used to: parse the node tree structure in the network service description language document to obtain the root node of the network service description language document, and if there is a type node under the root node and there is a mode node under the type node, obtain at least one simple type node under the mode node. Figure 1The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0047] In some embodiments, the device is further used to: obtain the schema node under the root node according to the preset XML schema definition namespace information and network service description language namespace information. Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0048] In some embodiments, the at least one simple type node includes at least one first type node; wherein, obtaining the at least one simple type node under the pattern node includes: obtaining the first node type of at least one first element node under the pattern node; obtaining at least one first simple type node whose corresponding node name under the pattern node matches the first node type. Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0049] In some embodiments, the first node type includes a custom namespace prefix in the pattern node. Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0050] In some embodiments, the at least one simple type node includes at least one second type node; wherein the device is further used to: obtain a complex type node whose corresponding node name under the pattern node matches the first node type; if there is a sequence node under the complex type node, obtain the second node type of at least one second element node under the sequence node; obtain at least one second simple type node whose corresponding node name under the pattern node matches the second node type. Here, the relevant operations are the same as Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0051] In some embodiments, the step of determining the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes includes: determining the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes and the node name of the at least one simple type node. Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0052] In some embodiments, the enumeration value data includes one or more key-value pairs, the key data of each key-value pair is the node name of a simple type node, and the value data of the key-value pair is an enumeration value sequence composed of the node values ​​of one or more enumeration nodes under the simple type node. Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0053] In some embodiments, the device is also used to: determine whether there is at least one import node under the root node; if so, obtain the document link address of other external network service description language documents imported by the at least one import node, and load the other external network service description language documents according to the document link address; obtain one or more second enumeration nodes by parsing the node tree structure in the other external network service description language documents, and update the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more second enumeration nodes. Here, the relevant operations are the same as Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0054] In some embodiments, the device is further used to: obtain an interface node in the network service description language document, if there is at least one first request parameter of a simple type corresponding to the parameter type in the interface node, search for at least one enumeration value corresponding to the type name in the enumeration value data according to the type name of the simple type, and determine the default value of the first request parameter according to the at least one enumeration value. Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0055] In some embodiments, the step of searching the enumeration value data for at least one enumeration value corresponding to the type name and determining the default value of the first request parameter according to the at least one enumeration value comprises: searching the enumeration value data for an enumeration value sequence corresponding to the type name, wherein the enumeration value sequence comprises at least one ordered enumeration value; and using the enumeration value ranked first in the enumeration value sequence as the default value of the first request parameter. Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0056] In some embodiments, the device is also used to: if there is at least one second request parameter with a complex parameter type in the interface node, determine whether there is a target sub-request parameter with a simple parameter type in at least one sub-request parameter corresponding to the complex type; if so, search the enumerated value data for at least one second enumeration value corresponding to the type name according to the type name of the simple type, determine the second default value of the target sub-request parameter according to the at least one second enumeration value, and determine the default value of the second request parameter according to the second default value and the parameter name of the target sub-request parameter. Here, the relevant operations are the same as Figure 1 The embodiments shown are the same or similar, so they are not described again and are incorporated herein by reference.

[0057] In addition to the methods and devices described in the above embodiments, the present application also provides a computer-readable storage medium, which stores computer code. When the computer code is executed, the method described in any of the preceding items is executed.

[0058] The present application also provides a computer program product. When the computer program product is executed by a computer device, the method described in any of the preceding items is executed.

[0059] The present application also provides a computer device, the computer device comprising:

[0060] one or more processors;

[0061] a memory for storing one or more computer programs;

[0062] When the one or more computer programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any of the preceding items.

[0063] Figure 4 An exemplary system that can be used to implement various embodiments described in this application is shown;

[0064] like Figure 4 In some embodiments shown, the system 300 can be used as any of the devices in the various described embodiments. In some embodiments, the system 300 may include one or more computer-readable media (e.g., system memory or NVM / storage device 320) with instructions and one or more processors (e.g., (one or more) processors 305) coupled to the one or more computer-readable media and configured to execute instructions to implement modules to perform the actions described in this application.

[0065] For one embodiment, system control module 310 may include any suitable interface controller to provide any suitable interface to at least one of processor(s) 305 and / or any suitable device or component in communication with system control module 310 .

[0066] The system control module 310 may include a memory controller module 330 to provide an interface to the system memory 315. The memory controller module 330 may be a hardware module, a software module, and / or a firmware module.

[0067] The system memory 315 may be used, for example, to load and store data and / or instructions for the system 300. For one embodiment, the system memory 315 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the system memory 315 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).

[0068] For one embodiment, system control module 310 may include one or more input / output (I / O) controllers to provide interfaces to NVM / storage device 320 and communication interface(s) 325 .

[0069] For example, NVM / storage device 320 may be used to store data and / or instructions. NVM / storage device 320 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).

[0070] NVM / storage device 320 may include storage resources that are physically part of the device on which system 300 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 320 may be accessed over a network via communication interface(s) 325.

[0071] Communication interface(s) 325 may provide an interface for system 300 to communicate over one or more networks and / or with any other suitable devices. System 300 may wirelessly communicate with one or more components of a wireless network in accordance with any of one or more wireless network standards and / or protocols.

[0072] For one embodiment, at least one of the processor(s) 305 may be packaged together with the logic of one or more controllers of the system control module 310 (e.g., the memory controller module 330). For one embodiment, at least one of the processor(s) 305 may be packaged together with the logic of one or more controllers of the system control module 310 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 305 may be integrated on the same die with the logic of one or more controllers of the system control module 310. For one embodiment, at least one of the processor(s) 305 may be integrated on the same die with the logic of one or more controllers of the system control module 310 to form a system on chip (SoC).

[0073] In various embodiments, the system 300 may be, but is not limited to: a server, a workstation, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the system 300 may have more or fewer components and / or a different architecture. For example, in some embodiments, the system 300 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application specific integrated circuit (ASIC), and a speaker.

[0074] It should be noted that the application can be implemented in software and / or a combination of software and hardware, for example, can be implemented using an application specific integrated circuit (ASIC), a general purpose computer or any other similar hardware device. In one embodiment, the software program of the application can be executed by a processor to implement the steps or functions described above. Similarly, the software program of the application (including relevant data structures) can be stored in a computer-readable recording medium, for example, a RAM memory, a magnetic or optical drive or a floppy disk and similar devices. In addition, some steps or functions of the application can be implemented using hardware, for example, as a circuit that cooperates with a processor to perform each step or function.

[0075] In addition, a part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0076] Communication media include media by which communication signals containing, for example, computer readable instructions, data structures, program modules, or other data are transmitted from one system to another. Communication media may include guided transmission media such as cables and wires (e.g., fiber optic, coaxial, etc.) and wireless (unguided transmission) media that can propagate energy waves, such as acoustic, electromagnetic, RF, microwave, and infrared. Computer readable instructions, data structures, program modules, or other data may be embodied as a modulated data signal in, for example, a wireless medium such as a carrier wave or similar mechanism such as embodied as part of spread spectrum technology. The term "modulated data signal" refers to a signal whose one or more characteristics are changed or set in such a manner as to encode information in the signal. Modulation may be analog, digital, or a hybrid modulation technique.

[0077] By way of example and not limitation, computer-readable storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. For example, computer-readable storage media include, but are not limited to, volatile memory, such as random access memory (RAM, DRAM, SRAM); and non-volatile memory, such as flash memory, various read-only memories (ROM, PROM, EPROM, EEPROM), magnetic and ferromagnetic / ferroelectric memories (MRAM, FeRAM); and magnetic and optical storage devices (hard disks, magnetic tapes, CDs, DVDs); or other media now known or later developed that can store computer-readable information / data for use by a computer system.

[0078] Here, according to one embodiment of the present application, a device is included, which includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein, when the computer program instructions are executed by the processor, the device is triggered to run the methods and / or technical solutions based on the aforementioned multiple embodiments of the present application.

[0079] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is limited by the attached claims rather than the above description, so it is intended to include all changes that fall within the meaning and scope of the equivalent elements of the claims in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

Claims

1. A method for determining an enumeration value, wherein: The method includes: By parsing the node tree structure in the network service description language document, a root node of the network service description language document is obtained, and if a mode node exists under the root node, at least one simple type node under the mode node is obtained; If there is a restriction node under the at least one simple type node, traverse one or more enumeration nodes under the restriction node, and determine the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes; The at least one simple type node includes at least one first type node, and the obtaining of at least one simple type node under the pattern node includes: Obtaining a first node type of at least one first element node under the pattern node; Obtain at least one first simple type node whose corresponding node name under the pattern node matches the first node type, wherein the node name and the first node type are the same string, or the node name and the first node type after removing the custom namespace prefix are the same string.

2. The method according to claim 1, wherein: The step of parsing the node tree structure in the network service description language document to obtain the root node of the network service description language document, and if a pattern node exists under the root node, obtaining at least one simple type node under the pattern node includes: By parsing the node tree structure in the network service description language document, the root node of the network service description language document is obtained. If there is a type node under the root node and a mode node under the type node, at least one simple type node under the mode node is obtained.

3. The method according to claim 1 or 2, wherein: The method further comprises: According to the preset XML schema definition namespace information and network service description language namespace information, the schema node under the root node is obtained.

4. The method according to claim 1, wherein: The first node type includes a custom namespace prefix in the schema node.

5. The method according to claim 1, wherein: The at least one simple type node includes at least one second type node; Wherein, the method further comprises: Obtaining a complex type node whose corresponding node name under the pattern node matches the first node type; If there is a sequence node under the complex type node, obtaining a second node type of at least one second element node under the sequence node; At least one second simple type node whose corresponding node name under the pattern node matches the second node type is obtained.

6. The method according to claim 1, wherein: The step of determining the enumeration value data corresponding to the network service description language document according to the node values ​​of the one or more enumeration nodes includes: According to the node values ​​of the one or more enumeration nodes and the node name of the at least one simple type node, the enumeration value data corresponding to the network service description language document is determined.

7. The method according to claim 6, wherein: The enumeration value data includes one or more key-value pairs, the key data of each key-value pair is the node name of a simple type node, and the value data of the key-value pair is an enumeration value sequence composed of node values ​​of one or more enumeration nodes under the simple type node.

8. The method according to claim 1, wherein: The method further comprises: Determine whether there is at least one import node under the root node; If so, obtaining a document link address of another external network service description language document imported by the at least one importing node, and loading the other external network service description language document according to the document link address; By parsing the node tree structure in the other external network service description language document, one or more second enumeration nodes are obtained, and according to the node values ​​of the one or more second enumeration nodes, the enumeration value data corresponding to the network service description language document is updated.

9. The method according to claim 1, wherein: The method further comprises: Obtain an interface node in the network service description language document; if there is at least one first request parameter whose corresponding parameter type is a simple type in the interface node, search for at least one enumeration value corresponding to the type name in the enumeration value data according to the type name of the simple type; and determine a default value of the first request parameter according to the at least one enumeration value.

10. The method according to claim 9, wherein: The searching the enumerated value data for at least one enumeration value corresponding to the type name, and determining a default value of the first request parameter according to the at least one enumeration value, includes: Searching the enumeration value sequence corresponding to the type name in the enumeration value data, wherein the enumeration value sequence includes at least one enumeration value in order; The first enumeration value in the enumeration value sequence is used as the default value of the first request parameter.

11. The method according to claim 9, wherein: The method further comprises: If there is at least one second request parameter whose corresponding parameter type is a complex type in the interface node, determining whether there is a corresponding target sub-request parameter whose parameter type is a simple type in at least one sub-request parameter corresponding to the complex type; If so, based on the type name of the simple type, search for at least one second enumeration value corresponding to the type name in the enumeration value data, determine the second default value of the target sub-request parameter based on the at least one second enumeration value, and determine the default value of the second request parameter based on the second default value and the parameter name of the target sub-request parameter.

12. A computer device for determining an enumeration value, comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 11.

13. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Software interface generating system and method based on extensible markup language (XML) Schema

    CN102646039A

  • Method and device for assembling XML message

    CN111628975A

  • Software design method based on template self-adaption

    CN114443006A

  • Information processing device, information processing method, and computer-readable recording medium

    US20120303611A1