Web software development and cloud computing based on Service-Oriented Architecture (SOA) and Service-Oriented Computing (SOC) represent the modern software engineering theory, practices and technologies. The book takes a comprehensive and coherent approach to address these issues. The goal is to learn the concepts, principles and methods in advanced software architecture, software engineering, and software development. The approach is learning by developing. We assume students have basic understanding of software architecture, and this book takes an architecture-driven approach to help students creating working solutions for their architecture design, including programming and code deployment.  The text consists of fourteen chapters and three appendices, which are organized into three parts.

Chapter 1    Introduction to Distributed Service-Oriented Computing

Chapter 2   Distributed Computing with Multithreading    

Chapter 3    Essentials in Service-Oriented Software Development

Chapter 4    XML Data Representation and Processing

Chapter 5    Web Application and Data Management

Chapter 6    Dependability of Service-Oriented Software

Chapter 7    Advanced Services and Architecture-Driven Application Development

Chapter 8    Enterprise Software Development and Integration

Chapter 9    Service-Oriented and Event-Driven Robotics Applications

Chapter 10  Interfacing Service-Oriented Software with Databases

Chapter 11 Ontology and Semantic Web

Chapter 12 Service-Oriented Application Architecture

Chapter 13 A Mini Walkthrough of Service-Oriented Software Development

Chapter 14 Cloud Computing and Software as a Service

Appendix A  Web Application Development

Appendix B  Service-Oriented Robotics Applications

Appendix C  ASU Repository of Services and Applications

Each part is relatively independent and can be used in a different course. Part I includes the first six chapters, which can be used for a service-oriented computing and distributed software development course at the senior level or graduate level of universities. This part emphasizes the computing paradigm, data representation, data management, and programming language-based SOC software development. It introduces fundamental concepts and principles, in addition to technologies and tools, which have not been taught in traditional software engineering courses. This part covers multithreading, event-driven programming, service-oriented development, Web-based programming, Web data management, and reliability and security mechanism development.

Part II includes the next eight chapters. These chapters are built on the basic concepts and principles discussed in Part I, yet they do not rely on the detail of the first six chapters. This part emphasizes software composition and integration using services and components. The approach is based on higher-level of data management and application building techniques. Part II covers advanced service and application development and integration in Windows Communication Foundation, Workflow Foundation for application integration, Business Process Execution Language (BPEL) for enterprise software integration, and Visual Programming Language (VPL) for event-driven software development and robotics applications, interfaces between service-oriented software and databases, ontology languages and applications, service-oriented application architecture, and cloud computing. The materials in Part II can be used for a senior or graduate course on advanced software engineering and software integration. While most contents in Part II are based on matured knowledge and technologies, many research questions are also discussed to help graduate students to identify their research directions and topics.

Part III Appendix A and Appendix B contain tutorial-based materials that provide stepwise instructions, without missing pieces, to build working applications from scratch. These tutorials and exercises can help students to learn concepts by examples. This part can also be used for a freshman level course to introduce computing concepts through robotics programming and Web application programming. Appendix C lists the deployed examples and URLs of services, applications, and other resources used in this text.

At Arizona State University, we use the book as the text for two courses. The first course is CSE445/598 (Distributed Software Development), where the CSE445 session is for seniors and the CSE598 session is for graduate students. This course mainly teaches the content from Part I. Biweekly programming assignments and projects are given at the end of each chapter.

Part II of the book is used for a newly developed course CSE494/598 (Software Integration Engineering) for seniors and graduate students.

We recommend teaching the two courses in a sequence. However, the two courses can be taught independently without making one to be the prerequisite of the other. In this case, the basic concepts and principles from Part I, including those from a part of Chapter One and the first section of Chapter Four, should be reviewed or be assigned as reading materials for preparing the required concepts to start the course using Part II.

The first edition of the book covered the concepts, principles, methodology, and the latest technologies in service-oriented software development. As this field is still a rapidly developing young field, many new concepts as well as technologies have emerged since the publication of the first edition in 2008. In the latest edition of the book, we have embraced a large of part of the new knowledge, including concepts, principles, and technologies developed in the past years. Five new chapters are added, and all the other chapters have been significantly revised and extended. The new chapters include the following:

