SlideShare une entreprise Scribd logo
1  sur  49
Distributed Applications,
Web Services, and WCF


  Yaniv Pessach
About the Presenter
  As a key member of Microsoft Web Services design
    team, he was responsible for several of the key
    patents implemented in the .NET WCF
    implementation, and is a named contributor to
    two of the WS-* standards (WS-Discovery and
    WS-Soap-over-UDP)
Introduction

  • Web Services
    − What are they
    − Why/When to use
    − How to design for (SOA)
    − Technologies (legacy)
    − WCF
Take-away
• Web Services enable a new way of building distributed
  applications in a loosely coupled, independent way
• Web Services are based on layers of standards and
  building blocks which are supported by modern tools
• Service Oriented Architecture starts by thinking of the
  interfaces first; useful enterprise patterns exist
• .NET 3.0 introduced Windows Communication Foundation
  which obsoletes previous communication frameworks
• WCF exposes easy access to most WS layers
• WCF is based on a Contract, Binding, and Address
Agenda
• Web Services Concepts
   − Introducing the web services concepts
   − Case study - car dealership – discussion
• Building Web Services
   − Existing building blocks and standards
   − Principles of SOA
   − The car dealership architecture – discussion
• Web Services Technology
   − Legacy Technologies
   − .NET 3.0 / WCF [20] concepts
       • MiniSample [10] The WCF car dealer
Web Services Properties
• Contract defines interaction
• Loosely Coupled, avoid dependencies
• True Platform Independence
• Build, maintain, version, deploy separately
• External, Internal, Intra-application
Message Exchange Patterns
• Synchronous, Asynchronous, Fire & forget
• Uncorrelated/Correlated by transport/Msg
• Request/Response (RPC style) vs. Publish /
  Subscribe vs. One-Way
• Multicast
• Queuing helps logical fire & forget
The Fjord Dealership
• Dealer buys cars, sells cars
• Deals with other dealers (get cars on lot)
• Verify VIN
• Approve Loan
• Accept Credit-cards
• Etc.
Discussion: Identify WS
• In groups, discuss the needed web services
  − External
  − Internal
  − Reliability, performance, data requirements?
Web Services Layers
• Base standards
• Logical Protocol
• Semantic Protocols                  ws-     Orch
                                   transact   estra
                                              tion

                               Ws-policy               WSDL
                     ws-security        ws-discovery


                        XML         SOAP      SOAP ws-addr
                                              OVER
                                              *
Standards
• Transports          • WS-Reliability
• WSDL                • WS-transaction
• WS-Addressing       • WS-Orchestration
• Profiles and WS-I   • UDDI and WS-
• WS-Security           Discovery
WS-Addressing
• How do we identify a service? EPR
• URI or URI + RefProp
• <wsa:EndpointReference …>
  <wsa:Address>http://www.b.com/1</wsa:Address>
  <wsa:ReferenceProperties>
  <blah:CustomerKey>123456789</fblah:CustomerKey>
  </wsa:ReferenceProperties>
  </wsa:EndpointReference>

• MessageID, RelatesTo, Action
[WS-]SOAP Over TCP
• Wire format
• HTTP no longer transport of choice
• Performance
• No transport level security (https)
• Also – Soap Over UDP
• Connection sharing [non-standard]
WS-Security
• HTTPS only provides transport level
  security – consider the intermediary
• Integrity & confidentiality
• Using SOAP header
• Username, X.509, Kerberos, XML Sig
• Performance vs. TLS ?
WS-Discovery vs. UDDI
• Using discovery
  − .NET vs. java ‘locator’ thinking
• UDDI successes and failures
  − Trust, Service Definition
• WS-Discovery
  − limited scope
  − Present and Future
SOA
• Contract
• Encapsulate
• Distinct Service
• Services exchange data, not share behavior
Loose Coupling
• Sacrifices interface optimization
• Achieve flexible interoperability
• .. And ease of change
• .. And does not come naturally
Loose and Tight Coupling
                                      Tightly        Loosely

 Msg Style                            RPC            Doc

 Msg Path                             Hardcode       Route

 Technology                           Homogenous     Heterogeneous

 Binding                              Early, fixed   Late

 Interaction                          Synchronous    Asynchronous

 Model                                Reuse          Broad applicability

 Adaptation                           Recoding       Transformation

 Behavior                             Anticipated    Unexpected


