Architecture Web Service: Interactive Interface, Web Service Definition Core
content:
API Overview Catalog ServiceMember ServiceFeedback ServiceOrder Service Description & Registration: Publishing Web Services Reference Author
related information:
What is web service based on web services, solutions and development platforms? What is Web service?
Chainivel@uddi-china.org) Chief System Architect September 17, 2001 (this article was originally published by IBM DeveloperWorks China website, its URL is http://www.ibm.com/developerWorks/cn/)
This article is the fifth article of the series of articles for architecture web services, which defines the API messages of the Catalog service in detail in the application examples described above. All the API is the use of SOAP to complete calls and returns, this article through the API specific definition Detail and demonstrate the interactive data structure and definition method and corresponding mode of the API message structure, providing the reader to the help and tutorial of the instance when defining its own web service interface.
In the previous article of this series, the system analysis is made for the Case, and the system is divided, and the following online service components are initially defined:
CATALOG Service - Category Management, Product (Product) Administration, Data Exchange, Data Backup, etc .; Order Service - Accept orders, send orders to other services that accept orders; feedback service - Feedback management, data exchange Wait. Since these services obviously have a user system to support, whether it is because of security considerations (can be permissions to do some operations, or because of the user-dependency of the transaction (obviously the service such as the ORDER is not possible to leave the user) So we need to add an online service MEMBER Service. The application of Membership can basically rely on the process other than the Web service, such as the web application, so the Member Service's Web Service interface can be relatively simple. All of these online component services need to be available For the external interface, our detailed definition starts with the following image: Figure 1. API message This article is mainly included in the two types, one type is a Web service website, including a large number of web services technical information, another Class It is a web service "Stack" series of technical specifications, they are a whole technical system, including UDDI, SOAP, WSDL, XML, etc. This article is a link to these resources, interested readers can find the resource link The content required. API summary has such a few of the API design of the entire system:
Simplicity, because this is a web service for public open, its API design should be simple, to be accepted by a large number of users, to get a better application, then the API must be simple, no complex and difficult API Will get a wide accepted system, unless the system is too wide, and the Web service we want to design is a new system, so that the current application live, the API must be simple. Scalability, as a Web service with high update, strong openness, the API should have good backward scalability, and the API will be based on the newness when the need for changes in internal requirements or changes in external demand. The business logic changes, and the API should not be overturned fundamentally, and the incremental scalable ability should be provided. Compatibility, in fact, the compatibility and scalability are interoperability. The compatibility of the API refers to backward compatibility. The high version of the API should have compatibility to the low version API, which means using a high version API web service. The call should be supported using a low version API. Efficient, the API should take care of the simplicity, when some combined operation is very frequent, we should call the designed a single entrance call for such a interaction, which Enhance the efficiency of external applications while reducing the load of web services. Complete, the so-called completeness is to say that the entire API wants to overwrite all the functions that need to be public, this is the best goal, as long as the design phase considers complete, you can achieve complete requirements. And in case an incomplete situation, it is relatively easy to fix it. Catalog Servicesave_category: Save Category, in which the update and new operations are included, while Category's migration can also be done by this API. Delete_category: Deletes Category and deletes the specified category and its entire child elements from Catalog. Find_category: Logging Category in Catalog, you can pass a variety of ways, such as names, such as keywords, etc. Save_Product: Save Product, in which this API call can also contain updates, new and migrated operations. Delete_Product: Delete the product, remove the specified product information from the Catalog. Find_Product: Logging in catalog, you can pass a variety of ways, such as name, such as Category, such as keywords, etc. GET_CATEGORYDETAIL: Gets the full information of Category, including all the summary information of all Category and the details of Product. Get_ProductDetail: Get the full information of Product. GET_CATEGORYINFO: Get all information for Category and all its children and grandchildes Category and Product. Before defining these messages, we first need to determine the XML description format of Category and Product these two entities. Refer to the entity relationship model in the forebel, we can define them as follows: Category specific description format:
category>
Specific Description Format of Product:
category>
Among them, the specific formats of CompliantSpecbag, Featurebag, and Parameterbag are as follows:
compliantspecbag>
CompliantSpecbag describes which related industry standards have been followed by a computer product. In this aggregation, the specification of Specification can occur many times, each indicating that it follows an industrial standard, such as a entertainment-type laptop, may follow the industrial norms such as USB1.0, IEEE1394 and so on.
featurebag>
Featurebag describes an important feature of a computer product. In this aggregation, Feature can appear multiple times, each entry uses string text to describe a product characteristic. For example, an entertainment-type laptop may include "weight only 2 pounds, thickness only 1.9cm, super portable", such a characteristic description.
parameter>
parameterbag>
ParameterBAG describes a technical parameter of a computer product. In this gather, Parameter can have multiple times, each entry uses keyName and KeyValue name value pair to describe a certain technical parameter. For example, a portable computer may be TFT_SIZE 10.1. "After defining the core data model, we can come to define the specific API message. Save_category is used to save the latest information from Category, use this API call You can complete the update, new and migration of Category.
category>
save_category>
In the above grammatical description, you should find that Save_category can be used to save a complete Category tree, and not light is only one or more Category nodes, such design is designed for efficiency. Target adjustment. When any one of the category or produter belongs throughout the message, the key value categoryKey or ProductKey is empty, that is, this is a new Category or Product, which needs to be inserted into the database, in the return message, will be returned The key value of these elements. When any Category or Product's PARENTCATEGORYKEY does not change, it is indicated that the information is to be updated. When ParentCateGoryKey changes, it indicates that the element will migrate from the previous CategoryGoryKe, which is identified by the original ParentCateGoryKey to the category node identified by the new ParentCateGoryKey. Of course, if the data update operation is included, the data update operation is also implemented. The careful readers must have discovered in this message, there is an Authhinfo element, which is an authorization token for permission inspection. I will indicate how this element is acquired and used. The return of the Save_category message call is one or more complete acceptable category information. The difference between the information submitted is to have only summary information, no information, and the original air key value is filled with the web service assignment. Key value. Below is an example of returning a message:
category>
category>
result>
DELETE_CATEGORY is used to delete the Category's API call, which can remove one or more Category and its entire sub-elements from Catalog.
delete_category>
In the above grammatical description, you should find that Save_category can be used to delete one or more category using the CategoryKey identifier. When a category is deleted, all sub-elements (including Category sub-elements and product sub-elements) will be deleted. The returns of the delete_category message call are one or more key values that are implemented by the deleted category information. Find_Product is used to search for products that meet the specified condition in a Catalog. In this API message, support multiple query methods, such as names, such as the industry specifications followed.
find_product>
In the Find_Product message, you support four search criteria:
Category, the element describes the root of the Category subtree to be searched. The space indicating that the search to be executed is composed of all sub-elements of the category identified by the CategoryKey in this element. Name, the string described in this Name element exists as the leftmost string of the name string, and is also the left matching in the search. For example, "China" "China", "" "" "" " China Computer "will be matched, and" Quality China Auto "will not be matched. CompliantSpecbag, which describes an industry-standard aggregation, relying on this search, and we can exclude all computer products that do not meet these specifications outside of the search results set. For example, two specification USB1.1 and IEEE1394 are included in the element, then only the two specification products will be searched. Parameterbag, which describes a technical parameter aggregation, which is similar to CompliantSpecbag, and all computer products specified by the described technical parameters will be excluded from the search results set. The processing behavior in the default search of CompliantSpecbag and Parameterbag is logical and way, we can define logical or ways by parameter specifying. E.g:
compliantspecbag>
This example indicates that the computer product that needs to be searched is either compatible with USB1.1, or is either compatible with the IEEE1394 interface, then the computer product of any of these two specifications will be excluded from the search results set. The return of the Find_Product message call is one or more Miped Product information, but the list of changes is a list of profile information. Below is an example of returning a message:
product>
product>
result>
After analyzing the above three API messages, we are not difficult to understand Save_Product, Delete_Product and Find_category and the three messages are basically similar, and the form is more simplified, so it is not described in detail, the waste space. For the rest three: get_categorydetail, get_productdetail, and get_categoryinfo, together with these three messages are relatively simple, the incoming key value returns to entity information, I have passed the previous demonstration, I believe that everyone should have a specific understanding, so here The specific news will be defined without outline. MEMBER Service For Member Service, two API messages are provided: get_authtoken is used to request a certification token to the Member Service. The authentication token is required when calling all other APIs. This function is functionally equivalent to the program that completes the login request.
Userid = "SOMELOGINNAME" Password = "somepassword" /> The UserID parameter must appear, indicating an individual user authorized by the online service. MEMBER Service provides a method of validating the user ID and password provided by the user. The Password parameter must appear, which represents the password corresponding to the user ID. Discard_authtoken is used to inform Member Service, the previously available authentication token is no longer valid. When other web services receive this message in Member Service, the use of this authentication token is still received, then other web services should be judged to be illegal. discard_authtoken> Authinfo This parameter is required, it is an element that contains the authentication token. The authentication token can be used to use the GET_AUTHTOKEN API call. Feedback Service Save_feedback: Save FEEDBACK, in this API call, contains updates and new operations, while category's migration can also be done by this API. In addition, the use of this API can also complete the deleted operation (whose designs is because deletion is actions that will not occur), the deletion operation is completed by incorporating feedbackKey and Authnfo. Find_feedback: Locate in Catalog, find feedback, such as name, such as CategoryKey, etc. Get_feedbackDetail: Gets more information on all FEEDBACKs in Category. Get_feedbackInfo: Get more details of all Feedback under the entire subtree under a category. Order ServiceRequest_order: A order request is issued, and two operations that apply for new orders and cancel orders in this API. When the incoming orderkey is empty and contains other details, it is an application for the new order operation. If the incoming orderkey is the key value of the existing Order, it does not contain other details of the Order, then it is considered to cancel the operation of the order. The return of this message can indicate the acceptance or rejection indication for the order request. Get_orderdetail: Get detailed information on orders, used to see afterwards. Find_order: Search for related orders that are specified in the input parameter. Description & Registration: Publishing Web Services In this article, the details and definition of the API of the web service is described in detail, which describes some basic design and application patterns. In this series, I will end this series with WSDL to describe Web services and use UDDI registration web services. Reference Web Service Technology / Commentary UDDI-CHINA.ORG, with UDDI-based Web service technology website. WebServices.org, comprehensive technology website for Web services. IBM DeveloperWorks / Web Service Zone, IBM Web Services Technology Resource Center MSDN Online Web Services Developer Resources, Microsoft Web Services Developer Resources Website ITPAPERS / Web Service, ITPAPERS Web Services Comments Articles Solve B2B e-commerce application interaction and integrated Interop Stack Series Technical Standard Specification UDDI performs white paper, UDDI-CHINA.ORG, UDDI.ORG UDDI Technology White Paper, UDDI-CHINA.ORG, UDDI.ORG UDDI Programmer API Specification, UDDI-CHINA.ORG, UDDI.ORG UDDI Data Structure Reference, UDDI-CHINA. org, UDDI.org Web Service Description Language (WSDL) 1.0, IBM, 25 Sep 2000 SOAP: Simple Object Access Protocol Specification 1.1, IBM, Microsoft, DevelopMentor, 2000 Extensible Markup Language (XML) 1.0 (Second Edition), W3C, 6 OCT 2000 Architecture Web Services Series