Chapter Five on Web application and data management, which discusses stateful Web application development using different state management techniques, including view state, session state, application state, file management, Web caching, and dynamic graphics generation.

Chapter Seven on service-oriented and resource-oriented computing, which introduces Web service development, service hosting, RESTful service development in Windows Communication Foundation, and workflow development and application integration in Workflow Foundation.

Chapter Nine on service-oriented computing in robotics applications, which studies Visual Programming Language (VPL) and uses it develop robotics services and applications. Distributed robotics applications and Robot-as-a-Service (RaaS) are also presented.

Chapter Ten on service-oriented database management, which presents interface between service-oriented software and relational database, XML database, and LINQ (Integrated Language Query) and using LINQ to access object, relational database, and XML database.

Chapter Fourteen on cloud computing, which introduces the most recent trend in SOC. It covers   multi-tenancy architecture, Web databases and file systems, scheduling, fault-tolerant techniques, and real-time computing. It also presents cloud computing platforms and development environments from Google, Microsoft, and Salesforce.com. Software-as-a-Service is the focus of the chapter.

We like to thank many of our sponsors, colleagues, and students in this project, particularly in preparing this edition of the book, including Prof. Xiaoying Bai of Tsinghua University, Dr. Shuyuan Chen of SAP, Dr. J. Y. Chung of IBM, Prof. Zhihui Du of Tsinghua University, Mr. Marcos Garcia-Acosta of Intel, Prof. Mei Hong of Peking University, Dr. K. W. Hwang of IBM, Prof. Zhi Jin of Peking University, Prof. Y. H. Lee of Arizona State University, Prof. Yisheng Li of Fudan University, Mr. John Oliver of Intel, Dr. Raymond Paul of DoD OSD NII, Prof. S. S. Yau of Arizona State University, and Prof. Lian Yu of Peking University. They contributed to our understanding of the materials. We also acknowledge the generous support from Intel, the U.S. Department of Education, the U.S. Department of Defense, and the National Science Foundation. Without their support, this book would not be possible. We also thank the teaching assistants and research assistants at Arizona State University, including Jay Elston, Wu Li, Guanqiu Qi, Edward Raleigh, Qihong Shao, Xin Sun, Le Xu, and Peide Zhong. They validated many of the examples and assignments used in the book. Finally, we would like to thank our families for their support and understanding of taking on such a project while carrying out a full research and teaching load at the university.

Note for Instructors

All the assignments and projects have been classroom-tested at Arizona State University. Furthermore, all the code presented in this book has been developed and tested. Contact the authors if you are interested in obtaining more materials in this book. Instructor-only resources, such as presentation slides, assignments, and tests, can be obtained by directly contacting the authors at {yinong, wtsai}@asu.edu

Yinong Chen, Arizona State University

Wei-Tek Tsai, Arizona State University and Tsinghua University

June 2011 (Third Edition)
Table of Contents

Preface (This Edition) xii

Preface (First Edition) xv

Part I                Distributed Service-Oriented Software Development and Web Data Management 1

Chapter 1      Introduction to Distributed Service-Oriented Computing. 3

1.1                 Computer Architecture and Computing Paradigms. 3

1.1.1               Computer Architecture. 3

1.1.2               Software Architecture. 4

1.1.3               Computing Paradigms. 4

1.2                 Distributed Computing and Distributed Software Architecture. 7

1.2.1               Distributed Computing. 7

1.2.2               N-Tier Architecture. 8

1.2.3               Distributed Object Architecture. 10

1.3                 Service-Oriented Architecture and Computing. 12

1.3.1               Basic Concepts and Terminologies. 12

1.3.2               Service-Oriented Computing. 15

1.3.3               Object-Oriented Computing versus Service-Oriented Computing. 17

1.3.5               Service-Oriented System Engineering. 19

1.4                 Service-Oriented Software Development and Applications. 20

1.4.1               Traditional Software Development Processes. 20

1.4.2               Service-Oriented Software Development 20

1.4.3               Applications of Service-Oriented Computing. 24

1.4.4               Web Application Composition. 25

1.5                 Enterprise Software Development 26

1.6                 Discussions. 29

1.7                 Exercises and Projects. 33

Chapter 2      Distributed Computing with Multithreading. 41