* Adapted from ‘loosely coupled’ by Doug Kaye
SOA Patterns
• Self Service Client
• Service Locator (mostly Javathink)
• Broker, Router Variation, XML firewall
• Serial and Parallel process pattern
• Cached object pattern
• Queue and MessageBus
• Pub/Sub and distributed observer pattern
SOA Patterns - Implementation
• The Message is the Media
• Contract First/Contract Second
• Fowlerisms
  − Service Layer
  − Transform View
  − Remote Façade
  − Data Transfer Object
  − Service Stub [testing]
Architect Fjord WS
• Major Services
• Building Blocks
• Discussion!
Legacy Technologies
• Microsoft
  − RPC
  − DCOM
  − .NET 1.1 Remoting
  − .NET 1.1 WS
• Issues
  − Interoperability
  − Specific limitations
WCF Presented
• Released in .NET 3.0
• Diverse Stack
• Address / Binding / Contract
• Unique Features
  − Existing building blocks
  − Ease of implementation, deployment, maint
  − XML compression, performance
ABC
• Address, Binding, Contract
  − EPR
  − System bindings, parameters, custom, and
    custom channels
  − Interface/class
Topics
• Hosting
• Channels and extensibility
  − Existing channels, transports, reliability,
    security
• Profiles
• Configuration
Code: Contract
[ServiceContract()] public interface ISellCar
{
    [OperationContract] double price(int vin);
    [OperationContract (IsOneWay=true)]
    Void notifyInterest(int vin);
}
Code: Client
• Svcutil.exe http://...?wsdl


using (CarProxy proxy = new CarProxy())
{
    double result = proxy.price(617894332);
}
Code: Server
• Impl: public class CarService: ISellCar {….}
• Hosted: something.svc
<@Service language=c# class=“….CarService“ %>
• SelfHost: using (ServiceHost host = new
  ServiceHost(typeof(CarService), new
  Uri("http://..."))) { host.Open();
  Thread.Sleep(1000000); host.Close(); }
Config: Server [1]
<configuration …. > <system.serviceModel>
  <services> <service
  behaviorConfiguration=“CarServiceBehavior"
  type=…. > <endpoint address=""
  binding="wsHttpBinding"
  bindingConfiguration="Binding1"
  contract=“….ISellCar" /> </service> </services>
Config: Server [2]
<configurationName=“CarServiceBehavior"
  returnUnknownExceptionsAsFaults="True">
  </behavior> </behaviors>
<bindings> <wsHttpBinding> <binding
  configurationName="Binding1" />
  </wsHttpBinding> </bindings>
  </system.serviceModel>
</configuration>
Fjord With WCF
• Construct pseudo/code
• Discussion!
Take-away and Summary
Use Web Services for applications, components
Use Standards (WS-*) and building blocks
Architect using SOA patterns (routers, locators…)
Use .NET 3.0/WCF as communication layer
Define the Contract; configure Binding, and
  Address
Add on transports, reliability, security
More Information

• http://www.yanivpessach.com/soa_read
  more.txt
• Contact me – yaniv@yanivpessach.com
Backup slides
Web Services Defined
• Interoperable machine-to-machine
  interaction
• Using SOAP and XML (some use REST)
• Service and Contract
• Message
• SOA (service oriented architecture)
Sending Out An S.O.A
• The Need for SOA
• Real world problems
• Integration Nightmares
• Increasing Complexity
SOAP Sample
<soap:Envelope
mlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <getProductDetailsxmlns=…>
         <productID>827635</productID>
      </getProductDetails>
   </soap:Body>
</soap:Envelope>
WS Layered Usage
• External
  − E.g. process credit card transaction
• Internal (‘inside the firewall’)
  − EAI e.g. accounting to helpdesk apps
• Intra-application
  − Modular design, flexibility, common blocks
Benefits Revisited
• Built separately
  − different teams, timelines, platforms
  − enable focused teams
  − minimize accidental dependencies
• Deployed separately
  − Performance, troubleshooting, versioning
