470,815 Members | 1,231 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Some basic questions

Hi all, I have some basic WebService questions

#1
Let's say I have a business class named "Customer". The customer would be
able to log in and update their personal information like so

void UpdateCustomerInformation(Customer customer)

changing information such as their telephone number etc. Now the customer
class would have information in it such as "Decimal CreditLimit". This
should not be modifyable by the customer but only by a sales manager.
Should I ignore this setting if the current user is not a SalesManager, or
should I have two different methods that accept two different types of
parameter?
#2
On a similar subject to #1, what if a customer can see all of their own
information (CreditLimit for example) but only look up a subset of
information about other customers? Instead of returning concrete types like
Customer would it be a good or bad idea for my WebMethods to pass
pre-defined XML back and forth? For example

void UpdateCustomer(string customerXml)
string GetCustomerInformation(Guid customerId)
I appreciate any help/comments
Pete
Apr 10 '06 #1
4 1135
"Peter Morris [Droopy eyes software]" <pete@droopyeyes[dot]comREMOVETHIS>
wrote in message news:Or**************@TK2MSFTNGP03.phx.gbl...
Hi all, I have some basic WebService questions

#1
Let's say I have a business class named "Customer". The customer would be
able to log in and update their personal information like so

void UpdateCustomerInformation(Customer customer)

changing information such as their telephone number etc. Now the customer
class would have information in it such as "Decimal CreditLimit". This
should not be modifyable by the customer but only by a sales manager.
Should I ignore this setting if the current user is not a SalesManager, or
should I have two different methods that accept two different types of
parameter?
#2
Instead of returning concrete types like Customer would it be a good or
bad idea for my WebMethods to pass pre-defined XML back and forth?


Hi Pete,

For the first choice I would go with one method that does the work depending
on the given permissions. However it is pretty relative and your mileage may
vary.
For the second option I would definitely go for returning specific types
instead of predefined xml. In fact the custom types also produce predefined
xml, but you use strong type objects in your code and the built in
serialization in .NET framework.

Regards,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MVP, MCT, MCSD.NET Early Achiever
Apr 10 '06 #2
Hi Martin
For the first choice I would go with one method that does the work
depending on the given permissions. However it is pretty relative and your
mileage may vary.
Okay....

For the second option I would definitely go for returning specific types
instead of predefined xml. In fact the custom types also produce
predefined xml, but you use strong type objects in your code and the built
in serialization in .NET framework.


I once had a system where

A) A customer can view all of their own information
B) An account manager for that customer can only see some of that
information
C) Any other account manager can see less than B
D) Anonymous users can see less than C

This also applied to employees of the customer, members of the employees'
families, etc. The reason I was reluctant to go down this route was that I
would end up with 4 classes per business class.

Are there any big disadvantages to the XML approach? I was thinking that it
would be easy to convert to HTML for a start.
Thanks very much for your input!
Pete
Apr 11 '06 #3
"Peter Morris [Droopy eyes software]" <pete@droopyeyes[dot]comREMOVETHIS>
wrote in message news:ei**************@TK2MSFTNGP04.phx.gbl...
I once had a system where

A) A customer can view all of their own information
B) An account manager for that customer can only see some of that
information
C) Any other account manager can see less than B
D) Anonymous users can see less than C

This also applied to employees of the customer, members of the employees'
families, etc. The reason I was reluctant to go down this route was that
I would end up with 4 classes per business class.

Are there any big disadvantages to the XML approach? I was thinking that
it would be easy to convert to HTML for a start.


The most major disadvantage that I see is that you are not going to use
strong typed infoset and this could lead to hard to diagnose runtime errors.
Using four different business classes will only lead to more maintenance
work, but on the wire data will be send also in XML.
However if you have too many business classes this maintenance work could be
a lot, so may be you can check each property access for required
permissions.
Still using raw XML is an option. Just make sure to build appropriate
diagnose tools so you can locate problems in advance.

Regards,
Martin

Apr 11 '06 #4
> The most major disadvantage that I see is that you are not going to use
strong typed infoset and this could lead to hard to diagnose runtime
errors. Using four different business classes will only lead to more
maintenance work, but on the wire data will be send also in XML.
However if you have too many business classes this maintenance work could
be a lot, so may be you can check each property access for required
permissions.
Still using raw XML is an option. Just make sure to build appropriate
diagnose tools so you can locate problems in advance.


I was thinking of including a data version in each XML response, I think
that should be enough don't you?
Apr 13 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steven O. | last post: by
12 posts views Thread by Vibhajha | last post: by
193 posts views Thread by Michael B. | last post: by
1 post views Thread by danilo of TUP | last post: by
3 posts views Thread by aziz001DETESTSPAM | last post: by
2 posts views Thread by Water Cooler v2 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.