Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Object Design - OOP vs SOA

What is the proper way to handle polymorphic business objects in a WCF/SOAP world?

It seems to me that SOA and OOP are at odds with each other - to expose a clean WSDL you need concrete objects, typically not even utilizing inheritance. On the other hand, presumably in the underlying system, you'll want to follow proper OO design.

What do people typically do here? Build a set of WCF contract objects, forgoing OOP principles, then convert to and from another set of objects in the actual logic layers?

like image 478
mdryden Avatar asked Jan 07 '10 19:01

mdryden


People also ask

Is WCF a SOA?

So, in conclusion, SOA is nothing but an architectural style where two non-compatible applications can communicate using a common language and WCF is nothing but one example of the Service Oriented Architecture (SOA).

What are the 3 types of architecture in SOA?

There are three roles in each of the Service-Oriented Architecture building blocks: service provider; service broker, service registry, service repository; and service requester/consumer.

What is SOA architecture in C#?

A Service-Oriented Architecture(SOA) is a loosely-coupled, reusable software component, which encapsulates different functionalities which are distributed and programmatically accessed. It emerged in the 2000s. It is Message-oriented architecture based on XML.

Which of the following utilities is not a part of application service layer?

Explanation: None. 6. Which of the following utilities is not a part of Application Service Layer ? Explanation: It is a part of Business service layer.


2 Answers

What do people typically do here? Build a set of WCF contract objects, forgoing OOP principles, then convert to and from another set of objects in the actual logic layers?

Yes.

The way WCF serializes things ends up putting a lot of limitations on what you can and can't do with the contract objects. What you can't do ends up being "most anything useful".

I've found it makes things much clearer if you think of the WCF-contract objects as just a data transfer mechanism. Basically like strongly/statically typed XML.
Instead of converting your business object to an XML string (and back again), you convert your business object to a WCF-contract object (and back again), but it's otherwise similar

like image 126
Orion Edwards Avatar answered Oct 14 '22 13:10

Orion Edwards


After reading the Thomas Erl library, I came to the following conclusion:

Think of the WCF Contracts/SOAP Message as simply a message that the Services use to communicate (don't tightly tie that to Objects in your code).

You can then use OOP to design a code-base that gracefully handles those messages using common OOP techniques.

like image 38
Justin Niessner Avatar answered Oct 14 '22 12:10

Justin Niessner