2.1                 Introduction to C# and .Net 41

2.1.1               Getting Started with C# and .Net 41

2.1.2               Comparison between C++ and C#. 44

2.1.3               Namespaces and the using Directive. 45

2.1.4               Class and Object in C#. 47

2.1.5               Parameters: Passing by Reference with ref & out 50

2.1.6               Base Class and Base Calling Class Constructor 51

2.1.7               Constructor, Destructor, and Garbage Collection. 51

2.1.8               Pointers in C#. 51

2.1.9               C# Unified Type System... 52

2.2                 Memory Management and Garbage Collection. 53

2.2.1               Static Variables and Static Methods. 54

2.2.2               Runtime Stack for Local Variables. 55

2.2.3               Heap for Dynamic Memory Allocation. 57

2.2.4               Scope and Garbage Collection. 57

2.3                 General Issues in Multitasking and Multithreading. 58

2.3.1               Basic Requirements. 58

2.3.2               Critical Operations and Synchronization. 59

2.3.3               Deadlock and Deadlock Resolving. 61

2.3.4               Order of Execution. 62

2.3.5               Operating System Support for Multitasking and Multithreading. 63

2.4                 Multithreading in Java. 65

2.4.1               Creating and Starting Threads. 65

2.4.2               Thread Synchronization. 69

2.4.3               Synchronized Method. 69

2.4.4               Synchronized Statements. 73

2.5                 Multithreading in C#. 74

2.5.1               Thread Classes and Properties. 74

2.5.2               Monitor 75

2.5.3               Reader and Writer Locks. 84

2.5.4               Mutexes. 88

2.5.5               Semaphore. 88

2.5.6               Coordination Event 89

2.6                 Exception Handling and Event-Driven Programming. 91

2.6.1               Exception Handling. 92

2.6.2               Event-Driven Programming. 95

2.6.3               Case Study: An Electronic Commerce Application in Event-Driven Approach. 100

2.7                 Discussions. 105

2.8                 Exercises and Projects. 107

Chapter 3      Essentials in Service-Oriented Software Development 119

3.1                 Service-Oriented Software Development Environments. 119

3.1.1               Overview.. 119

3.1.2               Windows Communication Foundation. 121

3.1.3               WCF Service Interface: Address, Binding, and Contract 122

3.2                 Service Provider: Creating and Hosting Services. 123

3.2.1               Getting Started with Developing WCF Services. 124

3.2.2               Hosting Your Web Services as a Service Provider 128

3.3                 Service Brokers: Publishing and Discovering Services. 130

3.3.1               An Ideal Service Broker with All Desired Features. 130

3.3.2               UDDI Service Registry. 133

3.3.3               ebXML Service Registry and Repository. 140

3.3.4               Ad Hoc Registry Lists. 142

3.4                 SOAP. 143

3.4.1               SOAP Format 143

3.4.2               SOAP Over HTTP. 144

3.5                 WSDL: Web Services Description Language. 145

3.5.1               Elements of WSDL Documents. 146

3.5.2               WSDL Document Example. 147

3.6                 Service Requesters: Building Applications Using Services. 148

3.6.1               Connecting Endpoint and Proxy. 149

3.6.2               Creating a Web Application Project in ASP.Net 149

3.6.3               Developing ASP .Net GUI Client to Consume ASP .Net Web Services. 151

3.6.4               Developing ASP .Net GUI Client to Consume WCF Services. 154

3.6.5               Developing ASP .Net GUI Client to Consume Services Discovered on Internet 156

3.7                 Java-Based Web Service Development 158

3.7.1               Web Application Building Using AJAX programming. 158

3.7.2               Java-Based Web Service Development and Hosting. 160

3.8                 Discussions. 162

3.9                 Exercises and Projects. 163

Chapter 4      XML Data Representation and Processing. 169

4.1                 XML Fundamentals. 169

4.1.1               XML versus HTML.. 170

4.1.2               XML Syntax. 171

4.1.3               XML Namespaces. 174

4.2                 XML Data Processing. 175

4.2.1               DOM: Document Object Model 176

4.2.2               SAX: Simple API for XML.. 178

4.2.3               XML Text Writer 180

4.2.4               XML Processing in Java. 181

4.3                 XPath. 182

