CN103580937B - A kind of Web services the method and system thereof and service broker system simulated - Google Patents

A kind of Web services the method and system thereof and service broker system simulated Download PDF

Info

Publication number
CN103580937B
CN103580937B CN201210258669.1A CN201210258669A CN103580937B CN 103580937 B CN103580937 B CN 103580937B CN 201210258669 A CN201210258669 A CN 201210258669A CN 103580937 B CN103580937 B CN 103580937B
Authority
CN
China
Prior art keywords
service
parameter
name
request message
message
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
CN201210258669.1A
Other languages
Chinese (zh)
Other versions
CN103580937A (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.)
Advanced New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201210258669.1A priority Critical patent/CN103580937B/en
Publication of CN103580937A publication Critical patent/CN103580937A/en
Application granted granted Critical
Publication of CN103580937B publication Critical patent/CN103580937B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Embodiments provide method and system and the service broker system of a kind of Web service simulation, in order to solve in prior art owing to the service provider system machine of delaying causes interrupting or the online fault providing service of research and development test.Wherein, the method for this Web service simulation is to call, by service broker system interception service, the call request message that terminal sends, and resolves this call request message, and searches the analog form that method that this call request message request calls is corresponding;If lookup result is whole analog form, then service broker system generates response message and is back to service call terminal;If lookup result is partial simulation mode, then service broker system forwards this call request message to service provider system, after receiving the response message that service provider system returns, processes the response message received and is back to what service call terminal realized.This Web service analog systems includes this service broker system and service provider system.

Description

