Web Services/SOA

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marco Pais

    Web Services/SOA

    Hello.



    This post is long, but I think that's a pertinent question for many people.



    I built a client/server application using .NET and SQL server, a 2 tier
    application. This first version was built in a rush, so its architecture is
    not well designed for the company growth.



    Some weeks ago, I decided to separate the data from the presentation tier
    and include the so named Business Logic Layer. This is a pretty name. and I
    can understand pretty well its value. My goal is to facilitate the change of
    processes, with transparency to the client. This is one of the
    interpretations of SOA.



    What did I use for this layer? Web Services. This WS access database through
    the call of Stored Procedures. My headaches started here. Is this a good
    solution?



    I read and I'm still reading several points of view. the are a lot of
    opinions J



    Concerning the technology used, I am also very confused. This company has
    several connected processes. So I built a single class in a WS with several
    methods (business services), so those processes can connect through the use
    of those services/methods.



    For instance I have a CAR. There's a method to get car data from database,
    and another one to update car data. Two methods. You will say: use a CAR
    OBJECT with appropriate methods. That's were I have some doubts. I can only
    have one class in a web service, right? At least, that's what WS config
    says:



    <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs"
    Class="Service" %>



    What are the best practices? Where can I find better resources for this kind
    of development?



    Thanks in advance. Sorry the long post.



    Regards,



    Marco


  • Marc Gravell

    #2
    Re: Web Services/SOA

    Unfortunately, I think you can ask this question to 3 developers and get
    12 different answers... it isn't a simple "do it this way" area...
    For instance I have a CAR. There's a method to get car data from database,
    and another one to update car data. Two methods. You will say: use a CAR
    OBJECT with appropriate methods. That's were I have some doubts. I can only
    have one class in a web service, right?
    The actual service (the concrete provider of the SOA interface) can only
    be a single class, but it can offer methods that accept/return many
    other classes - so your (making stuff up) FleetService might have a "Car
    GetCar([sometype] key)" method and a "? UpdateCar([sometype] key)" method.

    Re methods, well you have o use methods at some point either way; I
    guess the question is whether these are methods of the car vs methods of
    the service. I prefer the latter as it makes it clear when I am crossing
    boundaries (which may have a performance hit) - where-as with an
    instance method it isn't clear whether it operates locally or over the
    service.

    If you are consuming several services from the same client, then with
    asmx you might want to look at "sharetypes " (wsdl.exe) to allow you to
    use the same Car against different services (otherwise each will be
    different).

    Note that you might want to look at WCF in preference asmx... it offers
    various advantages (I'm not going to attempt to list them all, but the
    fact that data is more contract-based is a biggie). If you choose (it
    isn't the only approach) you can even use assembly sharing to have the
    same Car type at the client (rather than just a lightweight version) -
    but this depends on running .NET etc at the client.

    You might also wish to look at "ADO.NET Data Services" (not yet
    released) which allows access over a web-service to LINQ objects
    (IQueryable<T>) - in particular LINQ-to-SQL and LINQ-to-entities. Just
    another option...

    Marc

    Comment

    • Mr. Arnold

      #3
      Re: Web Services/SOA


      "Marco Pais" <marco.pais[at]gmail.comwrote in message
      news:%23D2rvY7x IHA.4896@TK2MSF TNGP03.phx.gbl. ..
      Hello.
      >
      >
      >
      This post is long, but I think that's a pertinent question for many
      people.
      >
      >
      >
      I built a client/server application using .NET and SQL server, a 2 tier
      application. This first version was built in a rush, so its architecture
      is not well designed for the company growth.
      >
      Some weeks ago, I decided to separate the data from the presentation tier
      and include the so named Business Logic Layer. This is a pretty name. and
      I can understand pretty well its value. My goal is to facilitate the
      change of processes, with transparency to the client. This is one of the
      interpretations of SOA.
      <http://www.google.com/search?hl=en&pw st=1&sa=X&oi=sp ell&resnum=0&ct =result&cd=1&q= books+on+soa+ar chitecture&spel l=1>

      You need to find a good book to start with and understand the concepts of
      SOA.

      You need to think about this very carefully, as I just came off of a SOA WCF
      solution that was a total nightmare that was not transparent to the client
      and didn't allow for new clients being implemented and using the SOA
      solution easily with growth. The solution was not thought out well, a total
      nightmare to maintain or implement new enhancements -- a total nightmare,
      and it showed what not to do.
      >
      >
      >
      What did I use for this layer? Web Services. This WS access database
      through the call of Stored Procedures. My headaches started here. Is this
      a good solution?
      Well, you can have problems in getting that data to/from the UI/Bus/WS/Data
      access tiers, and again you need to think about how you're going to do this.
      You might want to look at something like nHibernate or other such tools to
      faciliate data acess and/or with native calls to SQL server too. And you can
      still use Strored Procedures with both solutions.
      >
      >
      >
      I read and I'm still reading several points of view. the are a lot of
      opinions J
      Java was here first, which has many books on SOA that can be applied to .Net
      too as a starting point on how to do things, along with .Net books as well.
      You need to find some good books that will give you a good concept.
      >
      >
      >
      Concerning the technology used, I am also very confused. This company has
      several connected processes. So I built a single class in a WS with
      several methods (business services), so those processes can connect
      through the use of those services/methods.
      >
      What's stopping you from having more than one WEb service? The Web service
      should only be the means of sending data between the BUS and DAL tiers to
      begin with by the use of serialised objects between the tiers.
      >
      >
      For instance I have a CAR. There's a method to get car data from database,
      and another one to update car data. Two methods. You will say: use a CAR
      OBJECT with appropriate methods. That's were I have some doubts. I can
      only have one class in a web service, right? At least, that's what WS
      config says:
      You use serialized XML objects, which can be in a binary format --
      serialize/deserialize objects. The objects contain their on properties and
      methods that will be acted upon.
      >
      <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs"
      Class="Service" %>
      >
      >
      >
      What are the best practices? Where can I find better resources for this
      kind of development?
      >
      Look above and use Google. You'll find the books.

      I also would suggest looking into MVP. You should think interfaces, and the
      UI should be unaware of the bussiness layer - a loosly coupled solution,
      which allows for easy testing, implementation and growth of the solution.
      You can use a test harness and you test against the interfaces.

      MODEL-VIEW-PRESENTER



      click 'Shows'

      click 'Design Patterns Bootcamp: Model View * Patterns*

      view parts 1-5

      You can use Google to get more information about this or find books.


      You may want to get the book, download the CSLA framework code, and download
      the project code that uses the CSLA framework to get concepts. It's got all
      that you're looking for to learn on the howto(s) in many areas. As a matter
      of fact, I came off a WS SOA project that used CSLA which is free to
      implement in a company. You just can't develop a solution using CSLA as sale
      the solution using CSLA.





      Comment

      • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

        #4
        Re: Web Services/SOA

        Marco Pais wrote:
        I built a client/server application using .NET and SQL server, a 2 tier
        application. This first version was built in a rush, so its architecture is
        not well designed for the company growth.
        >
        Some weeks ago, I decided to separate the data from the presentation tier
        and include the so named Business Logic Layer. This is a pretty name. and I
        can understand pretty well its value. My goal is to facilitate the change of
        processes, with transparency to the client. This is one of the
        interpretations of SOA.
        >
        What did I use for this layer? Web Services. This WS access database through
        the call of Stored Procedures. My headaches started here. Is this a good
        solution?
        No.

        SOA is about exposing services. Web service calls used between the
        business logic layer in one app and the business logic layer in
        another app.

        Web services are not in general suitable for presentation
        layer - business logic layer or business logic layer - data
        access layer.
        Concerning the technology used, I am also very confused. This company has
        several connected processes. So I built a single class in a WS with several
        methods (business services), so those processes can connect through the use
        of those services/methods.
        A service will consist of a single class that offers one or more
        methods.
        For instance I have a CAR. There's a method to get car data from database,
        and another one to update car data. Two methods. You will say: use a CAR
        OBJECT with appropriate methods. That's were I have some doubts. I can only
        have one class in a web service, right? At least, that's what WS config
        says:
        As explained above then GetCar and SaveCar is usually not a good
        service.

        The car app does all the basic CRUD stuf internally and
        expose a service to other apps for stuff like getting values
        to the accounting app and reserve car for employee in the
        HR app.

        Arne

        Comment

        • Marco Pais

          #5
          Re: Web Services/SOA

          Hi there.

          First of all, thanks for all the replies.

          Security is one of my worries. For instance, I have some kind of portal over
          Apache/PHP/MySQL. From my intranet (.NET/WS/SQL Server), I need to access
          some data and I thought about Web Services (XML). Concerning security, I am
          worried, of course. SOA is a nice concept, but when it comes to the
          implementation, I guess things start to complicate.

          When I decided for one Web Service / several Methods instead several Web
          Services, each one with several methods, I thought about sharing data
          between objects / methods and also thought about security. only one WS
          available.

          I will read more. I also think that I must spend more time investigating the
          best approach, although, again, there are not "best solutions". I think this
          still a very abstract matter.

          Thanks again.

          Marco


          "Marco Pais" <marco.pais[at]gmail.comescrev eu na mensagem
          news:%23D2rvY7x IHA.4896@TK2MSF TNGP03.phx.gbl. ..
          Hello.
          >
          >
          >
          This post is long, but I think that's a pertinent question for many
          people.
          >
          >
          >
          I built a client/server application using .NET and SQL server, a 2 tier
          application. This first version was built in a rush, so its architecture
          is not well designed for the company growth.
          >
          >
          >
          Some weeks ago, I decided to separate the data from the presentation tier
          and include the so named Business Logic Layer. This is a pretty name. and
          I can understand pretty well its value. My goal is to facilitate the
          change of processes, with transparency to the client. This is one of the
          interpretations of SOA.
          >
          >
          >
          What did I use for this layer? Web Services. This WS access database
          through the call of Stored Procedures. My headaches started here. Is this
          a good solution?
          >
          >
          >
          I read and I'm still reading several points of view. the are a lot of
          opinions J
          >
          >
          >
          Concerning the technology used, I am also very confused. This company has
          several connected processes. So I built a single class in a WS with
          several methods (business services), so those processes can connect
          through the use of those services/methods.
          >
          >
          >
          For instance I have a CAR. There's a method to get car data from database,
          and another one to update car data. Two methods. You will say: use a CAR
          OBJECT with appropriate methods. That's were I have some doubts. I can
          only have one class in a web service, right? At least, that's what WS
          config says:
          >
          >
          >
          <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs"
          Class="Service" %>
          >
          >
          >
          What are the best practices? Where can I find better resources for this
          kind of development?
          >
          >
          >
          Thanks in advance. Sorry the long post.
          >
          >
          >
          Regards,
          >
          >
          >
          Marco
          >
          >

          Comment

          Working...