Web Services Serialize Messages Not Objects by vev19514


									            Web Services
          Serialize Messages
              Not Objects
Philly Code Camp
April 23, 2005
Don Demsak
             SOA Defined
Loosely Coupled Software Agents
  Service Providers
  Service Consumers
Descriptive Messages
  Constrained By Schemas
Auto Discovery
Implementing SOA WebServices
Doc-Centric SOAP messages
WSDL Required
Everything within a SOAP Message (except binary
Every Message Has A Schema
      RPC vs. Web Services
RPC                            Web Services
  Distributed Objects            Messages
  Mindset – Instructive          Mindset - Descriptive
  Implies Similar Frameworks     Implies Disparate
  Think .Net Remoting            Frameworks
  Can Be Done Using Web
     XML/Object Impedance
Similar to the Relational/Object Impedance
W3C XML Schema Types != CLR types
XmlSerializer Converts Most CLR Types
  The 10% It Can’t is the real problem
Binary Serialization Is Very Different then XML
  Creating WebServices With
Build The Class as ASMX
Annotate The Class Members
  WebService attribute
  WebMethod attribute
Generate WSDL and XSD from ASMX

       Code First Approach
Creating WebServices By Hand
 Define the XML Message Using XSD
 Define the Operations Using WSDL
 Generate the ASMX from WSDL
 Add the operations code to the ASMX
 Write Message to Business Object Reydration

       Contract First Approach
Creating Components With VB6
Create Your VB Classes
Set The Project Compatibility
  No Compatibility
  Project Compatibility
  Binary Compatibility
Generate the IDL
  Within the dll
  External TypeLib

       Code First Approach
Creating Components With IDL
Define the Component Using IDL
Compile to TypeLib Using MIDL
Reference TypeLib from VB6 project
Add implements key word to your VB Class
    RAD Versus Enterprise
        RAD            Enterprise Ready
Quick              More Complicated
Easy Development   Easier Maintenance
Static Design      Extensible Design
Little OOD         All OOD
Little Framework   Built On Frameworks
    Message Centric Tools
Schema Editors
Your Favorite Text Editor
XSD.exe Schema Definition Tool
ThinkTecture – WsContractFirst
NUnit & TestDriven.Net
Mindreef SOAPScope
          Message Example
       <subNode id = "1a" title = "...">
             <subNode id = "2a" title = "...">
                     <subNode id = "3a" title = "..."/>
                     <subNode id = "3b" title = "..."/>
             <subNode id = "2b" title = "...">
                     <subNode id = "3c" title = "..."/>
                     <subNode id = "3d" title = "..."/>
                     <subNode id = "3e" title = "..."/>
                                  Object Model

              RootNode                          SubNodeCollection
+SubNodes : SubNodeCollection
+Serialize() : string                      +SubNodeCollection()
+Deserialize(in xml : string) : RootNode   +this(in index : int) : SubNode
                                           +Add(in value : SubNode) : int

                                           +SubNodes : SubNodeCollection
                                           +title : string
                                           +id : string
       Extensible Schema
Extend Schemas When Possible
Beware Of Non-Deterministic Schemas
Breaking Schema Requires New Version
Use DataTypes & Models
   Build A Message Library
At Minimum Create A Message Namespace
Prefer A Message Library
Messages Are Publicly Creatable
Remember Message != Object Model
Rehydrate Object Model From Message
Generate Message from Object Model

Contact me via my website:

To top