Web Services Properties
• Contract defines interaction
• Loosely Coupled
Standards – Time is right




* Source: Computer Networks Fourth Edition , Andrew Tanenbaum
Standards – discuss specifics
• Important
• Tool support
• Too many to choose from
WS-Transaction
• Long lived transaction
• Problems of 2-phase commit
• Based on roll-back
• Flexible
WS-Orchestration
• Upper level integration
• Relies on lower levels
• Stabilizing
• Think of it as BizTalk
More WFC building blocks
• Transactions
• Behaviors
  − Lifetime
Code: Channel Programming
encoder = new TextMessageEncodingBindingElement();
transport = new TcpTransportBindingElement();
binding = new CustomBinding(encoder, transport);
IChannelFactory<IRequestChannel> factory =
   binding.BuildChannelFactory<IRequestChannel>(); factory.Open();
address = new EndpointAddress("net.tcp://192.168.0.2:5555/");
IRequestChannel channel = factory.CreateChannel(address); channel.Open();
request = Message.CreateMessage(factory.MessageVersion, "hello");
reply = channel.Request(request);
Console.Out.WriteLine(reply.Headers.Action);
reply.Close(); channel.Close(); factory.Close(); } }
Code: Reliability
BindingElementCollection bindingElements = new BindingElementCollection();
   ReliableSessionBindingElement session = new
   ReliableSessionBindingElement(); session.Ordered = true;
   bindingElements.Add(session); bindingElements.Add(new
   CompositeDuplexBindingElement()); bindingElements.Add(new
   UdpTransportBindingElement()); Binding playerInfoBinding = new
   CustomBinding(bindingElements);
Code: Reliability
BindingElementCollection bindingElements = new BindingElementCollection();
   ReliableSessionBindingElement session = new
   ReliableSessionBindingElement(); session.Ordered = true;
   bindingElements.Add(session); bindingElements.Add(new
   CompositeDuplexBindingElement()); bindingElements.Add(new
   UdpTransportBindingElement()); Binding playerInfoBinding = new
   CustomBinding(bindingElements);
