Web Services Serialize Messages Not Objects by vev19514

VIEWS: 12 PAGES: 16

									            Web Services
          Serialize Messages
              Not Objects
Philly Code Camp
April 23, 2005
Don Demsak
www.donxml.com
             SOA Defined
Loosely Coupled Software Agents
  Service Providers
  Service Consumers
Descriptive Messages
  Constrained By Schemas
Extensible
Auto Discovery
Implementing SOA WebServices
Doc-Centric SOAP messages
WSDL Required
Everything within a SOAP Message (except binary
data)
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
  Services
     XML/Object Impedance
          Mismatch
Similar to the Relational/Object Impedance
Mismatch
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
Serialization
  Creating WebServices With
            VS.Net
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
 Code

       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
  TurboXML
  <oXygen/>
Your Favorite Text Editor
XSD.exe Schema Definition Tool
ThinkTecture – WsContractFirst
NUnit & TestDriven.Net
Mindreef SOAPScope
          Message Example
<rootNode>
       <subNode id = "1a" title = "...">
             <subNode id = "2a" title = "...">
                     <subNode id = "3a" title = "..."/>
                     <subNode id = "3b" title = "..."/>
             </subNode>
             <subNode id = "2b" title = "...">
                     <subNode id = "3c" title = "..."/>
                     <subNode id = "3d" title = "..."/>
                     <subNode id = "3e" title = "..."/>
             </subNode>
       </subNode>
</rootNode>
                                  Object Model


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

                                                      SubNode
                                           +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
               Questions

Contact me via my website:
www.donxml.com

								
To top