SOAP Message Serialization with Templating & Caching Degree of MSc in Computer Science Prabath Siriwardena University of Moratuwa January/2008 SOAP Message Serialization with Templating & Caching Prabath Siriwardena This dissertation was submitted to the Department of Computer Science and Engineering of the University of Moratuwa in Partial Fulfillment of the requirements for the Degree of MSc in Computer Science specializing in Software Architecture. Department of Computer Science and Engineering University of Moratuwa January/2008 ii I hereby declare that the work included in this dissertation has not been submitted in part or whole for any other academic qualification at any institution. -------------------------------- M.G.P.A. Siriwardena -------------------------------- Dr. Sanjiva Weerawarana [Supervisor] iii Abstract Web services marked a remarkable milestone in the field of distributed computing. Its predecessors like, Java RMI and .NET Remoting had their own ways of communication and optimized to suit their individual frameworks. The gain was in performance – which led web services to be behind. SOAP message serializing process itself contributes 90% of the performance bottlenecks found in web service communication [11]. The research focuses on improving SOAP message serialization process with Templating and Caching. With Templating, we use a given WSDL to generate SOAP message templates at the time of code generation and in runtime the generated templates will be substituted with input arguments to the web service APIs . These substituted templates will be cached in the SOAP message template repository, with a unique key to identify each web service request. Cached SOAP message requests will be used in subsequent web service calls, if a match found. With the performance test results obtained, we could witness that Templating & Caching improves the web service performance and the factor of improvement depends on the complexity of objects involved in the web service API call. Also the performance gain due to Templating & Caching increases as the object complexity increases and Templating itself contributes in a larger percentage to the performance gain than the Caching, as the object complexity increases iv Acknowledgements This dissertation is a product of the research carried out as a part of the Degree of MSc in Computer Science at the University of Moratuwa, Sri Lanka. Among, the many who extended their fullest support to me in successfully finishing the research project, first of all, I would like to express my sincere thanks to Dr. Sanjiva Weerawarana. In simple words, without him – I would never be able to complete this. Thanks a lot, Sir – for your guidance and for being very patient. There were times I was fully overloaded with office commitments and almost losing my way – it was you who put me back to the track – and thanks a lot, sir – once again. Not only me, but the entire MSc batch highly appreciate the work of Dr. Gihan Dias and Dr. Sanath Jayasena of University of Moratuwa towards helping us in completing the research project on time. Thanks a lot, sir – for your great commitment and providing us the every opportunity to complete the research in a better way. Also thank you very much for giving us the access to the IEEE Computer Society Digital Library – which was a great help. Also, I would like to thank Mrs. Vishaka Nanayakkara and the academic staff of the Department of Computer Science & Engineering of University of Moratuwa, who shared with us, their invaluable knowledge during past two years. Also, I would like to thank all my colleagues at Virtusa – my former employer, and its management for their kind support extended to me. At last, but not least – I would like to thank my parents who were always behind me, encouraged me and supported me – during both good and bad times. Table of Contents TABLE OF CONTENTS ........................................................................................................................ 1 INDEX OF FIGURES............................................................................................................................. 2 INDEX OF TABLES .............................................................................................................................. 2 SYMBOLS, NOTATION, ABBREVIATIONS AND ACRONYMS ...................................................... 3 1. INTRODUCTION .......................................................................................................................... 4 3. LITERATURE REVIEW............................................................................................................... 8 4. BACKGROUND............................................................................................................................12 3.1. EVOLUTION OF DISTRIBUTED COMPUTING ......................................................................................12 3.2. STANDARDIZING WEB SERVICES ....................................................................................................16 3.2.1 Transports ..............................................................................................................................16 3.2.2 Messaging ..............................................................................................................................16 3.2.4 Reliability ...........................................................................................................................18 3.2.4.1 WS-ReliableMessaging ...................................................................................................18 3.2.5 Transaction .........................................................................................................................18 3.2.5.1 WS-Coordination ............................................................................................................18 3.2.6 Security...............................................................................................................................19 3.3. OBJECT SERIALIZATION .................................................................................................................20 3.4. SOAP ENGINES .............................................................................................................................20 3.4.1 Axis ........................................................................................................................................21 3.4.2 Axis2 ......................................................................................................................................21 3.4.3 ASMX/WCF ............................................................................................................................22 3.4.4 XFire ......................................................................................................................................22 4 SOAP MESSAGE SERIALIZATION ..........................................................................................23 5 AXIS2 SOAP/XML PROCESSING MODELS.............................................................................27 6 TEMPLATING & CACHING ......................................................................................................31 7 TESTING & RESULTS INTERPRETATION .............................................................................36 8 FUTURE WORK ..........................................................................................................................41 9 CONCLUSIONS............................................................................................................................42 10 REFERENCES ..............................................................................................................................43 2Index of Figures Figure 1: Client side caching illustration 08 Figure 2: Evolution of distributed technologies 11 Figure 3: Web services standards 14 Figure 4: SOAP Engine 18 Figure 5: SOAP Envelope 21 Figure 6: AXIS2 core modules 25 Figure 7: AXIS2 SOAP processing model 25 Figure 8: SOAP message template generation 29 Figure 9: Templating & Caching 32 Figure 10: Bypassing the SOAP Body serialization and combining the output with serialized SOAP Header 33 Figure 11: Test suit setup 34 Figure 12: Roundtrip time for 100 API calls in ms Vs Object Complexity Level 36 Figure 13: Contribution of Templating to the performance gain 36 Index of Tables Table 1: Cost comparison for roundtrip message exchange for XML and CORBA 06 Table 2: Performance test results 35 3Symbols, Notation, Abbreviations and Acronyms API Application Programming Interface AXIOM Apache aXIs Object Model CORBA Common Object Request Broker Architecture DCE Distributed Computing Environment HTTP Hypertext Transfer Protocol IDL Interface Description Language IIOP Internet Inter-ORB Protocol OM Object Model ONC Open Network Connectivity ORB Object Request Broker REST Representational State Transfer RMI Remote Method Invocation SOAP Simple Object Access Protocol StAX Streaming API for XML TCP Transmission Control Protocol WS-* Web Service Specifications WSDL Web Service Description Language XML eXtensible Markup Language