XML Web Services Hints and Tips - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

XML Web Services Hints and Tips

Description:

XML Web Services Hints and Tips Bob Steemson Product Architect iSOFT plc – PowerPoint PPT presentation

Number of Views:142
Avg rating:3.0/5.0
Slides: 19
Provided by: BobS105
Category:

less

Transcript and Presenter's Notes

Title: XML Web Services Hints and Tips


1
XML Web ServicesHints and Tips
  • Bob SteemsonProduct ArchitectiSOFT plc

2
Introduction
  • Why use XML Web Services?
  • Some thoughts on XML
  • Building Web Service Code
  • Summary
  • Questions

3
Why Use XML Web Services?
  • Facilitates loose-coupling of applications
  • Platform Independent
  • Powerful XML tools available
  • Standard Internet technology lowers costs
  • Independent of proprietary platforms
  • Independent of expensive third party software
  • Open-source solutions available

4
Some Thoughts on XML
  • XML is not about text
  • Understand and use namespaces
  • Make use of XML Schemas
  • Make use of XSLT

5
XML is not about text
  • Dont build XML Strings by hand
  • Use appropriate tools
  • For example MXXMLWriter, XmlWriter, JDOM
  • Will handle illegal characters and buffer data
  • Will help ensure your XML is well formed
  • Dont pretty print XML strings unnecessarily
  • Most XML will be passed from method to method or
    from machine to machine
  • View with tools like XML Spy or Internet Explorer
  • If necessary, include an option in test tools
  • Dont keep parsing and serialising documents
  • Once parsed, keep as a DOM as long as possible

6
Understanding XML Namespaces
  • Prevent element and attribute names from
    different applications from clashing
  • XML Namespaces associate element and attribute
    names with a URI (URI or URN)
  • The URI is a way of defining a globally unique
    string
  • Two namespace URIs are equal if they are
    identical character-by-character (case sensitive)
  • There need not be a corresponding resource
  • Namespace prefix is a local synonym for URI
  • Avoids problems if URI contains illegal
    characters
  • Two names with different prefixes are identical
    if local names and URIs are the same

7
Using XML Namespaces
  • Always use namespaces for external XML
  • Anything that may be seen outside this
    application
  • Internal XML such as configurations may have no
    namespace if you are certain it will not escape
  • Avoid using the default namespace with no prefix
  • Reserve no prefix to mean no namespace
  • Can make writing XSLT more difficult
  • Beware of domain name changes if using a URL
  • Do not hard code the URL
  • URL changes require coordination with partners
  • Dont forget Schema and XSL documents

8
Make use of XML Schemas
  • Create and publish a schema for each document
  • Validate input XML before processing by default
  • Allow validation to be turned off
  • Have an option to validate output documents
  • Use mainly for testing
  • Turn this off by default Buyer beware

9
Make use of XSL Transformations
  • XSLT is a powerful way of transforming XML
  • Much more than a way of turning XML into HTML
  • Can change or remove document namespaces
  • Restructure elements or convert codes
  • Simplify complex external schemas
  • Can make serialisation deserialisation simpler

10
Building Web Services
  • Designing Web Services
  • Security requirements
  • Think about testing
  • Dont leave namespaces at the default
  • .NET Web Services Enhancements

11
Designing Web Services
  • Web Services should be Coarse Grained
  • Think of complex transactions that involve
    multiple co-operating objects, rather than object
    methods
  • Try to have fewer methods and extend
    functionality with options if necessary
  • Try to make stabilise service signatures - WSDL
  • Both ESI and the CHI Web Services have a single
    method that includes a service type parameter
  • Pass complex data as XML
  • Consider passing XML as a DOM Element rather than
    a string

12
Web Services Security
  • Keep security and other parameters separate
  • Both may change but probably not at the same
    time
  • If possible, keep security credentials out of the
    SOAP body
  • Consider using WS-Security (see below)

13
Web Services Testing
  • Ensure that services can be tested in-house
  • When writing a new service
  • Write a simple interactive client for prototyping
    and early development
  • Create an automatic test client for long-term use
  • When writing a client for an external service
  • Provide a simple emulator for in-house testing
  • Allows progress while connections are set up
  • Allows future debugging in a closed environment
  • Update the emulator after external testing

14
Web Services Tracing
  • Use Web Services Tracing if all else fails
  • Can be useful in sorting out namespace issues
  • MS SOAP Toolkit (VB6) includes Trace Utility
  • Apache SOAP includes TcpTunnelGui class
  • .NET Web Services Enhancements classes have built
    in trace facilities

15
Use of Namespaces with SOAP
  • Tools such as the MS SOAP Toolkit and .NET will
    create WSDL files with default XML namespaces
  • Always take the time to override these with
    specific namespaces for your application

16
.NET Web Services Enhancements
  • Extension to standard .NET Web Services classes
  • Download from MSDN (current version 1.0 SP1)
  • Supports additional Web Services specifications
    that have been developed by Microsoft, IBM and
    other partners
  • WS-Security
  • Supports security tokens for authentication
  • Supports digital signing for message integrity
  • Supports encryption for confidentiality
  • WS-Routing
  • Route of Web Services requests via intermediaries
  • WS-Attachments
  • Allows attachments to SOAP messages

17
Summary
  • XML Web Services provide a simple and reliable
    way to connect applications
  • Based on well-established technologies
  • Cross-platform but there are still grey areas
  • Easier to design and deploy than many
    alternatives such as DCOM or CORBA

18
Questions
  • Contact Details
  • Bob.Steemson_at_isoftplc.com
Write a Comment
User Comments (0)
About PowerShow.com