4.4                 XML Type Definition Languages. 185

4.4.1               XML Document Type Definition (DTD) 185

4.4.2               XML Schema. 187

4.4.3               Namespace. 190

4.4.4               XML Validation. 192

4.5                 Extensible Stylesheet Language. 194

4.6                 Other Web Data Formats. 199

4.6.1               XHTML.. 200

4.6.2               RSS. 202

4.6.3               Atom... 205

4.6.4               Google Protocol Buffers and BigTable. 206

4.7                 Discussions. 208

4.8                 Exercises and Projects. 209

Chapter 5      Web Application and Data Management 215

5.1                 Models of Web Applications. 215

5.1.1               Pure HTML-based Web Application. 215

5.1.2               Client-Side Scripting. 216

5.1.3               Server-Side Scripting and Code-Behind Page Computing. 217

5.1.4               Client-Side Out-Of-Browser Computing. 218

5.2                 Structure of Web Applications. 219

5.2.1               Components of Web Applications. 219

5.2.2               Server Controls. 222

5.2.3               User Controls. 226

5.2.4               Web Application Configuration. 228

5.2.5               Global Application Class. 230

5.2.6               Dynamic Link Library. 231

5.3                 State Management 232

5.3.1               Overview of State Management Techniques. 233

5.3.2               View State. 233

5.3.3               Session State. 235

5.3.4               Session State and Cookies. 239

5.3.5               Application State and Service Execution Model 240

5.4                 Save User Data to Server File System.. 241

5.4.1               File System and Standard File Operations. 241

5.4.2               Reading and Writing XML Files. 242

5.5                 Caching. 246

5.5.1               Output Caching. 246

5.5.2               Fragment Caching. 248

5.5.3               Data Caching. 248

5.6                 Dynamic Graphics Design and Generation. 254

5.6.1               Dynamic Graphics. 254

5.6.2               Getting Started with Dynamic Graphics Generation. 255

5.6.3               Generating Dynamic Graphics in User Control 257

5.7                 Architecture Design. 262

5.7.1               ASP .Net Forms-Centric Architecture. 262

5.7.2               ASP .Net MVC Architecture. 263

5.8                 Discussions. 264

5.9                 Exercises and Projects. 265

Chapter 6      Dependability of Service-Oriented Software. 271

6.1                 Basic Concepts. 271

6.1.1               Dependability. 271

6.1.2               Dependability Attributes and Quality of Service. 272

6.1.3               Security Issues in SOA Software. 273

6.2                 Access Control in Web Applications. 275

6.2.1               IIS and Windows-Based Security Mechanisms. 275

6.2.2               Forms-Based Security. 276

6.2.3               User Registration and Account Management 281

6.3                 Encryption and Decryption. 283

6.3.1               Developing Encryption and Decryption Service in WCF. 283

6.3.2               WCF Service Client 285

6.3.3               Secure Sockets Layer Cryptographic Protocols. 287

6.4                 Dependable Computing in Windows Communication Foundation. 287

6.4.1               WS-Security. 287

6.4.2               WS-Reliability. 289

6.4.3               Transactions. 290

6.5                 Discussions. 292

6.6                 Exercises and Projects. 293

Part II              Advanced Service-Oriented Computing and System Integration. 297

Chapter 7      Advanced Services and Architecture-Driven Application Development 299

7.1                 Self-Hosting Services. 299

7.1.1               Developing Self-Hosting WCF Services. 299

7.1.2               Developing Clients to Consume Self-Hosting Services. 303

7.2                 Advanced WCF Services. 307

7.2.1               Advanced Communication Models. 308

7.2.2               Advanced Bindings. 310

7.2.3               Service Behavior and State Management 311

7.3                 REST Concept and RESTful Services. 314

7.3.1               REST Concept and REST Architecture. 315

7.3.2               RESTful Services. 315

7.3.3               Two Ways of Developing RESTful Service. 319

7.3.4               Developing an Image Verifier in RESTful Service. 322

7.3.5               Consuming RESTful Service. 326

7.4                 Workflow Foundation. 327

7.4.1               Architecture and Components. 327

7.4.2               Creating a WF Flowchart Application. 330

7.4.3               Creating Custom Code Activity for Workflow Application. 332

