Web Services
  Home arrow Web Services arrow Page 5 - Web Services and Stateful Resources
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB SERVICES

Web Services and Stateful Resources
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2006-06-29

    Table of Contents:
  • Web Services and Stateful Resources
  • Aspects of State
  • Stateful Resources
  • Role of WS-Addressing
  • Using the Endpoint Reference

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Web Services and Stateful Resources - Using the Endpoint Reference


    (Page 5 of 5 )

    The other important part of the WS-Addressing specification is the way in which the endpoint reference is used by requestors to form Web service messages. The WS-Addressing specification requires that each binding type associated with the Web service define a set of rules that dictate how the components of the endpoint reference must be used to form request messages to the Web service pointed to by the endpoint reference. The specification itself defines only the rules specific to SOAP binding.

    The SOAP rules are simple: The contents of the Address field must appear in the SOAP message's To header, and the contents of the reference properties element must appear as headers in the SOAP message. Here's an example SOAP message that represents a registration request (see Chapter 4 for more details) to a StockAvailableNotification service, as pointed to by the endpoint reference we showed earlier:

    <soap12:Envelope
    xmlns:soap12="http://www.w3.org/2002/12/
    soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/
    03/addressing" xmlns:tns="http://www.skatestown.com/services/
    StockAvailableNotification"> <soap12:Header> <wsa:To> http://www.skatestown.com/services/
    StockAvailableNotification </wsa:To> <wsa:Action> http://www.skatestown.com/services/
    StockAvailableNotification#registration <wsa:Action> <tns:someProperty> ABC 123 </tns:someProperty> <ns1:Expiration xsi:type="xsd:dateTime" xmlns:ns1="http://www.skatestown.com/ns/
    registrationRequest"> 2004-01-30T05:00:00.000Z </ns1:Expiration> </soap12:Header> <soap12:Body> <ns2:registration ... </soap12:Body> </soap12:Envelope>

    The way the reference properties flow (as SOAP header elements of the message) is important to establish context for processing the message. The WS-Resource Framework exploits this feature, as you'll see later in this chapter.

    SOAP Headers Defined by WS-Addressing

    WS-Addressing also standardizes a collection of SOAP headers. You saw one of these SOAP headers in the previous example: the To header. The other headers are summarized in the Table 8.1.

    Table 8.1 SOAP Headers Standardized by WS-Addressing

    WS-Addressing SOAP Header

    Description

    To

    The destination header. WS-Addressing requires this header to appear on messages sent to a Web service pointed to by an endpoint reference. Its content is a copy of the contents of the Address element in the endpoint reference.

    Recipient

    An optional header. It contains a copy of the endpoint reference of the Web service that is the intended recipient of the message. If this header appears, it may help middleware intermediaries to process and route the message.

    From

    An optional header that contains an endpoint reference of the Web service that created the message.

    ReplyTo

    An optional header that contains an endpoint reference of a Web service to which any reply to the message should be sent. If this header doesn't appear, the receiver of the message can use the From element to send reply messages. This aspect of WS-Addressing is useful for asynchronous messaging situations where the network transport protocol can't be relied on to target the response message.

    FaultTo

    An optional header that contains an endpoint reference of a Web service to which any fault messages should be sent. If this header doesn't appear, the receiver of the message can use the ReplyTo or From element to send fault messages.

    Action

    A mandatory element that contains a URI indicating the intent of the message.

    MessageID

    An optional URI that uniquely identifies this message.

    RelatesTo

    An optional collection of QName, URI pairs. This allows you to specify the relationship between this message and other messages in a domain-specific way.


    We consistently use only two of these headers: To and Action; the others are optional. For more information on the use of the headers specified by WS-Addressing, refer to the WS-Addressing spec at http://www.ibm.com/developerworks/ webservices/library/ws-add/.

    Please check back next week for the continuation of this article.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This article is an excerpt from the book "Building Web Services with Java: Making...
     

    Buy this book now. This article is excerpted from chapter 8 of the book Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, written by Steve Graham et al. (Sams; ISBN: 0672326418). Check it out today at your favorite bookstore. Buy this book now.

    WEB SERVICES ARTICLES

    - Safety, Idempotence, and the Resource-Orient...
    - The Resource-Oriented Architecture in Action
    - Features of the Resource-Oriented Architectu...
    - The Resource-Oriented Architecture
    - Getting Started with Flex
    - Automated Billing and Faxing for the Web
    - An Introduction to Web Services
    - The Foundations of Web Services: From Novice...
    - Web Services Reengineering: Finishing Touches
    - Fault Handling with Web Services
    - Flow and Web Services
    - Process Lifecycles and Web Services
    - Business Processes and Web Services
    - Orchestrating Web Services
    - Notifications and Resources in the WS-Resour...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek