开发者

WCF Operation parameter string vs .Net Type (Best Practice)

开发者 https://www.devze.com 2023-03-29 16:35 出处:网络
I\'m developing a web services to be consumed by java and php clients. When we write an operation that accepts Order Object, is it ok to do the below?

I'm developing a web services to be consumed by java and php clients.

When we write an operation that accepts Order Object, is it ok to do the below?

void getOrderDetail (Order order)

OR

void getOrderDetail(String order)

//Where order i开发者_开发技巧s a xml

Basically, what i'm after is:

  1. What is the best practice to achieve above?
  2. Should it problem with clients if my operation accepts Order Type?

Thank you . Thanks.


I'd go with #1. Self-describing operations are always a win- "string" doesn't give a smarter client (ie, one that can generate wire-type stubs like WCF, Axis, etc) any hints about what to do. If you use strong types on the wire, the resultant WSDL acts as a first level of documentation that can also be consumed by a client generator.

0

精彩评论

暂无评论...
验证码 换一张
取 消