7.4.4               Implementing Finite State Machine in Workflow.. 334

7.4.5               Creating Workflow Service. 336

7.5                 Discussions. 344

7.6                 Exercises and Projects. 345

Chapter 8      Enterprise Software Development and Integration. 351

8.1                 Overview of Composition Languages. 351

8.2                 BPEL. 354

8.2.1               BPEL Activities and Constructs. 354

8.2.2               BPEL Process. 354

8.2.3               WSDL Interface Definition of BPEL Process. 357

8.2.4               BPEL Process. 359

8.2.5               An Example Invoking Real Web Services. 361

8.3                 Stateless versus Stateful Web Services. 368

8.3.1               BizTalk’s Singleton Object Approach. 369

8.3.2               BPEL’s Correlation Approach. 369

8.4                 Frameworks Supporting BPEL Composition. 372

8.4.1               Oracle SOA Suite. 372

8.4.2               ActiveBPEL.. 373

8.4.3               BizTalk. 374

8.5                 Message-Based Integration. 374

8.5.1               Java Message Service. 376

8.5.2               Microsoft Message Queue. 377

8.5.3               Database-Supported Messaging. 378

8.5.4               Enterprise Service Bus. 380

8.6                 Mashup for Web Application Integration. 381

8.7                 Other Composition Languages. 384

8.7.1               OWL-S. 384

8.7.2               SCA/SDO.. 385

8.7.3               WSFL: Web Services Flow Language. 386

8.8                 Discussions. 388

8.9                 Exercises and Projects. 389

Chapter 9      Service-Oriented and Event-Driven Robotics Applications. 395

9.1                 Service-Oriented Robotics Computing. 395

9.2                 Event-Driven Robotics Applications. 397

9.3                 Robot as a Service and Cyber-Physical Systems. 399

9.3.1               Robot as a Service. 399

9.3.2               Cyber-Physical Systems. 401

9.4                 Robotics Developer Studio and Visual Programming Language. 402

9.5                 Simulating an ALU Using VPL. 406

9.5.1               Logic Design of an Arithmetic and Logic Unit 406

9.5.2               Creating VPL Activities. 407

9.5.3               VPL Diagram and Testing. 408

9.6                 Finite State Machine and VPL Diagram.. 411

9.7                 Developing Service-Oriented Robotics Applications. 415

9.7.1               Service Repository in Robotics Developer Studio. 415

9.7.2               Sensor Service. 416

9.7.3               Maze Navigation Algorithms. 417

9.7.4               Implementing a Heuristic Maze Navigation Algorithm... 417

9.7.5               Implementing a Wall-Following Maze Navigation Algorithm... 424

9.8                 Mapping VPL to Other Platforms. 426

9.9                 Discussions. 428

9.10               Exercises and Projects. 429

Chapter 10    Interfacing Service-Oriented Software with Databases. 433

10.1               Databases in Service-Oriented Software. 433

10.2               Relational Databases in Service-Oriented Software. 434

10.2.1             Interface between Database and Software. 434

10.2.2             SQL Database in ADO .Net 436

10.2.3             DataAdapter and DataSet in ADO .Net 442

10.2.4             WCF RIA Service. 444

10.3               XML-Based Database and Query Language XQuery. 446

10.3.1             Expressing Queries. 446

10.3.2             Transforming XML Document 448

10.3.3             XQuery Discussions. 450

10.4               LINQ, Language Integrated Query. 450

10.4.1             What is the Purpose of LINQ?. 450

10.4.2             Lambda Expressions. 451

10.4.3             LINQ to Object 453

10.4.4             LINQ to SQL.. 455

10.4.5             LINQ to XML.. 458

10.5               Discussions. 460

10.6               Exercises and Projects. 461

Chapter 11    Ontology and Semantic Web. 465

11.1               Semantic Web and Ontology. 465

11.2               Ontology Languages RDF and RDF Schema. 466

11.2.1             RDF. 466

11.2.2             RDF Schema. 468

11.2.3             Reasoning and Verification in Ontology. 474

11.3               OWL: Web Ontology Language. 475

11.3.1             From RDF to OWL.. 475

11.3.2             The OWL Class and Property. 476

11.3.3             Boolean Combinations of Classes. 477

