Search the web
Sign In
New User? Sign Up
domaindrivendesign · Domain-Driven Design
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
DTO or serialized domain object entities   Message List  
Reply | Forward Message #7286 of 15978 |

Hi to all,

 

I am implementing a web service.

 

What is the best way to get data in an out of the service?

 

1) Using Data Transfer Object DTO?

2) Serialized the domain objects  and  sending them as web methods return values.

 

For example, I am implementing an OrderReceivingService,

should I implement an OrderDTO to get data in and out of the service ? or simply serialize and return  the Order entity of the business domain ? my Order entity has both state and behaviour. my OrderDTO has only state. I am also using ORM for data persistence.

 

Please provide reasons why a particular approach is better in my case. I will also like to know the advantages and disadvantage of both approaches as far as web services are concerned.

 

Are there any posible trick that we can use to avoid DTOs in web service without comprimising our domain model?

 

Best Regards,

Leonard.

 

 

 



Sent from Yahoo! Mail.
A Smarter Email.

Mon Apr 21, 2008 3:51 am

tchuta
Offline Offline
Send Email Send Email

Forward
Message #7286 of 15978 |
Expand Messages Author Sort by Date

Hi to all, I am implementing a web service. What is the best way to get data in an out of the service? 1) Using Data Transfer Object DTO? 2) Serialized the...
Tchuta leonard
tchuta
Offline Send Email
Apr 21, 2008
3:51 am

For web services, especially those you want to publish for 3rd party usage, I would recommend using DTOs. If you publish your domain model as the service...
Chris Gardner
chris_gardner76
Offline Send Email
Apr 21, 2008
12:20 pm

DTOs make sense when we're in a distributed environment, it's not meant to be a shield for the Domain Model (http://martinfowler.com/bliki/LocalDTO.html), its...
Leonardo F. Gomes
leofg
Offline Send Email
Apr 21, 2008
5:56 pm

I believe the decision rests on whether your consumers are local or not, where local means undistributed and sharing dependencies. Since a web service implies...
komptaur
Offline Send Email
Apr 21, 2008
1:24 pm

Hi Chris, Thanks for your input. I do agree with you that binding my business domain objects directly to the service interface will turn it from a dynamic...
Tchuta leonard
tchuta
Offline Send Email
Apr 21, 2008
1:28 pm

... IMHO, a true Web service should only publish a WSDL file. Whoever consumes the Web service takes the WSDL and generates their own version of the data types...
Jing Xue
manifoldronin
Offline Send Email
Apr 25, 2008
5:55 am

Hi Jing Xue, The WSDL is an XML definition of your service interface, this means that it is generate from your service interface at deployment time. In this...
Tchuta leonard
tchuta
Offline Send Email
Apr 25, 2008
9:09 am

Actually, i believe that this is an anti-pattern. I prefer 'contract-first' approach if I have to go down the SOAP route. But I also believe that REST is a...
Zdeslav Vojkovic
zdeslav_v
Offline Send Email
Apr 25, 2008
9:30 am

Hi Zdeslav, Please define contract approach (I will appreciate if you do  give some examples) 1) why do you prefere the "contract-first" approach? does this...
Tchuta leonard
tchuta
Offline Send Email
Apr 25, 2008
9:38 am

hi, 1) here are some explanations which express it better than i could: http://static.springframework.org/spring-ws/site/reference/html/why-contract-first.html...
Zdeslav Vojkovic
zdeslav_v
Offline Send Email
Apr 25, 2008
10:08 am

Hi Zdeslav, I usually model my service interface in UML ( message type, operations). This is in effect some kind of contract, though express in UML other than...
Tchuta leonard
tchuta
Offline Send Email
Apr 25, 2008
8:41 pm

Actually, I start from XSD schemas then build the WSDL from it. There are numerous tools which can generate classes from schemas (like xsd.exe which is...
Zdeslav Vojkovic
zdeslav_v
Offline Send Email
Apr 26, 2008
4:16 pm

+1 on the use of WSCF by the thinktecture guys I used this tool alot of the last couple of years and find the cotnract first a pporach very useful when...
Ollie Riches
ollie5194
Offline Send Email
Apr 28, 2008
3:30 pm

I think that part of the problem permeating the conversation is that we’re looking at the DTO’s as entities. If you’re building a task-centered system as...
Udi Dahan
udidahan7
Offline Send Email
Apr 26, 2008
11:40 am

As matter of collecting different oppinions. I like the DTOs but dislike writing Assemblers to convert the DTOs to domain objects. How do you handle...
Tchuta leonard
tchuta
Offline Send Email
Apr 26, 2008
12:04 pm

I am not really a fan of solutions based on domain object - DTO transformation, I think that Udi has a point here, but if you need to go that way you can use...
Zdeslav Vojkovic
zdeslav_v
Offline Send Email
Apr 26, 2008
4:26 pm

Is it that painful to write adapters? Do I really need an object to object mapper? So long as your messaging boundaries have not done something crazy like...
Greg Young
gumboismadeo...
Offline Send Email
Apr 26, 2008
7:59 pm

... Actually, no, on both counts :) However, i find that it saves time, reduces the amount of code that i have to write, and it was fun to write such a tool :)...
Zdeslav Vojkovic
zdeslav_v
Offline Send Email
Apr 28, 2008
10:07 am

Hi Zdeslav, I do not see how one can implement clean domain with separation of concerns following the the "contract first" approach without using DTOs. When...
Tchuta leonard
tchuta
Offline Send Email
Apr 26, 2008
5:03 pm

hi Leonard, I'm sorry if I wasn't quite clear before, this usually happens when i write in a hurry. When I say DTO, i mean it as a flattened representation of...
Zdeslav Vojkovic
zdeslav_v
Offline Send Email
Apr 28, 2008
9:58 am

This ? comes up often, and my response got a little winded, so I turned it into a post here: ...
Jarod Ferguson
jarodferguson
Offline Send Email
Apr 28, 2008
5:54 pm

I think you have to write DTO's for any sort of long term Enterprise 'system of systems' solution. I fought this for some time, but since moving to an...
Jarod Ferguson
jarodferguson
Offline Send Email
Apr 28, 2008
5:55 pm

Good Explaination. Thanks ... From: Jarod Ferguson <jarod_ferguson@...> To: domaindrivendesign@yahoogroups.com Sent: Monday, 28 April, 2008 12:50:42 AM...
Tchuta leonard
tchuta
Offline Send Email
Apr 28, 2008
5:59 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help