The method of a kind of Web service simulation and system and service broker system
Technical field
The present invention relates to Service-oriented Architecture (Service-Oriented Architecture, SOA) application technology Field, particularly relates to method and system and the service broker system of a kind of Web service simulation.
Background technology
Along with the development of modern social science technology, computer system has become as the work that all trades and professions are relied on Tool, and play central role wherein is computer software.Development and information along with enterprise The continuous construction of technology (Information Technology, IT) system, the IT application system of enterprise is more come The most, application is day by day complicated, and enterprise it is also proposed new requirement to interconnecting between application system.And In large-scale internet, applications, its core function system generally have tens the most, between system Service relies on the most extremely complex.
SOA is a kind of framework model, it enterprise is applied in scattered functional organization become can share based on The service of standard, these services can promptly be combined and reuse, thus reached quick response service and needed The purpose asked;Meanwhile, in enterprise-level application field, along with the continuous expansion of application scale, each system it Between integrated and become more and more important alternately.In SOA environment, system inevitably with other System interaction, can be based on Simple Object Access Protocol (Simple Object Access Protocol, SOAP) Web service, based on message queue, even based on remote procedure call protocol (Remote Procedure Call Protocol, RPC) far call.And in large-scale internet, applications, its core Function system generally have tens the most, service between system relies on the most extremely complex.This application Under architecture environment, create following problem:
Such as, the system used at large-scale IT enterprises researched and developed before use of reaching the standard grade in test process and During use of normally reaching the standard grade, owing to application system is numerous, and the dependence between system is extremely complex, So the most between service provider system and service calling system, the pressure of service provider system is very Greatly, as long as some server in service provider system is because hardware fault or other various reasons are delayed Machine, the service call between system just cannot be normally carried out, so may result in research and development test interruption or Line provides the fault of service.
Summary of the invention
Embodiments provide method and system and the service broker system of a kind of Web service simulation, In order to solve in prior art, owing to application system is numerous, and dependence between system is extremely complex makes The bigger interruption that may cause research and development test of pressure or the event of online offer service of service provider system are provided The problem of barrier.
Based on the problems referred to above, the method for a kind of Web service simulation that the embodiment of the present invention provides, including:
Service broker system interception service calls the call request message that terminal sends, and parses this call request Service name that message comprises, method name and input parameter type, and according to the Service name of default each service, The method name of each method, the input parameter type of each method and each method analog form right that service is comprised Should be related to and search the analog form that the method called of described call request message request is corresponding;
If lookup result is whole analog form, the most described service broker system is according to the first simulation mould preset Plate generates response message and is back to described service call terminal;
If lookup result is partial simulation mode, the most described service broker system forwards this call request message extremely Service provider system, after receiving the response message that described service provider system returns, according to default the Two simulated templates are back to service call terminal after processing the response message received.
A kind of service broker system that the embodiment of the present invention provides includes:
Message blocking module, calls, for interception service, the call request message that terminal sends;
Packet parsing module, for parsing Service name that described call request message comprises, method name and defeated Enter parameter type, and the method name of each method comprised according to the default Service name of each service, service, The input parameter type of each method and the corresponding relation of each method analog form search described call request message The analog form that the method for request call is corresponding;
Message constructing module, for when lookup result is whole analog form, according to the first default simulation Template generation response message, and be used for when lookup result is partial simulation mode and receive described service After the response message that offer system returns, according to the second default simulated templates, the response message received is entered Row processes;
Packet forwarding module, for forwarding described message constructing module to generate according to the first described simulated templates Response message to described service call terminal;And when described method is arranged to partial simulation mode, Forward this call request message to service provider system, and forward described message constructing module according to described second Response message after simulated templates process is to described service call terminal.
The embodiment of the present invention also provides for the system of a kind of Web service simulation, provides including the embodiment of the present invention Above-mentioned service broker system and service provider system, described service provider system is for when receiving described service During the call request message that agency plant forwards, generate response message and be back to described service broker system.
The beneficial effect of the embodiment of the present invention includes:
Embodiments provide method and system and the service broker system of a kind of Web service simulation, Utilize service broker system response service call terminal to being arranged to the calling of method of whole analog form, When service provider system delays machine due to hardware fault or other reasons, service broker system can directly ring Answer service calling system, thus isolated the service provider system impact on service calling system so that at clothes Business provides system pressure relatively big or in the case of machine of delaying, research and development test can continue or provide service online Will not be out of order.
Accompanying drawing explanation
A kind of Web service analog systems that Fig. 1 provides for embodiment of the present invention framework in a particular application Figure;
The flow chart of the method for a kind of Web service simulation that Fig. 2 provides for the embodiment of the present invention;
The service broker system that Fig. 3 provides for the embodiment of the present invention adds the flow chart of new service;
The signal of the first simulated templates of a certain method in a certain service that Fig. 4 provides for the embodiment of the present invention Figure;
The response report that the service broker system that Fig. 5 provides for the embodiment of the present invention generates according to the first simulated templates The schematic diagram of literary composition;
Fig. 6 forwards call request message to provide system to service for the service broker system that the embodiment of the present invention provides The flow chart of system;
The signal of the second simulated templates of a certain method in a certain service that Fig. 7 provides for the embodiment of the present invention Figure;
The schematic diagram of the response message that the service provider system that Fig. 8 provides for the embodiment of the present invention returns;
Response service provider system returned according to the second simulated templates that Fig. 9 provides for the embodiment of the present invention Message process after the schematic diagram of response message;
Figure 10 is carried out when concrete application for the method for a kind of Web service simulation that the embodiment of the present invention provides The flow chart of service simulation;
The structural representation of a kind of service broker system that Figure 11 provides for the embodiment of the present invention;
The structural representation of the system of a kind of Web service simulation that Figure 12 provides for the embodiment of the present invention.
Detailed description of the invention
Below in conjunction with Figure of description, the method for a kind of Web service simulation that the embodiment of the present invention is provided and Its system and the detailed description of the invention of service broker system and the beneficial effect that can reach thereof carry out detailed Illustrate.
A kind of Web service analog systems that the embodiment of the present invention provides framework such as Fig. 1 when concrete application Shown in, including:
Service broker system 11, between service calling system 13 and service provider system 12, it both may be used To be software module, it is also possible to be that by the hardware device of agent functionality;
Service provider system 12, it is provided that service or method are called for other system;
Service calling system 13, can be user, it is also possible to for terminal unit.
Fig. 2 is the flow chart of the method for a kind of Web service simulation that the embodiment of the present invention provides, the method bag Containing following step:
S201, service broker system interception service call the call request message that terminal sends, this service call Terminal is some terminal in service calling system;
This step passes through service call terminal by the target ip address in call request message by providing this to call In request message, the address in the service provider system of the method for request call is revised as in service broker system Address realize;
S202, service broker system parse this call request message and comprise Service name, method name, input ginseng Number type;
The each method that S203, service broker system are comprised according to the Service name of each service preset, service Calling described in the corresponding relation lookup of method name, the input parameter type of each method and each method analog form please The analog form that the method for asking message request to call is corresponding, if lookup result is whole analog form, then performs S204, if lookup result is partial simulation mode, then performs S206;
S204, service broker system generate response message according to the first simulated templates preset;
The response message generated in S204 is back to service call terminal by S205, service broker system;
So, service call terminal eliminates the reliance on service provider system, can reduce the pressure of service provider system Power, it is to avoid due to the instability of the service call that the fault of service provider system causes;
S206, service broker system forward this call request message to service provider system;
After S206, perform S207;
S207, service broker system receive the response message that service provider system returns;
S208, service broker system process, according to the second simulated templates preset, the sound received in S207 Answer message;
Response message after S209, service broker system will process in S208 is back to service call terminal.
Further, the Service name pre-setting each service in S203, the method servicing each method comprised The corresponding relation of name, the input parameter type of each method and each method analog form comes especially by following manner Realize:
Service broker system accesses WSDL WSDL corresponding to each service pre-set Address, it is thus achieved that the WSDL description that each service is corresponding;Or service broker system receives the WSDL of service Describe file and obtain the WSDL description of this service;Service broker system resolves the WSDL that each service is corresponding Describe, it is thus achieved that this service Service name, this service in comprise methodical method name, each method defeated Enter parameter type and the parameter name of output parameter, parameter type and store;Service broker system is every by obtain The Service name of individual service, the method name of each method comprised, input parameter type and the setting of each method Each method analog form correspondence stores.
The method name of each method that Fig. 3 gives and pre-sets the Service name of each service, service is comprised, each The input parameter type of method and the corresponding relation of each method analog form realize flow process:
S301, the WSDL getter in service broker system receives the WSDL of certain service from operator Address or WSDL describe file, if the reception of WSDL getter is WSDL address, then perform S302, if the reception of WSDL getter is that WSDL describes file, then performs S304;
S302, WSDL getter accesses the WSDL address received, and this WSDL address is the most permissible It is positioned in service provider system;Then S303 is performed;
S303, the WSDL that service provider system returns its request access to WSDL getter describe file;
The WSDL got is described file and sends to service broker system by S304, WSDL getter WSDL resolver;
S305, WSDL resolver resolves the WSDL received in S304 and describes file;Comprise in service All of method, the method name of each method, each method input parameter type and the parameter name of output parameter, Parameter type;
The result parsed is sent to database access object request storage by S306, WSDL resolver.
S307, the result that WSDL resolver parses is put in data base and is stored by database access object;
S308, data base returns the successful message of interpolation to operator;
S309, data base receives the simulation side that each method comprised in operator's this service to adding is arranged Formula;
S310, the method name of each method that the Service name of this service, this service are comprised by data base, each side The input parameter type storage corresponding with the analog form of each method of method.
Then, the input parameter type of the method name of each method included in this service, each method And after the corresponding relation of the analog form of each method is all deposited into data base, operator continues to add new Service and arrange the analog form of all of method comprised in the new service of interpolation.
Further, the first simulated templates in step S204 is previously generated by following step:
First, each method that service broker system is comprised according to the Service name of each service, service method name, The corresponding relation of the input parameter type of each method and the analog form of each method finds out and is set to whole mould The method of plan mode;
Then, for being set to each method of whole analog form, by operator according to resolve obtain should The parameter type of each output parameter of method is that it arranges corresponding parameter value, and then operator will be arranged The parameter value of output parameter and the corresponding parameter name of output parameter, parameter type protect as the first simulated templates Exist in data base.
Being illustrated the form of the first simulated templates below, Fig. 4 gives and a kind of services entitled S's In service, (certain the embodiment of the present application is not limited to this kind of lattice to the form of the first simulated templates of a certain method Formula), the entitled F of method of the method, method F comprises two output parameters, and its parameter name is respectively parameter SF1 and parameter SF2, the parameter type of parameter SF1 is int, and the parameter type of parameter SF2 is float, Its parameter value is set to integer A, according to parameter SF2 according to the parameter type int of parameter SF1 by operator Its value is set to single precision floating datum B by parameter type float.
Further, in step S204, service broker system generates according to the first simulated templates preset The detailed process of response message is:
Service broker system first determines whether the agreement that call request message is used, then according to this call request The response message of the protocol generation corresponding format that message is used, the most again by storage with this call request report The content of first simulated templates corresponding to method of literary composition request call is inserted in above-mentioned response message.
Below as a example by service call terminal uses soap protocol to send call request message, illustrate to service generation Reason system is according to the process of above-mentioned first simulated templates generation response message:
First, service broker system judges the agreement that the call request message that service call terminal sends uses For soap protocol;Concrete judge process such as can use following manner: service broker system can be for Different agreements is pre-configured with different proxy entry, it is assumed that service broker system opens two ports 8080,8081, wherein 8080 port bindings soap protocol, 8081 port bindings Transmission Control Protocol, If therefore 8080 ports of service broker system receive call request message, then it is assumed that this call request report Literary composition uses soap protocol.
Then, service broker system generates the response message of soap protocol form, and it comprises a SOAP Big envelope, comprises SOAP header (can have and can also not have) and SOAP message content in SOAP envelope (must have), wherein SOAP message content is the content being saved in the first simulated templates, and this first As shown in Figure 4, therefore service broker system returns to the response report of service call terminal to the content of simulated templates Literary composition is as shown in Figure 5.
Calling of the method for above-mentioned whole analog form can apply to need not in care service provider system The situation of portion's details, now when service provider system delays machine due to hardware fault or other reasons, service Agency plant directly in response to service calling system, thus can isolate service provider system to service call system The impact of system so that relatively greatly or in the case of machine of delaying, research and development test can continue at service provider system pressure Continuous or online offer service will not be out of order.
It addition, the situation of this whole analog form can also be applied to research and develop in test environment, now by Service broker system is service calling system return response message thus checks easily in service calling system Some leaks.Illustrate with two concrete examples below:
In a certain test scene, A system needs certain service calling in B system, the most now A system When system needs to arrange a time-out time t so that A system waits more than t after sending call request message Between and time B system does not returns response message yet A system can ask with active break.Otherwise, if A system Wait the response message of B system always, the process that other are serviced by A system can be affected, if even A system If multiple services of tracking all do not meet with a response, then in A system, the service of wait-for-response can increasingly Many, the system failure may finally be caused.
And in test process, need to verify that this timeout treatment mechanism is the most reliable, therefore can be in A system And a service broker system is set between B system, A system calls B system by this service broker system Service.In the case of all simulations, the operator of service broker system can be in service broker system One response waiting time t1, wherein t1 are set > t, i.e. service broker system receiving call request message Response message is returned to A system again, if A system is no longer to the response message returned after the rear wait t1 time Process, then explanation A system is provided with timeout treatment mechanism;If A system continues the response returned Message processes, then explanation A system is not provided with timeout treatment mechanism.As such, it is possible to verify in testing Whether service calling system is provided with timeout treatment mechanism, or the timeout treatment mechanism arranged is the most reliable.
In another test scene, in SOA, service is likely distributed in each system, such as A system Being respectively provided with B system and provide the ability of certain service, service calling system (A system) request call takes Service in business offer system (B system), is getting the knot that service provider system (B system) returns May proceed to carry out the process of own service after Guo, be at this moment accomplished by considering that service calling system (A system) is right The idempotence of the result that service provider system (B system) returns controls.Transfer accounts for client as A system has The backward client of success collects the function of certain expense, and B system has the service transferred accounts, and A system needs to adjust With the transfer services of B system, A system is direct to client after receiving the successful result of transferring accounts of B system Deduct fees, when test it is envisaged that for the same operation of transferring accounts of client, can only after transferring accounts successfully Deduct fees once.And in service invocation procedure, successful result of transferring accounts may repeatedly be returned to by B system A system, being accomplished by A system here has idempotence control, i.e. for same operation of transferring accounts, no matter A system System receives the successful result of transferring accounts that B system returns several times, and A system is the most only deducted fees once.At checking A When whether system has idempotence control, it is possible to by arranging service generation between A system and B system Reason system, A system calls the transfer services of B system by service broker system, and B system is by service generation Reason system return to A system transfer accounts successfully as a result, it is possible to arrange in service broker system easily to A system returns the number of times of successful result of transferring accounts, and repeatedly returns simulating B system successful result of transferring accounts Scene to A system.Then A system is judged according to A system same operation of transferring accounts deducted fees number of times Whether there is idempotence control.
Further, in step S206, service broker system forwards this call request message to service to carry For system detailed process as shown in Figure 6:
The address being forwarded to service provider system of the method that S601, service broker system search request are called;
Its detailed process is, service broker system is according to the source IP of call request message, Service name, method name With input parameter type, in the Service name prestored, method name, input parameter type, call request report The source IP of literary composition needs to be forwarded to lookup call request message in the corresponding relation of the address of service provider system The address of service provider system;
In research and development test, service provider system and service calling system may there is multiple research and development task same Shi Jinhang, such as, when having two research and development tasks, task 1 and task 2, when carrying out, service provides system simultaneously A part of terminal in system provides service call for task 1, and another part terminal provides service to adjust for task 2 With, a part of terminal in service calling system carries out the research and development of task 1, and another part terminal carries out task The research and development of 2, research and development tester wishes that sent by research and development task 1 calls when processing service call Request message is only processed by the system of research and development task 1, research and development task 1 the call request message sent Only processed by the system of research and development task 1, be therefore forwarded to service provider system at lookup call request message Address time be accomplished by knowing the source IP of call request message;And owing to same service may comprise Two methods that method name is identical, the two method only difference is that their input parameter type is different, Therefore service provider system could must judge according to Service name, method name, input three kinds of information of parameter type Which method is service call terminal to call actually.Therefore, the method that search request is called in this step The address being forwarded to service provider system can not search only according to method name, and will be first according to calling The source IP of request message judges that this call request message to be come by those terminals in service provider system Further according to Service name, method name and input parameter type, reason, first determines whether that service calling system to be adjusted actually Use which method, process in service provider system the most again in those terminals of this call request message and search Process the address of the method for this request call.
If finding, then perform step S602, if search less than, then perform step S603;
In step S602, service broker system forwards call request message to provide system to the service found The address of system;
In step S603, service broker system judges whether to pre-set acquiescence forwarding address, if so, Then perform step S604, if it is not, then perform step S605;
In step s 604, service broker system forwards call request message to giving tacit consent to forwarding address;
In step s 605, service broker system returns fault alarm information to service call terminal.
Further, the second simulated templates in step S208 generates through the following steps:
First, each method that service broker system is comprised according to the Service name of each service, service method name, The corresponding relation of the input parameter type of each method and the analog form of each method finds out and is set to part mould The method of plan mode;
Then, for being set to each method of partial simulation mode, first operator determines the complete of the method Those output parameters in portion's output parameter need simulation, the most again for needing the output parameter of simulation according to it Parameter type arranges corresponding parameter value, finally will need the parameter name of output parameter of simulation, parameter type And the corresponding parameter value arranged saves as the second simulated templates.
Fig. 7 gives the form of the second simulated templates of a certain method in the service servicing entitled S (the most originally Application embodiment is not limited to this kind of form), the entitled M of method of the method, comprise three output parameters, Its parameter name is respectively parameter SM1, parameter SM2 and parameter SM3, and the parameter type of parameter SM1 is int, The parameter type of parameter SM2 is float, and the parameter type of parameter SM3 is double, first, operator Determining and only need to simulate SM3 in all output parameters of the method M, therefore operator is according to parameter SM3 Parameter type double its parameter value is set to double-precision floating points D, therefore second mould of the method M Intend template only save service S, method M and the parameter name of output parameter SM3, parameter type and The content of parameter value.
Further, in step S208, service broker system processes according to the second simulated templates preset The detailed process of the response message received in step S207 is:
The output parameter comprised with the second simulated templates that this response message is comprised by service broker system The parameter value of the consistent output parameter of parameter name be revised as and the ginseng of this output parameter in the second simulated templates The parameter value of several correspondences.
The most still soap protocol is used to send call request message with service call terminal, request call As a example by method is method M in service S, illustrate that service broker system processes according to the second simulated templates The process of the response message received in S207:
Service provider system that service broker system receives in S207 returns response message such as Fig. 8 institute Showing, wherein the content of SOAP message includes servicing S, method M and the parameter name of three output parameters, ginseng Number type and corresponding parameter value, the parameter type of parameter SM1 is int, and its parameter value is integer J, The parameter type of parameter SM2 is float, and its parameter value is single precision floating datum K, the parameter of parameter SM3 Type is double, and its parameter value is double-precision floating points L.
Then, service broker system 11 will receive according to the second simulated templates shown in Fig. 7 in S207 Response message in the parameter value of parameter SM3 to be replaced with operator by double-precision floating points L be parameter The parameter value double-precision floating points D that SM3 is arranged, after i.e. processing according to the second simulated templates shown in Fig. 7 SOAP message as it is shown in figure 9, before processing with process after the difference of SOAP message be the ginseng of parameter SM3 Numerical value is different, and before processing, the parameter value of parameter SM3 is L, and after process, the parameter value of parameter SM3 is D.
When application for complicated service, the output parameter of a method would generally compare many, and operator wants Completely arranging the whole output parameter workloads of simulation can be bigger, returns by service provider system the most here Response message, operator only need to arrange oneself need simulation output parameter, so one side permissible Ensure the integrity of the output parameter returned, on the other hand also overcome all output parameters of simulation comparatively laborious Problem.
Illustrate with a concrete example below: A system can provide a kind of service AS, this service Output parameter has ASF1, ASF2, and wherein ASF1 processes the truthful data that this service obtains, and ASF2 is The result phase processing this service, may have ASF21, ASF22 several return value;And work as B When system needs the service AS calling A system, B system needs calling the various knots that AS is likely to occur Really state processes, and B system is the concrete reality of the service AS not knowing about A system in actual applications Existing details, the various result phases if desired simulating AS service when not having service broker system certainly will need Put into understand AS service realize details can accurate simulation out, and according to the sides of all simulations Formula may be extremely complex due to the output parameter ASF1 content of method AS, will all simulate, arrange Coming can be the most loaded down with trivial details.Therefore use partial simulation, the most only arrange and need the output parameter of simulation, remaining output The content of parameter is still generated when responding the method by A system, thus simplifies template-setup, improves efficiency.
Such as, the service AS that A system provides is the service checking user account remaining sum, and B system calls A During the service AS of system, A system returns (the corresponding output of the remaining sum of the user account checked to B system Parameter ASF1), and the state (corresponding output parameter ASF2) of this user account is returned to B system, as When this user account Sorry, your ticket has not enough value 10 yuan time, return, to B system, the information that Sorry, your ticket has not enough value (corresponding ASF21), and when the remaining sum of this user account exceedes a certain regulation amount, return remaining sum to B system to surpass The information (corresponding A SF22) of limit, owing to B system needs calling the various result shapes that AS is likely to occur State processes, and therefore arranges service broker system between A system and B system, and A system is by B system Output parameter ASF1 and ASF2 of the service AS of tracking returns to B system by agency plant, adopts By the mode of partial simulation, service broker system can revise the value of ASF2 so that analog service AS each Planting result phase, whether inspection B system can make correct process to different result phases, such as B system When receiving the information that Sorry, your ticket has not enough value, if user can be pointed out to supplement with money, or when receiving the information that remaining sum transfinites, User whether can be pointed out to process account so that remaining sum no longer transfinites.And the output parameter ASF1 to service AS, Agency plant can directly use the value that A system generates when processing this service, it is not necessary to simulation ASF1's Parameter value.
In software test procedure, the advantage using service broker system is can to simulate easily in A system The various state values of service AS output result, to check the B system result shape to the service all returns of AS Can state correctly process, and to reduce the probability that leak occurs, this leak refers to that service AS is returned by B system Result phase can not correctly process.Service broker system can be more convenient obtain service AS various The result phase returned, thus improve efficiency of research and development, conventional test manner such as Debug also can accomplish this journey The test simulation of degree, but its simulated cost can be the highest.
It is preferred that the method that a kind of Web service that the embodiment of the present invention provides is simulated also includes call request report In literary composition, the method for request call is arranged to the situation of non-analog mode, and in this case, service broker is System directly forwards call request message to shown in service provider system, its detailed process forwarded and Fig. 6 Process is similar to, and does not repeats them here;Service provider system, after receiving the call request message of forwarding, enters Row normal process, then returns response message to service broker system, and service broker system is to this response message Do not make any extra process and be forwarded directly to service call terminal.
Below as a example by Web service based on SOAP, a kind of Web that the embodiment of the present invention provides is described The method of service simulation carries out the process of service simulation, as shown in Figure 10, this process bag when concrete application Include following steps:
Certain service call terminal in S1001, service calling system sends based on soap protocol calling Request message,
Owing to service calling system will need the address in the service provider system accessed to be revised as service Address in agency plant, after therefore service calling system sends call request message, actually SOAP The reception address that call request message is sent directly in service broker system;
Message blocker in S1002, service broker system intercepts SOAP call request message;
S1003, message blocker send SOAP call request message to the message solution in service broker system Parser 102;
S1004, packet parsing device take out the source IP of call request message and soap message therein and resolve This soap message, obtains Service name, method name and input parameter type, and according to being stored in advance in data The method name of each method that the Service name of each service in storehouse (not shown in Figure 10), service are comprised, The corresponding relation of the input parameter type of each method and the analog form of each method finds out the side of request call The analog form of method;
S1005, packet parsing device send SOAP call request message, source IP, the request call that parses Service name, method name, input parameter type and the analog form of the method for request call that finds extremely Message transponder in service broker system;
If the method for request call is arranged to whole analog form, perform S1006;If the side of request call Method is arranged to partial simulation or non-analog mode then performs S1007;
S1006, message transponder forward SOAP call request message to the message structure in service broker system Make device;
S1007, message transponder are according to the Service name being stored in advance in data base, method name, input ginseng The corresponding relation of number types, the source IP of call request message and the address that is forwarded to service provider system is looked into The service that is forwarded to of the method finding out the request call being arranged to partial simulation mode or non-analog mode carries Address for system;
S1008, message transponder forward SOAP call request message to the address found in S1007; If not finding the address being forwarded to service provider system in S1007, and the acquiescence of also Non-precondition Address, then return fault alarm information to service calling system, and this situation is the most not shown;
S1009, message constructor is after receiving call request message, according to the method institute of this request call Corresponding the first simulated templates being stored in data base generates response message;
S1010, response message is sent to message transponder by message constructor;
S1011, message transponder transmitted response message to service calling system send call request message Service call terminal;
S1012, service provider system generate response message according to the call request message received;
The response message of generation is back to message transponder by S1013, service provider system;
If the method for request call is arranged to partial simulation mode, then perform S1014;If request call Method is arranged to non-analog mode, then perform S1015;
The response message received is forwarded to message constructor by S1014, message transponder;
The transmission that the response message received is forwarded in service provider system by S1015, message transponder is adjusted By the service call terminal of request message;
S1016, message constructor are corresponding according to the method with this request call being stored in data base Second simulated templates processes the response message received in S1014;
The response message processed is sent to message transponder by S1017, message constructor;
The transmission that the response message received is forwarded in service calling system by S1018, message transponder is adjusted By the service call terminal of request message.
Based on same inventive concept, the embodiment of the present invention additionally provides a kind of service broker system and Web service The system of simulation.
A kind of service broker system that the embodiment of the present invention provides, as shown in figure 11, including:
Message blocking module 111, calls, for interception service, the call request message that terminal sends;
Packet parsing module 112, be used for parsing described call request message comprise Service name, method name, Input parameter type, and the method name of each method comprised according to the Service name of default each service, service, The input parameter type of each method and the corresponding relation of each method analog form search the simulation side of described method Formula;
Message constructing module 113, for when described method is arranged to whole analog form, according to presetting First simulated templates generate response message, and for when described method is arranged to partial simulation mode with And after receiving the response message that described service provider system returns, according to the second default simulated templates docking The response message received processes;
Packet forwarding module 114, for forwarding described message constructing module according to the first described simulated templates The response message generated is to described service call terminal;And it is arranged to partial simulation mode in described method Time, forward this call request message to service provider system 12, and forward described message constructing module according to institute State the response message after the second simulated templates processes to described service call terminal.
Further, the service broker system that the embodiment of the present invention shown in Figure 11 provides also includes:
WSDL acquisition module 115, for accessing the address of WSDL corresponding to each service pre-set, The WSDL obtaining each service corresponding describes;Or the WSDL being used for the service that receives describes file and obtains this The WSDL of service describes;
WSDL parsing module 116, describes for the WSDL resolving each service corresponding, it is thus achieved that this service Service name, this service in comprise methodical method name, the input parameter type of each method and output The parameter name of parameter and parameter type;
Block 117 is touched in storage, for the Service name storing each service of acquisition, the side of each method that comprised Religious name, the input parameter type of each method and the parameter name of output parameter and parameter type, and be used for storing respectively The method name of each method, the input parameter type of each method and the setting that the Service name of service, service are comprised The corresponding relation of each method analog form;
When specifically applying, memory module 117 both can be that data base can also be that by storage function Other modules, if data base during memory module 117, then this service broker system can also include number Object is accessed, for the management data in data base being read out and store according to storehouse.
Further, the service broker system that the embodiment of the present invention shown in Figure 11 provides, also include:
First simulated templates generation module 118, each for comprised according to the Service name of each service, service The corresponding relation of the analog form of the method name of method, the input parameter type of each method and each method finds out The method being arranged to whole analog form, and for being arranged to each method of whole analog form, root Corresponding parameter value is set according to the parameter type of each output parameter of the method, by the output parameter of setting Parameter value and the corresponding parameter name of output parameter, parameter type save as the first simulated templates;
Second simulated templates generation module 119, each for comprised according to the Service name of each service, service The corresponding relation of the analog form of the method name of method, the input parameter type of each method and each method finds out The method being arranged to partial simulation mode;And for being arranged to each method of partial simulation mode, root According to the parameter type of the output parameter needing simulation in whole output parameters of the method, corresponding ginseng is set Numerical value, it would be desirable to the corresponding parameter value of the parameter name of the output parameter of simulation, parameter type and setting preserves It it is the second simulated templates.
Further, memory module 117 is additionally operable to store the of each method being arranged to whole analog form One simulated templates, and the second simulated templates of each method of partial simulation mode it is arranged to for storage.
Further, packet forwarding module 114, specifically for according to the service comprised in call request message Name, method name, input parameter type and source IP address, at the Service name prestored, method name, defeated Enter parameter type and source IP to call described in lookup in the corresponding relation of the address being forwarded to service provider system The address being forwarded to service provider system of the method for request message request call;If search less than, then to clothes Business is called terminal and is returned fault alarm information or be forwarded to call request message give tacit consent to forwarding address;If searching Arrive, then call request message is forwarded to the address of the service provider system found.
Further, message constructing module 114, specifically for the method called in call request message request When being arranged to whole analog form, the agreement used according to described call request message, generate corresponding lattice The response message of formula, and by first mould corresponding with the method that described call request message request is called of storage The content intending template is inserted in this message;And the method for calling in call request message request is arranged to Partial simulation mode and receive service provider system return response message after, this response message is wrapped The parameter name of output parameter that the second simulated templates with storage contained is comprised and consistent defeated of parameter type Go out the parameter value of parameter to be revised as and the parameter name of this output parameter in this second simulated templates and parameter type Corresponding parameter value.
It is preferred that the method that packet forwarding module 114 is additionally operable to call request message request is called is set During for non-analog mode, forwarding call request message is to service provider system 12, and provides in the service of receiving After the response message that system 12 returns, the response message received is not done extra process and returns directly to Service call terminal.
The system of the Web service simulation that the embodiment of the present invention provides, as shown in figure 12, including:
The above-mentioned service broker system 11 that the embodiment of the present invention provides;
Service provider system 12, during for receiving the call request message of service broker system 11 forwarding, Generate response message and be back to described service broker system.
The service broker system 11 that the embodiment of the present invention provides externally provides different for different communication protocol Analog interface, i.e. it can resolve the call request message of different communication protocol, say, that when service adjust When needing to call certain method by terminal, the call request message of transmission is not limited to a certain communication protocol.
Obviously, those skilled in the art can carry out various change and modification without deviating from this to the present invention Bright spirit and scope.So, if the present invention these amendment and modification belong to the claims in the present invention and Within the scope of its equivalent technologies, then the present invention is also intended to comprise these change and modification.