11.3.4             Property Restrictions. 477

11.3.5             Synopsis of OWL Lite, DL, and Full 479

11.4               Linked Data. 480

11.5               Ontology Development Environments. 481

11.6               Discussions. 482

11.7               Exercises and Projects. 483

Chapter 12    Service-Oriented Application Architecture. 487

12.1               Introduction. 487

12.2               Application Architectures. 489

12.2.1             Dynamic Architecture via Dynamic Composition. 491

12.2.2             Dynamic Re-Composition. 492

12.2.3             Lifecycle Management Embedded in Operation Infrastructure. 492

12.3               Examples of Service-Oriented Application Architectures. 494

12.3.1             IBM WebSphere Architecture. 494

12.3.2             Enterprise Service Bus. 496

12.3.3             SAP NetWeaver 497

12.3.4             User-Centric Service Oriented Architecture. 498

12.4               Discussions. 499

12.5               Exercises and Projects. 501

Chapter 13    A Mini Walkthrough of Service-Oriented Software Development 505

13.1               Introduction. 505

13.2               Sample Domain Model 509

13.2.1             Ontology Systems. 509

13.2.2             Published Services. 513

13.2.3             Published Workflows. 516

13.2.4             Shipping Domain Collaboration Templates. 517

13.3               Specific Requirements for a Project 519

13.4               A Worked Example. 520

13.5               Discussions. 528

13.6               Exercises and Projects. 531

Chapter 14    Cloud Computing and Software as a Service. 533

14.1               Introduction. 533

14.2               SaaS Maturity Model 536

14.3               Database Design for Multi-Tenancy SaaS. 538

14.3.1             Resource Isolation Patterns. 540

14.3.2             Security. 543

14.3.3             Scalability. 545

14.4               Google App Engine. 546

14.4.1             Services. 547

14.4.2             Datastore. 547

14.4.3             Hints for Developing Scalable Applications. 548

14.4.4             Development and Tooling. 548

14.4.5             Other Constraints. 548

14.5               Google File System.. 549

14.5.1             GFS System Structure and Operations. 549

14.5.2             Lessons Learned from Developing GFS. 550

14.5.3             Other Similar Projects. 551

14.6               BigTable. 552

14.6.1             Major Components. 552

14.6.2             BigTable Overview.. 553

14.7               MapReduce. 558

14.7.1             MapReduce Programming Model 559

14.7.2             Example. 559

14.7.3             Applications. 560

14.7.4             Execution Overview.. 560

14.7.5             Task Granularity and Fault-Tolerant Computing. 561

14.8               Hadoop. 561

14.8.1             Hadoop Ecosystem... 561

14.8.2             Hadoop HDFS & MapReduce. 562

14.8.3             Example. 563

14.9               Microsoft Azure. 565

14.9.2             Azure Architecture. 565

14.9.3             Azure Elements. 566

14.9.4             Azure Cloud Applications. 567

14.10            Salesforce.com.. 568

14.11            Prioritization and Scheduling. 573

14.12            Cloud Computing Algorithms. 579

14.13            Applications of Data Differencer 589

14.14            Discussions. 590

14.15            Exercises and Projects. 591

Part III            Appendix: Tutorials on Service-Oriented Software Development 593

Appendix A  Web Application Development 595

A.1                Design of Graphical User Interface. 595

A.2                Discovering Web Services Available Online. 600

A.3                Access Web Services in Your Program: Cinema Service. 602

A.4                Access Web services in Your Program: Weather Forecasting Service. 606

A.5                Access Web Services in Your Program: USZip Service. 608

A.6                Creating ASP .Net Web Services. 609

A.7                Exercises and Projects. 613

Appendix B  Service-Oriented Robotics Applications. 617

B.1                 Getting Started with Robotics Developer Studio and VPL. 617

B.2                 Programming Conditions in VPL. 619

B.3                 Programming Loop in VPL. 620

B.4                 Programming a Robot in a Simulation Environment 620

B.5                 Deploying the Program to a Real Robot 625

B.6                 Programming the Arm of the Robot 626

B.7                 Autonomous Robot in an Obstacle Course. 628

B.8                 Exercises and Projects. 633

Appendix C  ASU Repository of Services and Applications. 635

References   639

Index    647