Abstract

SOA is a well-known term today, when we think of SOA; WCF comes in mind. Whereas WCF is a Microsoft technology to build SOA based software solutions. This article will help you understand what exactly “SOA” is as per real architectural way, why architects suggest SOA based application architecture and how SOA can be implemented etc.

What is SOA

SOA (Service Oriented Architecture) is an Architectural Design Pattern / Approach, under which distributed and decoupled applications can interact with each other. SOA is NOT a Technology or a Language.

SOA provides the infrastructure to the idea of how two different business entities communicate and work together. E.g. your bank offering Stock services, a travel site with feature to book a flight, a hotel, a car or even a holiday package etc., weather updates and currency rates etc. All such activities take place due to B2B integration; and SOA is the oxygen for such type of business activities.

Before a service can be consumed, a request message needs to be sent to the service (the provider, or callee) by its client (the consumer, or caller). A request message contains information about the operation the service is being asked to perform, and any additional data that the specific operation needs to have before executing. For example, a service that shows you a currency exchange rate needs to have two currency types and how much money you want to convert. E.g. 100 USD to INR

Why SOA

In today’s world we heavily rely on software systems for example a bank’s system communicates to various other software & database systems.

This usually cause Software applications to face following challenges:

  • Applications are becoming more and more distributed.
  • Business needs are changing very often.
  • Collaboration with other systems is becoming key to success of application. E.g. B2B scenario.
  • Operation costs need to be reduced.
  • Scalable, secure and reliable systems are needed by business.

SOA resolves these challenges by defining standards for interaction between decoupled systems and technologies based on policies and contracts.

SOA Objectives

SOA is intended to provide loosely coupled interaction between applications. Benefits offered by SOA are as follows:

  • Agility. Enables your business to adapt changes quickly.
  • Productivity. Can implement complex applications using SOA more easily than with other architectural styles.
  • Reusability. Able to reuse your services across systems instead of rewriting the same modules again and again in every system or specific to an individual system.
  • Reduced cost. Software Architects think of Build vs. Buy vs. Reuse, SOA based approach allows to either buy or reuse this feature/functionality; hence in most of the cases cost is saved by reusing the existing services, a lot of commonly used services are available for free.

Communicating with SOA based Service

SOA based services communicate with outside world via EndPoint(s). Hence, EndPoint is required to communicate with a Service.

  • An EndPoint is the access point to the service.
  • Accessing internal assets can be done only through the EndPoint.
  • The EndPoint controls who can access the service, what operations they can perform, etc.
  • Services may expose multiple EndPoint for various reasons (technology, topology, etc.).

Properties of SOA Architecture

Service-Oriented Architecture is based on four tenets:

Services handle data, not objects

Objects are known to have direct dependency on a particular technology, while XML data is not technology-specific. Hence, services communicate by exchanging data as long as they use the same standards by which the service operates.

Services are autonomous

In order to utilize a Service, client does not need to know the implementation technology and various other internal/implementation details. What all a client requires is the service’s address (I.e. EndPoint) and the information to send the data to.

Services have explicit boundaries

The service is responsible for exposing its information. Everything inside the service’s boundary is only accessible through the service EndPoint. The service’s boundaries are explicit, meaning that the service specifies precisely which messages it can receive and what the messages need to contain; messages that are not compliant with these specifications will be rejected with an error message.

Services expose contract and policy

The contract of the service defines the data which client needs to use when calling a service. Service contract also define the response that the service sends back to the client as result of call made to service.
The service’s policy defines additional information about the data that is being sent. For example, a policy can state that the data needs to be encrypted etc.

SOA Benefits

Productivity

  • Services are autonomous. Services have explicit boundaries. Services can always be moved to some other location.
  • Services depend on data. There is no dependency on the technology that creates the data.
  • Service autonomy simplifies testing
  • All major development frameworks (Microsoft.NET, Java) embraced SOA.
  • Development tools like Microsoft Visual Studio provide an excellent environment for building SOA applications using WCF, ASP .NET WebAPI or ASP .NET WebServices.

Agility

Continue Reading

There is a live .NET Web Service which offers all the curreny conversion eg. USD to INR etc.

This WS is available via live URL http://www.webservicex.net/CurrencyConvertor.asmx

This WS has a class CurrecnyConvertor which exposes one Function named ConversionRate and an enum named Currency which exposed the list of all the currencies like USD, INR, AED etc.

As you know Currency conversion will depend on two parameters ConvertFrom and ConvertTo and so the same is expected to be passsed while invoking ConversionRate function.

Here is a detailed list of steps:

1- Add a Web Reference to http://www.webservicex.net/CurrencyConvertor.asmx
2- Rename the Reference name to something more friendly like CurrencyConversionWS
3- In your project create an instance of the added Web service reference
4- On the created object invoke the ConversionRate function.
5- As mentioned above there is an enum which lists all the currencies and so access it directly from the object created.
6- Save the result into a double variable and multiply with your passed amount.
7- Multiply the amount you want to convert to the received conversion rate.

Here is the code you will require to have it all working:

CurrencyConversionWS.
CurrencyConvertor
objWS = new CurrencyConversionWS.CurrencyConvertor();

double usdToinr = objWS.ConversionRate(CurrencyConversionWS.Currency.USD, CurrencyConversionWS.Currency.INR);

double totalAmount = usdToinr * Double.Parse(textBox1.Text);

MessageBox.Show(totalAmount.ToString(),“Total Indian Rupees”);

This is how it will look like:

What are the contents of Service1.asmx

September 7th, 2010 | Posted by Vidya Vrat in ASP .NET - (0 Comments)

In any version of Visual Studio, when you create a WebService, it comes with a default Service1.asmx file. When you double-click on this file it opens Service1.asmx.cs file for you, why? and what is the content in this file then? and how do you view it?

In order to view what is inside Service1.asmx, select the file in Solution-Explorer, right-click, and choose “Open With…”

From the shown dialog, select the option “Source Code(Text) Editor, click OK, you will see content like this:

These are the instructions Service1.asmx have and so it opens the Service1.asmx.cs, whenever you double-click on Service1.asmx, as its .cs file is the CodeBehind.

If you are looking for Web Service project template in Visual Studio 2010 under .NET Framework 4.0 as shown in the image below, you will not find it.

In order to create a WebService using Visual Studio 2010 you need to switch back to .NET Framework 3.5, as shown in the image below, and you will be able to crate a WebServeice project.