Claims (17)

1. the method for a Web service simulation, it is characterised in that including:
Service broker system interception service calls the call request message that terminal sends;Specifically include, by described Target ip address in call request message, is carried by providing the service of the method for request call in request message For the address in system, it is revised as the address of described service broker system;
Described service broker system parses Service name, method name and the input parameter that call request message comprises Type, and comprised according to the Service name of default each service, service the method name of each method, each method Input parameter type and each method analog form corresponding relation search described call request message request adjust Analog form corresponding to method;
If lookup result is whole analog form, the most described service broker system is according to the first simulation mould preset Plate generates response message and is back to described service call terminal;
If lookup result is partial simulation mode, the most described service broker system forwards this call request message extremely Service provider system, after receiving the response message that described service provider system returns, according to default the Two simulated templates are back to service call terminal after processing the response message received.
2. the method for claim 1, it is characterised in that the Service name of each service, service are wrapped The corresponding relation of the method name of each method contained, the input parameter type of each method and each method analog form leads to Cross following manner to pre-set:
Service broker system accesses WSDL WSDL corresponding to each service pre-set Address, it is thus achieved that the WSDL description that each service is corresponding;
Or the WSDL of service broker system reception service describes file and obtains WSDL description of this service;
The WSDL that service broker system resolves each service corresponding describes, it is thus achieved that this Service name serviced, The methodical method name of institute that comprises in this service, each method input parameter type and the parameter of output parameter Name, parameter type also store;
Service broker system is by the Service name of each service obtained, the method name, each of each method that comprised The input parameter type storage corresponding with each method analog form of setting of method.
3. method as claimed in claim 2, it is characterised in that described first simulated templates is by following Mode previously generates:
Service broker system finds out the method being arranged to whole analog form in each service;
For being arranged to each method of whole analog form, according to the parameter class of the output parameter of the method Type arranges the parameter value of correspondence, by the parameter value arranged and the corresponding parameter name of output parameter, parameter type guarantor Save as the first simulated templates.
4. method as claimed in claim 3, it is characterised in that described service broker system is according to presetting First simulated templates generate response message, specifically include:
The agreement that described service broker system is used according to described call request message, generates corresponding format Response message, and by the first simulation mould corresponding with the method that described call request message request is called of storage The content of plate is inserted in described message.
5. the method for claim 1, it is characterised in that described service broker system forwards this tune With request message to service provider system, specifically include:
Described service broker system is according to the source IP comprised in described call request message, Service name, method name With input parameter type, in the Service name prestored, method name, input parameter type, call request report The source IP of literary composition and the corresponding relation of the address of service provider system search required turn of described call request message The address of the service provider system sent out;
If search less than, then return fault alarm information or by described call request message to service call terminal It is forwarded to the acquiescence forwarding address pre-set;
If finding, then forward described call request message according to the address of the service provider system found.
6. method as claimed in claim 2, it is characterised in that described second simulated templates is by following Mode generates:
Service broker system finds out the method being arranged to partial simulation mode in each service;
For being arranged to each method of partial simulation mode, according in whole output parameters of the method The parameter type needing the output parameter of simulation arranges corresponding parameter value, it would be desirable to the output parameter of simulation The parameter value of parameter name, parameter type and correspondence saves as the second simulated templates.
7. method as claimed in claim 6, it is characterised in that according to the second default simulated templates pair The response message received processes, and specifically includes:
Comprised by the response message that service provider system returns is comprised with described second simulated templates The parameter value of the output parameter that the parameter name of output parameter is consistent be revised as with described second simulated templates in should The parameter value that the parameter name of output parameter is corresponding.
8. the method as described in any one of claim 1-7, it is characterised in that also include:
If described method is arranged to non-analog mode, then service broker system forwards described call request message To service provider system, and after receiving the response message that service provider system returns, the sound that will receive Message is answered to be back to service call terminal.
9. a service broker system, it is characterised in that including:
Message blocking module, calls, for interception service, the call request message that terminal sends;Specifically for, By the target ip address in described call request message, by providing the method for request call in request message Address in service provider system, is revised as the address of described service broker system;
Packet parsing module, for parsing Service name that described call request message comprises, method name and defeated Enter parameter type, and the method name of each method comprised according to the default Service name of each service, service, The input parameter type of each method and the corresponding relation of each method analog form search described call request message The analog form that the method for request call is corresponding;
Message constructing module, for when lookup result is whole analog form, according to the first default simulation Template generation response message, and be used for when lookup result is partial simulation mode and receive described service After the response message that offer system returns, according to the second default simulated templates, the response message received is entered Row processes;
Packet forwarding module, for forwarding described message constructing module to generate according to the first described simulated templates Response message to described service call terminal;And when described method is arranged to partial simulation mode, Forward this call request message to service provider system, and forward described message constructing module according to described second Response message after simulated templates process is to described service call terminal.
10. system as claimed in claim 9, it is characterised in that also include:
WSDL acquisition module, for accessing the address of WSDL corresponding to each service pre-set, obtains The WSDL obtaining each service corresponding describes;Or the WSDL being used for the service that receives describes file and obtains this clothes The WSDL of business describes;
WSDL parsing module, describes for the WSDL resolving each service corresponding, it is thus achieved that this service Service name, this service in comprise institute methodical method name, the input parameter type of each method and output join The parameter name of number and parameter type;
Memory module, for store acquisition each service Service name, comprised each method method name, The input parameter type of each method and the parameter name of output parameter and parameter type, and for storing each service The method name of each method, the input parameter type of each method and each side of setting that Service name, service are comprised The corresponding relation of method analog form.
11. systems as claimed in claim 10, it is characterised in that also include:
First simulated templates generation module, for finding out the side being arranged to whole analog form in each service Method, and for being arranged to each method of whole analog form, according to the parameter of the output parameter of the method Type arranges the parameter value of correspondence, by the parameter value arranged and the parameter name of output parameter of correspondence, parameter class Type saves as the first simulated templates.
12. systems as claimed in claim 11, it is characterised in that described message constructing module, specifically When method for calling in described call request message request is arranged to whole analog form, according to described The agreement that call request message is used, generate corresponding format response message, and by storage with described tune Insert in described message by the content of the first simulated templates corresponding to the method for request message request call.
13. systems as claimed in claim 9, it is characterised in that described packet forwarding module, specifically use According to the source IP comprised in described call request message, Service name, method name and input parameter type, The Service name that prestores, method name, input parameter type, the source IP of call request message carry with service For the corresponding relation of the address of system is searched the required service provider system forwarded of described call request message Address;If search less than, then return fault alarm information or by described call request to service call terminal Message is forwarded to the acquiescence forwarding address pre-set;If finding, then provide system according to the service found The address of system forwards described call request message.
14. systems as claimed in claim 10, it is characterised in that also include:
Second simulated templates generation module, for finding out the side being arranged to partial simulation mode in each service Method;For being arranged to each method of partial simulation mode, according in whole output parameters of the method The parameter type needing the output parameter of simulation arranges corresponding parameter value, it would be desirable to the output parameter of simulation The parameter value of parameter name, parameter type and correspondence saves as the second simulated templates.
15. systems as claimed in claim 14, it is characterised in that described message constructing module, specifically When method for calling in described call request message request is arranged to partial simulation mode and reception After the response message that described service provider system returns, that this response message is comprised with described second mould Intend the parameter value of the consistent output parameter of the parameter name of output parameter that template comprised to be revised as and described the The parameter value that in two simulated templates, the parameter name of this output parameter is corresponding.
16. systems as described in any one of claim 9-15, it is characterised in that described message forwards mould Block, is additionally operable to when described method is arranged to non-analog mode, forwards described call request message to service Offer system, and after receiving the response message that service provider system returns, the response message that will receive Return directly to service call terminal.
The system of 17. 1 kinds of Web service simulations, it is characterised in that including:
Service broker system as described in any one of claim 9-16;
Service provider system, is used for when receiving the call request message that described service broker system forwards, Generate response message and be back to described service broker system.
CN201210258669.1A 2012-07-24 2012-07-24 A kind of Web services the method and system thereof and service broker system simulated Active CN103580937B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210258669.1A CN103580937B (en) 2012-07-24 2012-07-24 A kind of Web services the method and system thereof and service broker system simulated

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210258669.1A CN103580937B (en) 2012-07-24 2012-07-24 A kind of Web services the method and system thereof and service broker system simulated

