|
-
Apr 17th, 2006, 07:01 AM
#9
Re: [RESOLVED] Problems when returning objects from webservice
Sorry for the delay, I have been very busy contemplating important philosophical issues such as "What's that gray thing on my toenail?"
 Originally Posted by MrNorth
Does this mean that I will be working with classes on the client (asp.net) side of the webservice facade? If that is the case, how do you recommend these businessobjects to be realized? As custom classes or typed datasets?
Now, I am not forcing this architecture on you, I am suggesting it because I have worked on something quite similar to what you're working on, and I determined that this was the best way to go about it. The reason, let me reiterate, was to allow for separation of front end from back end. The entity-relationship model will let me do that because the front-end client will have to follow a set of rules when working with whatever data my web service provides.
For instance, instead of having my web service return an exception due to bad data being inputted, I would rather my business layer returned that exception, rather than the web service which is only facilitating my transactions.
To answer your question, yes, custom classes. Regular old classes with properties and methods and collections.
So if I understand it correctly, you want the clients to have a full library of businessobjects, and these objects invoke webservice methods?
For example: A supplier want to create an invoice!
He goes to invoice.aspx, fill in a form, when he clicks "invoice" an invoice business object is created, populated with data and then the .Invoice() method is invoked on the invoice object which calls a
webservice "invoiceService.asmx" that has a method called DoInvoicing(byval inv as Invoice)
Is this correct?
Yes. Quite right. In fact, the argument (byval Inv as Invoice) wouldn't be necessary since a single Invoice class represents a single Invoice object. If you see a circumstance in which you have many invoices or lineitems being updated together, you can use an Invoices class, which has a collection of Invoice objects, and its own methods which can update/validate/whatever individual invoices if you like.
if yes, then how to handle fetching of data from database to client. Say I want to populate a datagrid with all the orders for a specific supplier. I have a supplierService.asmx that has a method GetOrdersBySupplier(byval supplNo as string) as dataset
When I move to the page OrderLines.aspx I create a new orderLineCollection object, invoke its Load() method which calls the webservice. Then in return I get a dataset which the orderlinecollection uses to populate itself, then it disposes the dataset. Finally the orderlinecollection binds to the dataset...
The orderlinecollection is passed to the asp.net page, the asp.net page can then use the orderlinecollection to bind a datagrid, or populate a few textboxes, a repeater, the presentation logic is up to the developer/you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|