We are developing a ReSTful HTTP API with Servicestack(.NET).

Some of the API clients, which have a subset of the actions, demand a service which could be easily added with all the entities, like with the "Add Service Reference" with Visual Studio.

We are thinking about creating a simple asmx web service, but our thoughts on how to do it divide to two:

  1. The asmx WS will call the ServiceStack service with an HTTP client.
  2. The asmx WS will reference the same BL that the main service references and will call it directly.

Which is the preffered way?

Is there any other way you would recommend?

2 Answers 2


If your API has a layer of user facing view/edit models you could put them in a separate assembly and provide your client a simple .NET based driver/bridge/wrapper that uses the same models and invokes your API for them. This way you basically give them what asmx binding code generates for you.


Consider writing adapters for input into your application logic. The application should not have to really know about the clients that access the business logic. Instead you write code that adapts the client's (in this case your web services) calls into your application into what it needs. This is a basic principle in Allistair Cockburn's Ports and Adapters Pattern ("Ports and Adapters" or "Hexagonal" Pattern)

The idea behind this principle is to limit the entanglement between the business logic and the interaction with external entities.

The classic Design Patterns book has a description of the generic "Adapters" pattern. Ports-and-adapters uses this pattern.

  • So are you suggesting the 2nd approach?
    – Mithir
    Mar 8, 2013 at 15:59
  • 1
    Yes, if you understand that the business logic should not be duplicated simply in order to allow the two services to interact with it. However, your BL should not have specific implementation details for each client service using it. Instead, I recommend you create a single API. You then create adapters that will adapt each web services' requests to the API. This will also give you long-term flexibility as you could later add additional adapters for mobile, other services, etc. without affecting the application layer directly.
    – MauMen
    Mar 8, 2013 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.