200 likes | 375 Views
Contemporary SOA, Part I. 605.702 Service Oriented Architecture Johns-Hopkins University Montgomery County Center, Spring 2009 Session 3: February 11, 2009 Instructor: T. Pole. Session #3 Agenda. Catching up from Last Week Chap. 5 review Required Reading for This Week Chap 6:
E N D
Contemporary SOA, Part I 605.702 Service Oriented ArchitectureJohns-Hopkins University Montgomery County Center, Spring 2009 Session 3: February 11, 2009 Instructor: T. Pole
Session #3 Agenda • Catching up from Last Week • Chap. 5 review • Required Reading for This Week • Chap 6: • Web Services • Contemporary SOA Part I: Activity Management and Composition • Today’s Presentation • Today’s Lecture • Assignments • Review Ex 1: Simple Web Service Client • Assign Ex 2: Simple Web Service
Chapter 5 - Review • Primitive SOA (simplistic definition) • SOAP, WSDL, UDDI • Roles { Service Provider, Requestor, Intermediator} • Initial Sender and Utimate Receiver • Models • Business Service Model, Utility Service Model, Controller Service Model • Abstract Description (Functional purpose) and Concrete Description (Technical binding)
Section 5.4 Messaging Revisited • Messages • Header Block • Message Styles (page 146) • RPC style • Document style • Attachments • Message Paths • Static • Dynamic
Lecture from Text • Chapter 6: Contemporary SOA Part I • 6.1 Message Exchange Patterns • 6.2 Service Activity • 6.3 Coordination • 6.4 Atomic Transactions • 6.5 Business Activities
6.1 Message Exchange Patterns (MEP’s) • How services can share and cooperate in processing messages • Primitive MEP’s • Request response • Fire and forget • Single destination, multi-cast or broadcast • Complex MEP’s • Based on Primitive MEP’s • Example: Publish and subscribe • WSDL & MEP’s: • Request-response, solicit-response, one-way, notification
6.2 Service Activity • Interaction of group of services to complete a task • Sort of a MEP plus the pattern of messages exchanged to perform a specific task • One MEP can perform multiple tasks • Primitive activity ~= Simple MEP • Complex Activity~= Multiple MEP’s or a large complex MEP
6.3 Coordination • Coordination establishes a framework for complex activities to be managed and distributed to activity participants • Can be extended to the concepts of choreography and orchestration • Usually requires context state (infomration about the state of the complex activity) to be retained
6.4 Atomic Transaction • WAKE UP – this section is complicated, boring and important • ACID • Atomic - All or nothing, you can’t do part of a transaction • Consistent – system data models must remain so • Isolated – transactions can’t interfere with each other • Durable – Changes made by a transaction can survive subsequent system failures
6.5 Business Activities • Long running, complex service activities • Do not offer rollback capabilities • Not ACID-type transaction functionality • 6.5.2 Business Activity States • Active state • Completed state • Cancelled state
6.6 Orchestration and 6.7 Choreography • 6.6.4 Sequences, flows and links • 6.6.7 Orchestration and SOA • Case Study pp206-207 • 6.7.1 Collaboration • 6.7.4 Interaction and work units • 6.7.5 Reusability, composability and modularity • 6.7.7 Choreography and SOA
Review Exercise #1 • Consume web service • Command line C# application • Building C# application • Basic debugging
Exercise #2 Assigned: First Web Service • Building a ASP.Net Web Service • Will run locally on your work station • Building a client to your new web service • Executing your web service and its client • Optionally, developing a GUI client
Build an ASP.Net Web Service: 1 of 2 • Start VS 2008 • File -> New -> Web Site • Choose ASP .Net Web Service template • Type in a new path for the web service on your local machine • Location: HTTP • http://localhost/[whatever name you like] • Language: Select C# • Click OK • Solution Explorer tab (left side of screen)
Build an ASP.Net Web Service: 2 of 2 • Select in explorer window: • http://localhost/[name of you project]/AppCode/ • App Code • Service.cs • Locate the web service that implements HelloWorld() • Change the text output string to something interesting • Select from menu: Build -> Rebuild Solution • At bottom of screen notice the build log entries • Should see: === Build: 1 succeeded …. • Run in debug mode: Menu: Debug -> Start Debugging • Modily the web.config file to enable debugging • Select this options and click OK • Web browser will open, click on HelloWorld link • Click on Invoke button, Debug->Stop Debugging
Build a Client to your new Web Service I • Another new project: File -> New -> Project -> C# Projects folder -> Console Application • Pick a good project name • Solution: select “Add to solution” • OK • Explorer windows, left of screen, • Select Client_name\References with mouse right: add service reference • Upper Right of “Add Service Reference” dialog box, click “Discover” • Your new service will appear in the list, select it. • In the textbox Namespace, enter the name you’ll use to reference the server from your client, Click OK • In code, reference create a variable, with the reference name of your service.”ServiceSOAPClient”
namespace Client02 • { • public partial class Form1 : Form • { • public Form1() • { • InitializeComponent(); • } • private void GoLocalBtn_Click(object sender, EventArgs e) • { • NewName.ServiceSoapClient Service = new Client02.NewName.ServiceSoapClient(); • string Response = Service.HelloWorld(); • } • } • }
Build a Client to your web service II • Use the same steps as you did in exercise #1 to implement a proxy object for the web service and invoke its operation • Menu: Build -> Rebuild Solution • Menu: Debug -> Start Debugging • Click right on Web Service project, select “Set as startup project” • Menu: Debug->Start Debugging • Click right on client project, select Debug->Start New Instance • Directory Browsing in IIS must be enabled for debugging • Control Panel->Administrative Tools->Internet Information Services – right click “default Web Site”, properties, “Home Directory” tab, check “Directory Browsing” checkbox
Exercise #2:Requirements: Your First .Net SOAP Based Web Service • Create a Web Site with a Web Service using C# and VS 2005 • The Web Site will be names WS_01_[your two initials][number 1..9] • Your initials, first and last name • Number 1 through 9 in case you share the same initials with another student in class • The operation will be named My_creators_name_is • It will return a string with your name in it. • Create a desktop C# client to invoke the web service, and display its results • Submit the complete folder contents that contain your projects • Select the Solution (top item) in solution explorer • Go to menu: Project -> Properties • Will display the location of all your (two) projects files location. • Copy them to a common root folder if they don’t already have one, and sip the folder, email it to me: prof@Hisdomain.net
GUI Creation TipsOptional GUI Interface • Use the property window • Use the Button, Label, and TextBox UI widgets • Name property, names the variable that lets you access UI widgets from code • Multiline, true or false says whether multiple lines of wrapping text can be used in TextBox • Text property, is value in the TextBox • Double click the button to create and edit event handler for that button • Converting string to integer • int System.Convert.ToInt16( string );