RSS


[ Pobierz całość w formacie PDF ]
.This cookie factory is like most manufactur-ers today.It receives orders from customers and orders ingredientsfor its products from suppliers.In the pre Service-Oriented Architec-ture (SOA) days, the cookie factory IT staff may have bought a com-mercial software solution to run the business, hired engineers towrite code to expose a Web browser interface for customers to placeorders, and wrote code to work with the supplier s order system.These choices were slow and expensive; slow in that it took manyengineering hours to switch suppliers or offer new products, andexpensive from the cost of the commercial software licenses andengineers salaries.In the days of SOA, hardly any business systemsanalyst recommends buying proprietary and commercial software to 156 Chapter 7 Learning XML-Centric Technology for SOAFigure 7-2 The cookie factory provides services to receive ordersfrom consumers, order ingredients from a supplier, and notify theconsumers when their orders are ready to ship.build business integration solutions.Figure 7-2 shows the cookie fac-tory after it adopted SOA.The cookie factory provides standard Web Services interfaces forthe following functions." Process_Purchase_Order (PPO).This is a service hosted bythe cookie factory.Input to this service defines the numberof dozen cookies wanted and the type of cookie.The servicereturns a purchase order (PO) number." Check_Ready_Time (CRT).This is a service hosted by thecookie factory.Input to this service is a PO number.The ser-vice returns the number of minutes until the order is readyfor shipment or an out-of-stock notice that shows the reasonfor the delay." Restock.This is a service hosted by the supplier.The cookiefactory makes a restock request when current inventoryfalls below the quantity that is needed to make 10 dozencookies.Input to this service is the current inventory of oneor more ingredients.The output is the new inventory levelsat the cookie factory for the input ingredients." Notification.When a batch is finished, the cookie factorysends an email message to notify the consumer that thecookies are ready to ship. 7.3 The Data Used in the Cookie Factory Example 157The cookie factory service interface definitions give us a startingpoint to consider how to write the working code.There are manyoptions to choose from, including programming language, XMLparsing library, and application development environment.In myexperience, these choices are driven by three factors:1.The learning curve a software architect and developer takesto become proficient with the new tool, technology, andprotocol.2.The scalability and performance of the finished service.3.The ease with which a new software developer maintainsfixes, patches, and corrects the already-written software.Writing the XQuery to implement the cookie factory service iseasy once you have a working knowledge of XQuery itself.Next, Ipresent the example data used in the cookie factory and show how towrite the XQuery to implement the services.7.3 The Data Used in the Cookie Factory ExampleThe cookie factory example requires two kinds of data persistence: alist of ingredients and their quantity in inventory, and a set of recipesto make cookies.The following shows the contents of ingredi-ents.xml. 158 Chapter 7 Learning XML-Centric Technology for SOAThe following shows the contents of directions.xml.50025 7.3 The Data Used in the Cookie Factory Example 159The data model in the above XML documents enables us to writeXQuery code to answer the following questions." How many batches of cookies can I make with the currentingredients on hand?" Do I have enough ingredients to make 10 dozen cookies?" What is the next ingredient that I will run out of?" How long will it take to make 10 dozen cookies?For instance, the following XQuery answers the question,  Whichof the wet ingredients is out of stock?(: Which of the wet ingredients is out of stock? :)for $i in doc("ingredients.xml")/ingredients/wet/*where $i/@amount=0return $iExecute this XQuery and receive the following results.This is a FLWOR XQuery construct [ Pobierz całość w formacie PDF ]
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • wblaskucienia.xlx.pl