4 Replies Latest reply on Mar 12, 2013 12:06 PM by r035198x

    Common Design Patterns For Webservices

      Hi All,
      I am creating a webservice which generate the result by iterating multiple webservices serially(Workflow) or parallel(Aggregator).
      What are the common Design patterns I can apply here ? Currently my application flow is

      WebserviceEndpoint-> WebserviceDelegate(POJO) -> Helper Classes ->Aggregator/Workflow Impl which uses WSClients(JAX-WS Stub)

      Do we need to maintain separate DTO for passing Request to the Inner layers ?
      Please share your comments.

        • 1. Re: Common Design Patterns For Webservices
          Design patterns really is a broad subject and only the people involved in coming up with architecture and designs for a particular project should decide which patterns should be used.
          Whether to have separate DTOs for inner calls depends on:
          1.) Are the fields always going to the same?
          2.) Are the 'inner' calls also standalone SOA designed so that they can also be called directly without the need to include properties relevant to other calls?
          3.) (related to 2 above) How dependent are the XSDs for the DTOs if they are made separate
          • 2. Re: Common Design Patterns For Webservices
            Also design patterns are not a replacement for thinking about it. You cannot solve problems by looking for a design pattern - you think up a solution for the problem and then you go see which design pattern(s) might help to implement that solution. There might be no design pattern at all.
            • 3. Re: Common Design Patterns For Webservices
              Thanks for your valuable time
              I have 3 Webservices A(Provider),B,C. Service 'A' is a consumer of service 'B' and 'C'.
              A - is exposed to Consumers, A act as a proxy layer for service B and abstract 'C' from users ,Service 'A' only do the service orchestration .Service 'A' using data from Service 'B' and 'C'
              B – is of same specification as that of Service A (Service B contains All operation defined on A +Internal operation for service A).Internal Webservice which act as active datasource.Request and response structure is same as that of Service 'A'.
              C – is different external service ,requests for Invoking Service 'C' need to be generated from Consumer Request and operations exposed in Service 'B'. External Webservice act as active Data source. Enrich the service 'B' output using service 'C' ,This is done by Service 'A'
              I have done this using following components.
              WebserviceEndpoint-> WebserviceFacade(POJO) -> Helper Classes ->Aggregator/Workflow Impl which uses WSClients(JAX-WS Stub)
              It will be great If some of you can suggest a good logical separation for Service 'A' ? Is above logical separation is correct?

              • 4. Re: Common Design Patterns For Webservices
                Basically same responses as already given. Just to add that I would not use the same pojos for the data that I would send out to customers. In particular I would not make JPA entities part of object graphs sent out to customers. Store your data in the most efficient manner possible and build relevant views for the customers.