Uri playerInfoAddress = new Uri( "soap.udp://localhost:16000/");
using(ServiceHost service = new ServiceHost(typeof(playerInfoService))) {
   service.AddServiceEndpoint(typeof(IUpdatePlayerInfoContract),
   playerInfoBinding, playerInfoAddress); service.Open();
... // more service code here }
Code: Callback (and duplex)
interface IMyContractCallback { [OperationContract] void OnCallback(); }
[ServiceContract(CallbackContract = typeof(IMyContractCallback))]
interface IMyContract { [OperationContract] void DoSomething(); }
public sealed class InstanceContext : CommunicationObject, ... { public
   InstanceContext(object implementation); ... // More members }
class MyCallback : IMyContractCallback { public void OnCallback() {...} }
   IMyContractCallback callback = new MyCallback(); InstanceContext context =
   new InstanceContext(callback);
IMyContractCallback callback = new MyCallback(); InstanceContext context =
   new InstanceContext(callback); MyContractClient proxy = new
   MyContractClient(context); proxy.DoSomething();

Contenu connexe

Tendances

ASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, Readify
ASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, ReadifyASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, Readify
ASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, Readify
READIFY
 
Web changesandasp4 upload
Web changesandasp4 uploadWeb changesandasp4 upload
Web changesandasp4 upload
READIFY
 
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
Visual Studio 2010 IDE Enhancements - Alex Mackey, ReadifyVisual Studio 2010 IDE Enhancements - Alex Mackey, Readify
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
READIFY
 
Pro Dev Briefing Irvine Wesyppt23
Pro Dev Briefing Irvine Wesyppt23Pro Dev Briefing Irvine Wesyppt23
Pro Dev Briefing Irvine Wesyppt23
Wes Yanaga
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
grandyho
 

Tendances (20)

Hindes_Active_2016Gz2
Hindes_Active_2016Gz2Hindes_Active_2016Gz2
Hindes_Active_2016Gz2
 
ASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, Readify
ASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, ReadifyASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, Readify
ASP.NET 4 & Web Dev in Visual Studio 2010 - Alex Mackey, Readify
 
Web changesandasp4 upload
Web changesandasp4 uploadWeb changesandasp4 upload
Web changesandasp4 upload
 
Azure Services Platform Oc Event Ned
Azure Services Platform Oc Event NedAzure Services Platform Oc Event Ned
Azure Services Platform Oc Event Ned
 
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
Visual Studio 2010 IDE Enhancements - Alex Mackey, ReadifyVisual Studio 2010 IDE Enhancements - Alex Mackey, Readify
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
 
Chapter10 web
Chapter10 webChapter10 web
Chapter10 web
 
Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)
 
WCF
WCFWCF
WCF
 
Manageability of Windows Azure BizTalk Services (WABS)
Manageability of Windows Azure BizTalk Services (WABS)Manageability of Windows Azure BizTalk Services (WABS)
Manageability of Windows Azure BizTalk Services (WABS)
 
Oracle BPEL Presentation
Oracle BPEL PresentationOracle BPEL Presentation
Oracle BPEL Presentation
 
Arquitectura orientada a servicios
Arquitectura orientada a serviciosArquitectura orientada a servicios
Arquitectura orientada a servicios
 
Sharepoint 2010 Geliştirme Araçları
Sharepoint 2010 Geliştirme AraçlarıSharepoint 2010 Geliştirme Araçları
Sharepoint 2010 Geliştirme Araçları
 
Oracle soa/Fusion developer
Oracle soa/Fusion developerOracle soa/Fusion developer
Oracle soa/Fusion developer
 
Design & Implementation Issues in a Contemporary Remote Laboratory Architecture
Design & Implementation Issues in a Contemporary Remote Laboratory ArchitectureDesign & Implementation Issues in a Contemporary Remote Laboratory Architecture
Design & Implementation Issues in a Contemporary Remote Laboratory Architecture
 
Pro Dev Briefing Irvine Wesyppt23
Pro Dev Briefing Irvine Wesyppt23Pro Dev Briefing Irvine Wesyppt23
Pro Dev Briefing Irvine Wesyppt23
 
Hybrid Solutions with the current BizTalk Server 2013 R2 platform
Hybrid Solutions with the current BizTalk Server 2013 R2 platformHybrid Solutions with the current BizTalk Server 2013 R2 platform
Hybrid Solutions with the current BizTalk Server 2013 R2 platform
 
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsIntroducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
 
Web services and SOA
Web services and SOAWeb services and SOA
Web services and SOA
 
WCF LOB SDK at CNUG
WCF LOB SDK at CNUGWCF LOB SDK at CNUG
WCF LOB SDK at CNUG
 

Similaire à SOA and WCF (Windows Communication Foundation) basics

Enterprise Use Case - Selecting an Enterprise Service Bus
Enterprise Use Case - Selecting an Enterprise Service Bus Enterprise Use Case - Selecting an Enterprise Service Bus
Enterprise Use Case - Selecting an Enterprise Service Bus
WSO2
 
Middleware in the cloud platform-v2
Middleware in the cloud   platform-v2Middleware in the cloud   platform-v2
Middleware in the cloud platform-v2
Hammad Rajjoub
 
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
Spiffy
 
ESB Evaluation Framework
ESB Evaluation FrameworkESB Evaluation Framework
ESB Evaluation Framework
WSO2
 
D1-3-Signaling
D1-3-SignalingD1-3-Signaling
D1-3-Signaling
Oleg Levy
 
complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.ppt
Dr.Saranya K.G
 

Similaire à SOA and WCF (Windows Communication Foundation) basics (20)

oracle service bus
oracle service busoracle service bus
oracle service bus
 
SOA - Unit 1 - Introduction to SOA with Web Services
SOA - Unit   1 - Introduction to SOA with Web ServicesSOA - Unit   1 - Introduction to SOA with Web Services
SOA - Unit 1 - Introduction to SOA with Web Services
 
Enterprise Use Case - Selecting an Enterprise Service Bus
Enterprise Use Case - Selecting an Enterprise Service Bus Enterprise Use Case - Selecting an Enterprise Service Bus
Enterprise Use Case - Selecting an Enterprise Service Bus
 
SUE AGILE Architecture (English)
SUE AGILE Architecture (English)SUE AGILE Architecture (English)
SUE AGILE Architecture (English)
 
Middleware in the cloud platform-v2
Middleware in the cloud   platform-v2Middleware in the cloud   platform-v2
Middleware in the cloud platform-v2
 
Achieve business agility with Cloud APIs, Cloud-aware Apps, and Cloud DevOps ...
Achieve business agility with Cloud APIs, Cloud-aware Apps, and Cloud DevOps ...Achieve business agility with Cloud APIs, Cloud-aware Apps, and Cloud DevOps ...
Achieve business agility with Cloud APIs, Cloud-aware Apps, and Cloud DevOps ...
 
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
 
Designing microservices part2
Designing microservices part2Designing microservices part2
Designing microservices part2
 
ESB Evaluation Framework
ESB Evaluation FrameworkESB Evaluation Framework
ESB Evaluation Framework
 
Global Windows Azure Bootcamp - San Diego
Global Windows Azure Bootcamp - San DiegoGlobal Windows Azure Bootcamp - San Diego
Global Windows Azure Bootcamp - San Diego
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and development
 
Hybrid integration platform reference architecture
Hybrid integration platform reference architectureHybrid integration platform reference architecture
Hybrid integration platform reference architecture
 
D1-3-Signaling
D1-3-SignalingD1-3-Signaling
D1-3-Signaling
 
Designing microservices
Designing microservicesDesigning microservices
Designing microservices
 
Azure reference architectures
Azure reference architecturesAzure reference architectures
Azure reference architectures
 
Wcf v1-day1
Wcf v1-day1Wcf v1-day1
Wcf v1-day1
 
complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.ppt
 
Web Services Hacking and Security
Web Services Hacking and SecurityWeb Services Hacking and Security
Web Services Hacking and Security
 
Micro service session 1
Micro service   session 1Micro service   session 1
Micro service session 1
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 

SOA and WCF (Windows Communication Foundation) basics

  • 2. About the Presenter As a key member of Microsoft Web Services design team, he was responsible for several of the key patents implemented in the .NET WCF implementation, and is a named contributor to two of the WS-* standards (WS-Discovery and WS-Soap-over-UDP)
  • 3. Introduction • Web Services − What are they − Why/When to use − How to design for (SOA) − Technologies (legacy) − WCF
  • 4. Take-away • Web Services enable a new way of building distributed applications in a loosely coupled, independent way • Web Services are based on layers of standards and building blocks which are supported by modern tools • Service Oriented Architecture starts by thinking of the interfaces first; useful enterprise patterns exist • .NET 3.0 introduced Windows Communication Foundation which obsoletes previous communication frameworks • WCF exposes easy access to most WS layers • WCF is based on a Contract, Binding, and Address
  • 5. Agenda • Web Services Concepts − Introducing the web services concepts − Case study - car dealership – discussion • Building Web Services − Existing building blocks and standards − Principles of SOA − The car dealership architecture – discussion • Web Services Technology − Legacy Technologies − .NET 3.0 / WCF [20] concepts • MiniSample [10] The WCF car dealer
  • 6. Web Services Properties • Contract defines interaction • Loosely Coupled, avoid dependencies • True Platform Independence • Build, maintain, version, deploy separately • External, Internal, Intra-application
  • 7. Message Exchange Patterns • Synchronous, Asynchronous, Fire & forget • Uncorrelated/Correlated by transport/Msg • Request/Response (RPC style) vs. Publish / Subscribe vs. One-Way • Multicast • Queuing helps logical fire & forget
  • 8. The Fjord Dealership • Dealer buys cars, sells cars • Deals with other dealers (get cars on lot) • Verify VIN • Approve Loan • Accept Credit-cards • Etc.
  • 9. Discussion: Identify WS • In groups, discuss the needed web services − External − Internal − Reliability, performance, data requirements?
  • 10. Web Services Layers • Base standards • Logical Protocol • Semantic Protocols ws- Orch transact estra tion Ws-policy WSDL ws-security ws-discovery XML SOAP SOAP ws-addr OVER *
  • 11. Standards • Transports • WS-Reliability • WSDL • WS-transaction • WS-Addressing • WS-Orchestration • Profiles and WS-I • UDDI and WS- • WS-Security Discovery
  • 12. WS-Addressing • How do we identify a service? EPR • URI or URI + RefProp • <wsa:EndpointReference …> <wsa:Address>http://www.b.com/1</wsa:Address> <wsa:ReferenceProperties> <blah:CustomerKey>123456789</fblah:CustomerKey> </wsa:ReferenceProperties> </wsa:EndpointReference> • MessageID, RelatesTo, Action
  • 13. [WS-]SOAP Over TCP • Wire format • HTTP no longer transport of choice • Performance • No transport level security (https) • Also – Soap Over UDP • Connection sharing [non-standard]
  • 14. WS-Security • HTTPS only provides transport level security – consider the intermediary • Integrity & confidentiality • Using SOAP header • Username, X.509, Kerberos, XML Sig • Performance vs. TLS ?
  • 15. WS-Discovery vs. UDDI • Using discovery − .NET vs. java ‘locator’ thinking • UDDI successes and failures − Trust, Service Definition • WS-Discovery − limited scope − Present and Future
  • 16. SOA • Contract • Encapsulate • Distinct Service • Services exchange data, not share behavior
  • 17. Loose Coupling • Sacrifices interface optimization • Achieve flexible interoperability • .. And ease of change • .. And does not come naturally
  • 18. Loose and Tight Coupling Tightly Loosely Msg Style RPC Doc Msg Path Hardcode Route Technology Homogenous Heterogeneous Binding Early, fixed Late Interaction Synchronous Asynchronous Model Reuse Broad applicability Adaptation Recoding Transformation Behavior Anticipated Unexpected * Adapted from ‘loosely coupled’ by Doug Kaye
  • 19. SOA Patterns • Self Service Client • Service Locator (mostly Javathink) • Broker, Router Variation, XML firewall • Serial and Parallel process pattern • Cached object pattern • Queue and MessageBus • Pub/Sub and distributed observer pattern
  • 20. SOA Patterns - Implementation • The Message is the Media • Contract First/Contract Second • Fowlerisms − Service Layer − Transform View − Remote Façade − Data Transfer Object − Service Stub [testing]
  • 21. Architect Fjord WS • Major Services • Building Blocks • Discussion!
  • 22. Legacy Technologies • Microsoft − RPC − DCOM − .NET 1.1 Remoting − .NET 1.1 WS • Issues − Interoperability − Specific limitations
  • 23. WCF Presented • Released in .NET 3.0 • Diverse Stack • Address / Binding / Contract • Unique Features − Existing building blocks − Ease of implementation, deployment, maint − XML compression, performance
  • 24. ABC • Address, Binding, Contract − EPR − System bindings, parameters, custom, and custom channels − Interface/class
  • 25. Topics • Hosting • Channels and extensibility − Existing channels, transports, reliability, security • Profiles • Configuration
  • 26. Code: Contract [ServiceContract()] public interface ISellCar { [OperationContract] double price(int vin); [OperationContract (IsOneWay=true)] Void notifyInterest(int vin); }
  • 27. Code: Client • Svcutil.exe http://...?wsdl using (CarProxy proxy = new CarProxy()) { double result = proxy.price(617894332); }
  • 28. Code: Server • Impl: public class CarService: ISellCar {….} • Hosted: something.svc <@Service language=c# class=“….CarService“ %> • SelfHost: using (ServiceHost host = new ServiceHost(typeof(CarService), new Uri("http://..."))) { host.Open(); Thread.Sleep(1000000); host.Close(); }
  • 29. Config: Server [1] <configuration …. > <system.serviceModel> <services> <service behaviorConfiguration=“CarServiceBehavior" type=…. > <endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding1" contract=“….ISellCar" /> </service> </services>
  • 30. Config: Server [2] <configurationName=“CarServiceBehavior" returnUnknownExceptionsAsFaults="True"> </behavior> </behaviors> <bindings> <wsHttpBinding> <binding configurationName="Binding1" /> </wsHttpBinding> </bindings> </system.serviceModel> </configuration>
  • 31. Fjord With WCF • Construct pseudo/code • Discussion!
  • 32. Take-away and Summary Use Web Services for applications, components Use Standards (WS-*) and building blocks Architect using SOA patterns (routers, locators…) Use .NET 3.0/WCF as communication layer Define the Contract; configure Binding, and Address Add on transports, reliability, security
  • 33. More Information • http://www.yanivpessach.com/soa_read more.txt • Contact me – yaniv@yanivpessach.com
  • 35. Web Services Defined • Interoperable machine-to-machine interaction • Using SOAP and XML (some use REST) • Service and Contract • Message • SOA (service oriented architecture)
  • 36. Sending Out An S.O.A • The Need for SOA • Real world problems • Integration Nightmares • Increasing Complexity
  • 37. SOAP Sample <soap:Envelope mlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getProductDetailsxmlns=…> <productID>827635</productID> </getProductDetails> </soap:Body> </soap:Envelope>
  • 38. WS Layered Usage • External − E.g. process credit card transaction • Internal (‘inside the firewall’) − EAI e.g. accounting to helpdesk apps • Intra-application − Modular design, flexibility, common blocks
  • 39. Benefits Revisited • Built separately − different teams, timelines, platforms − enable focused teams − minimize accidental dependencies • Deployed separately − Performance, troubleshooting, versioning
  • 40. Web Services Properties • Contract defines interaction • Loosely Coupled
  • 41. Standards – Time is right * Source: Computer Networks Fourth Edition , Andrew Tanenbaum
  • 42. Standards – discuss specifics • Important • Tool support • Too many to choose from
  • 43. WS-Transaction • Long lived transaction • Problems of 2-phase commit • Based on roll-back • Flexible
  • 44. WS-Orchestration • Upper level integration • Relies on lower levels • Stabilizing • Think of it as BizTalk
  • 45. More WFC building blocks • Transactions • Behaviors − Lifetime
  • 46. Code: Channel Programming encoder = new TextMessageEncodingBindingElement(); transport = new TcpTransportBindingElement(); binding = new CustomBinding(encoder, transport); IChannelFactory<IRequestChannel> factory = binding.BuildChannelFactory<IRequestChannel>(); factory.Open(); address = new EndpointAddress("net.tcp://192.168.0.2:5555/"); IRequestChannel channel = factory.CreateChannel(address); channel.Open(); request = Message.CreateMessage(factory.MessageVersion, "hello"); reply = channel.Request(request); Console.Out.WriteLine(reply.Headers.Action); reply.Close(); channel.Close(); factory.Close(); } }
  • 47. Code: Reliability BindingElementCollection bindingElements = new BindingElementCollection(); ReliableSessionBindingElement session = new ReliableSessionBindingElement(); session.Ordered = true; bindingElements.Add(session); bindingElements.Add(new CompositeDuplexBindingElement()); bindingElements.Add(new UdpTransportBindingElement()); Binding playerInfoBinding = new CustomBinding(bindingElements);
  • 48. Code: Reliability BindingElementCollection bindingElements = new BindingElementCollection(); ReliableSessionBindingElement session = new ReliableSessionBindingElement(); session.Ordered = true; bindingElements.Add(session); bindingElements.Add(new CompositeDuplexBindingElement()); bindingElements.Add(new UdpTransportBindingElement()); Binding playerInfoBinding = new CustomBinding(bindingElements); Uri playerInfoAddress = new Uri( "soap.udp://localhost:16000/"); using(ServiceHost service = new ServiceHost(typeof(playerInfoService))) { service.AddServiceEndpoint(typeof(IUpdatePlayerInfoContract), playerInfoBinding, playerInfoAddress); service.Open(); ... // more service code here }
  • 49. Code: Callback (and duplex) interface IMyContractCallback { [OperationContract] void OnCallback(); } [ServiceContract(CallbackContract = typeof(IMyContractCallback))] interface IMyContract { [OperationContract] void DoSomething(); } public sealed class InstanceContext : CommunicationObject, ... { public InstanceContext(object implementation); ... // More members } class MyCallback : IMyContractCallback { public void OnCallback() {...} } IMyContractCallback callback = new MyCallback(); InstanceContext context = new InstanceContext(callback); IMyContractCallback callback = new MyCallback(); InstanceContext context = new InstanceContext(callback); MyContractClient proxy = new MyContractClient(context); proxy.DoSomething();