{"id":387,"date":"2015-01-27T11:15:16","date_gmt":"2015-01-27T11:15:16","guid":{"rendered":"http:\/\/adriangrigoras.com\/blog\/?p=387"},"modified":"2015-01-27T11:15:16","modified_gmt":"2015-01-27T11:15:16","slug":"service-architecture","status":"publish","type":"post","link":"https:\/\/adriangrigoras.com\/blog\/service-architecture\/","title":{"rendered":"Service architecture"},"content":{"rendered":"<h3>Design Considerations<\/h3>\n<ul>\n<li>The service exposes coarse-grained operations.<\/li>\n<li>Entities used by the service are extensible and composed from standard elements.<\/li>\n<li>Your design does not assume to know who the client is.<\/li>\n<li>Your design assumes the possibility of invalid requests.<\/li>\n<li>Your design separates functional business concerns from infrastructure operational concerns.<\/li>\n<\/ul>\n<h3>SOA Services<\/h3>\n<ul>\n<li>The services are application-scoped and not component-scoped.<\/li>\n<li>The service interfaces are decoupled from the implementations.<\/li>\n<li>The services have explicit boundaries.<\/li>\n<li>The services are autonomous.<\/li>\n<li>Service compatibility is based on policy.<\/li>\n<\/ul>\n<h3>Data Services<\/h3>\n<ul>\n<li>The service does not directly expose individual tables in a database.<\/li>\n<li>The service does not implement business rules.<\/li>\n<\/ul>\n<h3>Workflow Services<\/h3>\n<ul>\n<li>The service uses interfaces supported by your workflow engine.<\/li>\n<li>The service is dedicated to supporting workflow.<\/li>\n<\/ul>\n<h3>Authentication<\/h3>\n<ul>\n<li>The service uses a suitable mechanism to securely authenticate users.<\/li>\n<li>You have considered the implications of using different trust settings for executing service code.<\/li>\n<li>Secure protocols such as SSL are used with basic authentication, or when credentials are passed as plain text.<\/li>\n<li>Secure mechanisms such as WS Security are used for SOAP messages.<\/li>\n<\/ul>\n<h3>Authorization<\/h3>\n<ul>\n<li>Appropriate access permissions for users, groups, and roles are set on resources.<\/li>\n<li>URL authorization and\/or file authorization are used when necessary.<\/li>\n<li>Access to publicly-accessible service methods uses declarative principle permission demands where this is appropriate.<\/li>\n<li>Services execute under the most restrictive account that is appropriate.<\/li>\n<\/ul>\n<h3>Communication<\/h3>\n<ul>\n<li>You have determined how to handle unreliable or intermittent communication scenarios.<\/li>\n<li>Dynamic URL behavior is used to configure endpoints for maximum flexibility.<\/li>\n<li>Endpoint addresses in messages are validated.<\/li>\n<li>You have determined the approach for handling asynchronous calls.<\/li>\n<li>You have decided if the message communication must be one-way or two-way.<\/li>\n<\/ul>\n<h3>Data Consistency<\/h3>\n<ul>\n<li>All parameters passed to the service components are validated.<\/li>\n<li>All input is validated for malicious content.<\/li>\n<li>Appropriate signing, encryption and encoding strategies are used for protecting your message.<\/li>\n<li>XML schema is used to validate incoming SOAP messages.<\/li>\n<\/ul>\n<h3>Exception Management<\/h3>\n<ul>\n<li>Exceptions are not used to control business logic.<\/li>\n<li>Sensitive information in exception messages and log files is not revealed to users.<\/li>\n<li>Unhandled exceptions are dealt with appropriately.<\/li>\n<li>You have designed an appropriate logging and notification strategy for critical errors and exceptions.<\/li>\n<li>Tracing and debug-mode compilation are disabled for all services except during development and testing.<\/li>\n<\/ul>\n<h3>Message Construction<\/h3>\n<ul>\n<li>Appropriate patterns, such as Command, Document, Event, and Request-Reply are used for message constructions.<\/li>\n<li>Very large quantities of data are divided into relatively smaller chunks and sent in sequence.<\/li>\n<li>Expiration information is included in messages that are time-sensitive, and the service ignores expired messages.<\/li>\n<\/ul>\n<h3>Message Endpoint<\/h3>\n<ul>\n<li>Appropriate patterns such as Gateway, Mapper, Competing Consumers, and Message Dispatcher are used for message endpoints.<\/li>\n<li>You have determined if you should accept all messages, or implement a filter to handle specific messages.<\/li>\n<li>Your interface is designed for idempotency so that, if it receives duplicate messages from the same consumer, it will handle only one.<\/li>\n<li>Your interface is designed for commutativity so that, if messages arrive out of order, they will be stored and then processed in the correct order.<\/li>\n<li>Your interface is designed for disconnected scenarios, such as support for guaranteed delivery.<\/li>\n<\/ul>\n<h3>Message Protection<\/h3>\n<ul>\n<li>The service is using transport layer security when interaction between the service and consumer are not routed through intermediary servers.<\/li>\n<li>The service is using message-based protection when interaction between the service and consumer are routed through other servers.<\/li>\n<li>You have considered message-based plus transport layer (mixed) security when you need additional security.<\/li>\n<li>Encryption is used to protect sensitive data in messages.<\/li>\n<li>Digital signatures are used to protect messages and parameters from tampering.<\/li>\n<\/ul>\n<h3>Message Transformation<\/h3>\n<ul>\n<li>Appropriate patterns such as Canonical Data Mapper, Envelope Wrapper, and Normalizer are used for message transformation.<\/li>\n<li>Metadata is used to define the message format.<\/li>\n<li>An external repository is used to store the metadata when appropriate.<\/li>\n<\/ul>\n<h3>Message Exchange Patterns<\/h3>\n<ul>\n<li>You have chosen patterns that match your requirements without adding unnecessary complexity.<\/li>\n<li>If you are using business process modeling techniques, your exchange patterns are not based on process steps, but instead support operations that combine process steps.<\/li>\n<li>The service uses existing standards for message exchange patterns in order to provide a standards-based interface that can be understood by many consumers.<\/li>\n<\/ul>\n<h3>Representational State Transfer (REST)<\/h3>\n<ul>\n<li>You have used state diagrams to model and define resources that will be available to clients.<\/li>\n<li>You have chosen an approach for resource identification that uses meaningful names for REST starting points and unique identifiers, such as a GUID, for specific resource instances.<\/li>\n<li>POST operations are used only when necessary.<\/li>\n<li>HTTP application protocol is used for common Web infrastructure like caching, ETags, authentication, and common data representation types.<\/li>\n<li>You have designed the GET requests such that they return the same result when called.<\/li>\n<li>You have designed your PUT and DELETE requests to be idempotent.<\/li>\n<\/ul>\n<h3>SOAP<\/h3>\n<ul>\n<li>SOAP faults are used for returning errors instead of relying on default error-handling.<\/li>\n<li>SOAP header block\u2019s <b>mustUnderstand<\/b> attribute is set to \u201ctrue\u201d or \u201c1\u201d, of you want to force processing of the header block.<\/li>\n<li>WS-* standards are used when possible.<\/li>\n<\/ul>\n<h3>Validation<\/h3>\n<ul>\n<li>All data received by the service interface is validated.<\/li>\n<li>You have considered how the data will be used, such as whether data used in database queries will leave the database vulnerable to SQL injection attacks.<\/li>\n<li>All trust boundaries are identified, and data that crosses these boundaries is validated.<\/li>\n<li>You have determined whether validation that occurs in other layers is sufficient, or if you must validate it again.<\/li>\n<li>The service returns informative error messages if validation fails.<\/li>\n<\/ul>\n<h3>Service Layer Considerations<\/h3>\n<ul>\n<li>Business rules are not implemented in the services layer.<\/li>\n<li>Access to the service layer is defined by policies that allow consumers to determine the connection and security requirements, and other details related to interacting with the service.<\/li>\n<li>Separate assemblies are used for major components in the service layer, such as the interface, implementation, data contracts, service contracts, fault contracts, and translators.<\/li>\n<li>The service layer does not have or require knowledge of business entities used by the business layer.<\/li>\n<\/ul>\n<h3>Business Layer Considerations<\/h3>\n<ul>\n<li>Components in the business layer have no knowledge of the service layer, have no dependencies on code in the service layer, and do not execute code in the service layer.<\/li>\n<li>A fa\u00e7ade is used in the business layer to accept coarse-grained operations and break them down into multiple business operations.<\/li>\n<li>The business layer is stateless in order to maximize the number of concurrent requests that the service can handle.<\/li>\n<\/ul>\n<h3>Data Layer Considerations<\/h3>\n<ul>\n<li>The data layer is deployed to the same physical tier as the business layer to reduce serialization requirements for objects that move across physical boundaries.<\/li>\n<li>Access to the data layer does not use impersonation or delegation, instead it uses a common entity to access the data access layer while providing user identity information so that log and audit processes can associate users with the actions they perform.<\/li>\n<li>Abstraction is employed in the design of the data access layer interface, probably by using the Data Access or Table Data Gateway pattern.<\/li>\n<li>For simple CRUD operations, you have considered using a class for each table or view in the database, which represents the Table Module pattern.<\/li>\n<\/ul>\n<h3>Performance Considerations<\/h3>\n<ul>\n<li>Service contract operations are as coarse-grained as possible.<\/li>\n<li>Business logic is not mixed with translator logic, and the service implementation is responsible only for translating data from one format to another.<\/li>\n<\/ul>\n<h3>Security Considerations<\/h3>\n<ul>\n<li>Used message-based security when requests are routed through other services.<\/li>\n<li>Used transport layer security when requests are sent directly to the service.<\/li>\n<li>You have considered using a combination of transport layer and message based security.<\/li>\n<li>You have considered using message-based brokered authentication with X.509 certificates when designing Extranet or business-to-business (B2B) services.<\/li>\n<\/ul>\n<h3>Deployment Considerations<\/h3>\n<ul>\n<li>The service layer is deployed to the same tier as the business layer in order to maximize service performance.<\/li>\n<li>You are using Named Pipes or Shared Memory protocols when a service is located on the same physical tier as the service consumer.<\/li>\n<li>You are using the TCP protocol when a service is accessed only by other applications within a local network.<\/li>\n<li>You are using the HTTP protocol when a service is publicly accessible from the Internet.<\/li>\n<\/ul>\n<p>Source: apparch.codeplex.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Design Considerations The service exposes coarse-grained operations. Entities used by the service are extensible and composed from standard elements. Your design does not assume to know who the client is. Your design assumes the possibility of invalid requests. Your design separates functional business concerns from infrastructure operational concerns. SOA Services The services are application-scoped and\u2026 <span class=\"read-more\"><a href=\"https:\/\/adriangrigoras.com\/blog\/service-architecture\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-387","post","type-post","status-publish","format-standard","hentry","category-architecture"],"_links":{"self":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/comments?post=387"}],"version-history":[{"count":1,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/387\/revisions"}],"predecessor-version":[{"id":388,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/387\/revisions\/388"}],"wp:attachment":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/media?parent=387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/categories?post=387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/tags?post=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}