Graphic Design
  Home arrow Graphic Design arrow Page 7 - Working with Web Services
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? 
GRAPHIC DESIGN

Working with Web Services
By: Albert J. Saganich, Jr.
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2004-06-28

    Table of Contents:
  • Working with Web Services
  • Web Services Benefits for Service Developers
  • Understanding SOAP, WSDL, and UDDI and Their Place in WebLogic Workshop
  • Developing Web Services
  • Using Web Services Within Workshop Applications
  • Using Web Services from Standalone Applications
  • Conversations
  • Web Service Security
  • Associating Security with Web Services

  • 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


    Working with Web Services - Conversations


    (Page 7 of 9 )

    Chapter 8, "Advanced Control Development," introduced the concept of a conversation. When you want an application to have stateful interactions, you need a conversation. In the game of blackjack, for example, the dealer and one or more players are dealt cards. The point of the game is to get as close as possible to a score of 21 without going over. Of course, there are additional rules, but the concept is simple enough: You are dealt a card, as is the dealer and other players, and you continue to take "hits" (that is, additional cards) until you "bust" (that is, exceed 21) or the dealer busts. This entire process takes place during a conversation. A stateful interaction occurs whenever you have at least two method calls, and the second and subsequent call assumes that a previous call has taken place.

    Web services can be made conversational by setting a method call's phase. Figure 9.5 shows the state diagram for a conversational Web service. Initially, a method starts a conversation (the start phase), and zero or more methods can continue the conversation (the continue phase). Eventually, a method ends the conversation (the end phase).

    BEA

     

    Figure 9.5 -- A state diagram of a conversational Web service.

    Figure 9.6 shows a simple blackjack Web service that supports a number of conversational methods. Figure 9.7 shows the phase property of a selected method.

    BEA

     

    Figure 9.6 -- A conversational Web service.

    Conversational methods are annotated as shown here:

    * @jws:conversation phase="start | continue | finish"

    BEA

    Figure 9.7 -- Phase property of a conversational method.

    During the various methods of a conversation, the Web service's state is serialized when each conversational method or callback handler completes successfully. If a conversational method throws an exception, state is not saved to backing store. You can force the conversational state to be stored regardless of whether a exception is thrown by wrapping the entire contents of a method call within a try/catch block. Listing 9.2 shows an example of ignoring exceptions for the purpose of continuing a conversation.


    Conversation State and Serialization - Conversation state is persisted between method calls to a backing store by using standard Java serialization. Therefore, all control member variables must be of a serializable type. Additionally, complex variables, such as those defined by classes, and any controls used by conversations must also implement the serializable interface. You can avoid this constraint by marking a variable as transient; however, its state won't be persisted and might be lost in the event of an error or system crash.


    Listing 9.2 A Method That Ignores Exceptions

    /**
       * @common:operation
       * @jws:conversation phase="start"
       */
      public int newHand() {
        try {
          playerHand = getCard();
          return playerHand;
        } catch (Exception e) {
          // perhaps log the exception
          // but don't re-throw
        }
     
    }

    SamsThis chapter is from BEA WebLogic Workshop 8.1, by Albert J. Saganich, Jr., et al. (Sams, 2004, ISBN: 0-672-32622-1). Check it out at your favorite bookstore today.

    Buy this book now.

     

    More Graphic Design Articles
    More By Albert J. Saganich, Jr.


     

    GRAPHIC DESIGN ARTICLES

    - Building Corner Effects with Transparent Bac...
    - 3D Graphics Technology: VRML Part I - Introd...
    - Creating Visual Effects
    - Web Page Design Overview
    - Creating Artistic Photographs
    - Working with Tools in Paint Shop Pro 8
    - Using HTML Quickform for Form Processing
    - Introduction to Adobe FrameMaker
    - WebLogic Workshop, WebLogic Platform, and th...
    - Planning the Site
    - Working with Web Services
    - WebLogic Workshop Application Development Ba...
    - Scanning Images for Web Use
    - Web Graphics Overview
    - The Pen is Mightier than the Brush Tool







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