Presentation on theme: "Michael S. Chan xLM Solutions, LLC"— Presentation transcript:
1Michael S. Chan xLM Solutions, LLC Extending ENOVIA SmarTeam with SOA Solutions: Develop Your Own SOA for SmarTeamMichael S. ChanxLM Solutions, LLC
2Your own SOA solutions to extend SmarTeam +other business or engineering services and applications
3Outline What? Why? How? SOA, Service, Contract, Endpoint? Benefits of an SOAHow?Windows Communication Foundation (WCF)A Basic WCF Service ExampleA Simple ServiceAn Even Simpler ClientA SmarTeam SOA Service ExampleAdding Support for SmarTeamDebugging
4What is a Service-Oriented Architecture (SOA)? An architectural concept, style, or paradigmLoosely coupled and distributed services provide the desired functionalitiesNot a technology-driven approachA business-driven approachWhat?
5Services are provided by a Provider (Server) What is a Service?Service 1A self-contained, stateless entity that performs a certain business processServices are provided by a Provider (Server)Services are used by a Consumer (Client)Service 2ClientService 3
6The Four Tenets of a Service Service A(talk to ERP)Boundaries are explicitServices are autonomousServices share the Schema and Contract, not classesService compatibility is based on PolicyA service publishes its contracts so that clients will know how to connect to it: how to consume, or call or invoke, the service, as well as what kind of data are expected as parameters to the service. The contract also tells you what is returned by the service.Service B(talk to PLM)Client XService C(talk to Shipping)
7Contracts Establish explicit boundaries for the service Three types of contracts:Service Contract: exposes Service behavior (methods)Data Contract: exposes persistent dataMessage Contract: exposes custom message structureAll three types of contracts do not need to be all present in a Service
8Why adopt an SOA?A foundation for seamless Enterprise Information Integration (EII)Open standards and messagingA high degree of loose coupling and interoperability across platforms and technologiesFlexibility in software and hardware selectionsIndependent and boundary-explicit servicesAllows for modulo development, deployment and maintenanceIncrease the ROI by developing new services and applications based on existing software and business processesWhy?
9Benefits of Extending SmarTeam with an SOA Developed SmarTeam Services are expendable and reusable for future projectsRemote clients can run on systems with no SmarTeam installationsClients of various levels of complexity may connect and consume the SmarTeam servicesDifferent clients may consume different subsets of the SmarTeam servicesA client may be built asA standalone thin applicationA plug-in for another software package (e.g., Outlook)Part of a web page or site (e.g., a SharePoint web part)No need to develop a completely new SOA each time, just add to the existing SOA by adding Services
10How? Microsoft Windows Communication Foundation (WCF) How to Implement an SOA?MicrosoftWindows Communication Foundation (WCF)A service-oriented programming model and technology for developing distributed applicationsHow?In the Windows platforms, Microsoft has developed the Windows Communication Foundation (WCF) for developing SOA and distributed applications
11System RequirementsMicrosoft Windows Communication Foundation (WCF) in .NET Framework 3.0Supports:Windows XP SP2 (add-on)Windows Server 2003 SP1 (add-on)Windows Server 2003 R2 (add-on)Windows VistaWindows Server 2008Microsoft Visual Studio 2005 (SPx) or 2008May use C#, VB.NET, or otherCLR-Compatible languagesCLR-Common Language Runtime
12Hosting WCF Services Self-hosting in any managed .NET application Hosting in a standalone Windows serviceHosting in IIS ( Web Services)WinXP: IIS 5.1Win2003/R2: IIS 6.0Vista/Win2008: IIS 7.0 (Windows Activation Service)HTTPTCP/IPNamed PipesMSMQ**SmarTeam requirement
15WCF Support in Visual Studio 2005 1) The template generated a project, with a default file class1.cs, and inserted the needed references to support WCF.2) The Key references for proper WCF implementation have been added for you by the template. If you were somehow developing a service w/o using the template, or converting a current application into a WCF service, be sure to include these references.3) Let’s change the file names to something meaningful for our purposes3) Let’s also take a closer look at the Visual Studio 2005 template-generated fileVS2005
16WCF in VS2005 Service Contract Definition (Interface Definition) Service Class Definition(Business Process Logic)Data Contract Definition(Custom Data Class Definition)
17WCF in VS2005 Service Contract Data Contract The Service and Data Contracts are the elements that will be published to the “world”These are the information needed to interface with, or consume, this serviceData Contract
18WCF in VS2005 Service Contract Definition (Interface Definition) Service Class Definition(Business Process Logic)Data Contract Definition(Custom Data Class Definition)
19Setup Hosting on IISOnce again, we use IIS on a Win2003 box b/c of SmarTeam’s requirements.Virtual Path:Physical path: C:\Inetpub\wwwroot\stServices
26Adding a Console Client… Add “app.config” and “BasicService.cs” to client projectAdd System.ServiceModel and System.Runtime.SerializationChange “Program.cs” to “ConsoleClient.cs”Add a reference to System.ServiceModelChange the program file name from Program.cs to ConsoleClient.csAdd two existing items generated by svcutil.exe: app.config and BasicService.csRun svcutil.exe in the client project directory to create “app.config” and “BasicService.cs”
29Development Approach Modify the MySTService.BasicService service Re-run svcutil.exeModify or re-develop the clientDebug the Service and Client
30Obtain two names from each super class: Tasks for this ExampleAdd a method to return a list of Super Classes in the current SmarTeam databaseObtain two names from each super class:Name – internalExternal name – friendlyDevelop a custom data class [DataMember] for the output
33Modify the WCF Service: Add SmarTeam Support Instantiate a SmarTeam engine (FreeThreadedEngine)Create new SmarTeam sessionInitialize session with the engineConnect session to a databaseLog onto sessionModify the WCF Service: Add SmarTeam Support>Perform Business Logic<Log off SmarTeamClose database connectionClose SmarTeam sessionTerminate SmarTeam engine
34Modify the Service Code Modify the Service: add a new method to return a list of the super classesMust clean up before leaving: risk using up all the licenses
40Other WCF Tools SvcConfigEditor.exe SvcTraceViewer.exe Create and modify configuration settings for WCF servicesManage settings for WCF bindings, behaviors, services, and diagnosticsSvcTraceViewer.exeHelps analyze diagnostic traces generated by WCF listeners
41SmarTeam SOA Extension Considerations A Service should be statelessCreate a new SmarTeam session (login,logoff) on each connectionClient provides authentication informationHow to acquire the user name and password?
42Thank You! Questions? Try It Yourself and Have Fun! Script example shown is available at:Michael S. ChanxLM Solutions, LLC.