Accountname could be replaced with string xmlCredentials, otherwise you
should consider some other security mechanism

Your set of methods are very similar to how the MetawebLog API works (
http://www.xmlrpc.com/metaWeblogApi )

The metaweblogapi however deals with a lot of individual edits,adds,gets.
Since your publishers will most probably be doing changes in bulk, your
three methods can be further abstracted to

AddNewBooks( string xmlCredentials, string xmlBooks )

Where in your xmlBookList, you have another attribute or node expressing
"add", "delete", "insert"

<BookListProcessRequest>
     <Version>1.0</Version>
     <Book id=23>
                <!-- your usual mumbo jumbo that deals with books goes here
-->
                <Action>Add</Action>
     </Book>
     <Book id=24>
                <!-- your usual mumbo jumbo that deals with books goes here
-->
                <Action>Delete</Action>
     </Book>
     <Book id=25>
                <!-- your usual mumbo jumbo that deals with books goes here
-->
                <Action>Update</Action>
     </Book>
  </BookListProcessRequest>


Your process function can then take care of this asynchronously by sending
the appropriate actions to the appropriate methods responsible. This also
puts another level of control which you didn't have. As systems get larger
in size and traffic of information increases, utilizing the power of
asynchronous sequential queues will greatly affect the performance of your
system. If you can take this "process" list and be able to carry out the
actions in the background, the publisher or client interface doesn't need to
be waiting around. The way that you usually send a response back in this
situation is also a booklist, but like this.

<BookListProcessResponse>
     <Version>1.0</Version>
     <Book id=23>
                <Reaction>1</Reaction> <!-- success -->
     </Book>
     <Book id=24>
                <Reaction>1</Reaction> <!-- success -->
     </Book>
     <Book id=25>
                <Reaction>0</Reaction> <!-- failure -->
                <Error>This book doesn't exist, so you can't delete
it</Error>              <!-- only if there is an error -->
     </Book>
  </BookListProcessResponse>


Rahul Singh
Anant Systems, Inc.


-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of steak
Sent: Wednesday, December 10, 2003 5:01 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Web Service Design Question

Hello all,

Looking for any feedback on web service design for the following scenario:

Problem:
  An on-line book store Acme.com needs a web service that allows book
publishers to maintain their own list of products available.

Examples:
  - Addison-Wesley calls the web service to add 100 titles
  - MSPress call the web service to update pricing for 10 titles and remove
3 discontinued titles from their existing list of books with Acme.

Possible Design of Web Service interface:
   AddNewBooks( string accountName, string xmlBooks )
   UpdatePricing( string accountName, string xmlBooks )
   RemoveBooksFromAvailbility( string accountName, string xmlBooks )

Where xmlBooks is a XML document something like this (simplified):
  <BookList>
     <Version>1.0</Version>
     <Book id=23>
       <Title>Great New Book</Title>
       <ISBN>xxx-xxxx-xxx<ISBN>
       <PriceTier id=3>
         <Price>30.00</Price>
         <QuantityRequired>1</QuantityRequired>
       </PriceTier>
       <PriceTier id=5>
         <Price>25.00</Price>
         <QuantityRequired>10</QuantityRequired>
       </PriceTier>
     </Book>
     <Book id='38'>
       <Title>Not so good Book</Title>
       <ISBN>xxx-xxxx-xxx<ISBN>
       <PriceTier id=6>
         <Price>42.00</Price>
         <QuantityRequired>1</QuantityRequired>
       </PriceTier>
     </Book>
  </BookList>

Questions:
  So the question is really does this sound like a reasonable interface for
this type of problem?

  Would you have other ideas or have you seen other best practices for
dealing with inventories of items like this?

  Do these decision points below sound good or bad?
    (1) All data is passed as a string representing a XML document.  This
is to make it possible to add future data extensions while not requiring
clients to constantly call new API revisions.  The schema of the XML
document would define what is sent/received.

    (2) There is Id attribute on the Book and PriceTier elements.  I was
hesitant to add this because I want keep the web service abstracted away
from datastore details, but it seems even if a service is datastore
independent it is still reasonable to have a unique key to differentiate
items.

Any comments appreciated -
Regards,
steak

===================================
This list is hosted by DevelopMentorR  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to