Publications (2)

Publication Number Publication Date
CN103580937A CN103580937A (en) 2014-02-12
CN103580937B true CN103580937B (en) 2016-11-23

Family

ID=50051917

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210258669.1A Active CN103580937B (en) 2012-07-24 2012-07-24 A kind of Web services the method and system thereof and service broker system simulated

Country Status (1)

Country Link
CN (1) CN103580937B (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105446867B (en) * 2014-08-22 2019-05-28 阿里巴巴集团控股有限公司 A kind of generation method and device of test data
CN105740258B (en) * 2014-12-09 2019-01-04 阿里巴巴集团控股有限公司 Method for processing business and device based on idempotent number verification
CN106201862B (en) * 2015-05-25 2019-03-15 阿里巴巴集团控股有限公司 Web services method for testing pressure and device
CN105159746B (en) * 2015-08-26 2018-09-07 哈尔滨工业大学 Reliablility simulation tool towards fault-tolerant combination web services
CN105763365B (en) * 2016-01-26 2020-05-12 新华三技术有限公司 Exception handling method and device
CN107122292A (en) * 2016-10-21 2017-09-01 北京小度信息科技有限公司 A kind of method and system of analog service
CN106919511B (en) * 2017-03-10 2021-03-26 携程计算机技术(上海)有限公司 Application simulation method, simulation application, operation method thereof and simulation system
CN107733866A (en) * 2017-09-12 2018-02-23 阿里巴巴集团控股有限公司 RPC requests, RPC request processing methods, device and equipment
CN109586941B (en) * 2017-09-29 2021-11-26 华为技术有限公司 Service processing method and device based on service architecture
CN107807841B (en) * 2017-10-18 2020-10-09 中国平安人寿保险股份有限公司 Server simulation method, device, equipment and readable storage medium
CN107977316B (en) * 2017-12-21 2021-08-31 创新先进技术有限公司 Method, client and system for simulating remote procedure call
CN109032952B (en) * 2018-08-09 2021-11-23 中国建设银行股份有限公司 Rule-based intelligent outbound service simulation method and system
CN109451014B (en) * 2018-11-02 2021-02-05 科大国创软件股份有限公司 WebService agent system and transparent agent method thereof
CN110445636B (en) * 2019-07-03 2022-03-18 平安科技(深圳)有限公司 Management platform-based micro-service early warning method and device and computer equipment
CN110661787A (en) * 2019-09-04 2020-01-07 苏宁云计算有限公司 Method and device for capturing Http redirection state code and computer equipment
CN110889073B (en) * 2019-11-21 2024-01-12 掌阅科技股份有限公司 Page request response method, server and computer storage medium
CN113220411B (en) * 2021-04-13 2022-05-31 隆讯(徐州)智能科技有限公司 Internet of things end-to-end service simulation system and method
CN113467971A (en) * 2021-06-29 2021-10-01 未鲲(上海)科技服务有限公司 Service processing method, device, equipment and storage medium
CN113438134B (en) * 2021-06-30 2023-03-31 未鲲(上海)科技服务有限公司 Request message processing method, device, server and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101471960A (en) * 2007-12-25 2009-07-01 株式会社日立制作所 Service providing system, gateway, and server
CN101695076A (en) * 2009-09-21 2010-04-14 中兴通讯股份有限公司 Method and device of unified agent adaptation based on Web service and adaptation system
CN101764837A (en) * 2009-12-23 2010-06-30 宁波东海蓝帆科技有限公司 Web service dynamic calling system and method
CN102148800A (en) * 2010-02-09 2011-08-10 中国人民解放军总参谋部第六十一研究所 Software radio system based on service-oriented architecture

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101471960A (en) * 2007-12-25 2009-07-01 株式会社日立制作所 Service providing system, gateway, and server
CN101695076A (en) * 2009-09-21 2010-04-14 中兴通讯股份有限公司 Method and device of unified agent adaptation based on Web service and adaptation system
CN101764837A (en) * 2009-12-23 2010-06-30 宁波东海蓝帆科技有限公司 Web service dynamic calling system and method
CN102148800A (en) * 2010-02-09 2011-08-10 中国人民解放军总参谋部第六十一研究所 Software radio system based on service-oriented architecture

Also Published As

Publication number Publication date
CN103580937A (en) 2014-02-12

Similar Documents

Publication Publication Date Title
CN103580937B (en) A kind of Web services the method and system thereof and service broker system simulated
CN106131213B (en) Service management method and system
CN101697139B (en) Method, device and registry for remote procedure call
CN101436148B (en) Integrated client end and method for performing interaction of desktop application and network WEB application
CN102262680B (en) Distributed database proxy system based on massive data access requirement
EP3138003B1 (en) System and method for supporting a bypass-domain model and a proxy model and updating service information for across-domain messaging in a transactional middleware machine environment
CN109542427B (en) System customization method and device, electronic equipment and storage medium
CN107241315B (en) Access method and device of bank gateway interface and computer readable storage medium
CN106339237B (en) For the plug-in unit loading frame and method of the field JavaEE WEB application
CN101808051B (en) Application integration gateway and control method thereof
US8707329B2 (en) Open framework system for heterogeneous computing and service integration
CN106445509A (en) SDK batch quick access tool
CN100512158C (en) Network measuring system structure and realizing method thereof
CN110362318A (en) Using dispositions method, device, equipment and storage medium
CN112688915A (en) Cross-protocol communication method, device and server
CN114217981A (en) Bank-enterprise direct connection communication method and device, computer equipment and storage medium
CN113127108A (en) Service request processing method and device, storage medium and electronic equipment
CN108089972B (en) Interface test method and device
CN113360386B (en) Method and device for testing driving of switching chip, electronic equipment and storage medium
CN105446867A (en) Method and apparatus for generating test data
CN114124766B (en) Test method and device based on simulation data
CN107395663A (en) Data capture method and device
CN111581576A (en) Development processing method and device based on micro-service and storage medium
CN108228880B (en) Method, device, equipment and medium for database management system to call external function
CN110022332B (en) Hypertext transfer security protocol proxy method, device, equipment and medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20191210

Address after: P.O. Box 31119, grand exhibition hall, hibiscus street, 802 West Bay Road, Grand Cayman, Cayman Islands

Patentee after: Innovative advanced technology Co., Ltd

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Patentee before: Alibaba Group Holding Co., Ltd.