using Rpclite Build Soa/web Service
SOA Framework Series
1. Building Soa/web Services using Rpclite
The first thing that comes to mind about Web services is that WebService also uses WCF, ServiceStack, Webapi, and so on.
Rpclite is an open source lightweight SOA service framework that includes the basic provision of Web services as well as SOA governance systems (this article will not be expanded in detail in subsequent articles). Rpclite compared to WCF, the use method is described below.
1.
Create a Web
Project, Framework
Select >=4.0
2.
from NuGet
Add Rpclite in
A TestService1.cs file is added to the post-installation project, which is a simplest service that provides an interface getdatetimestring returns the current time of the string
The Web. config also adds the relevant configuration
3.
Modify Configuration
So far, the simplest service has been completed. F5 run in the browser to change the address to http://localhost:53189/api/test/GetDateTimeString can see the results of the interface returned, with jquery, Ajax can be accessed.
4.
Fundamentals
Architecture diagram
The entrance to the Rpclite is an asynchronous HttpHandler that will Requesturl, ContentType, Requeststream, Responsestream, in handler HttpContext and so put in a new servicecontext to Rpcservice processing, Rpcservice will find the corresponding service and action according to the Requesturl contenttype select the serialization mode (by default, JSON, XML, can add custom serialization), and then deserialize to get the parameters, Then use the parameters to invoke the specific service method, the results are returned to the client.
5.
configuration File Description
Look again at Web. config,
Tag 1. The request to add the corresponding address after HttpHandler is added is Rpcasynchandler processed.
Tag 2. Add the Rpclite Configuration node processor and add Rpclite to read the data from the Rpclite node.
Tag 3. A service is added here, name only serves as a recognition function best not to repeat, path determines which URL addresses the service will handle requests from to use the virtual directory relative to the address that begins with ~/, type setting implements the class format for this service is the < class name, assembly name.
Tag 4. Here is the addition of a client configuration that uses the path set here if the client instance is created without specifying a service URL. If the service URL is not specified here, clientfactory.getinstance<itestservice> () will be looked up from the configuration.
Other. AppId, environment, namespace and the governing system are not opened here explicitly.
The code is obtained from the git given below.
6.
RELATED LINKS
Demo git address: Https://github.com/chrishaly/RpcLiteDemo
Rpclite git address: https://github.com/aolyn/RpcLite
Nuget:https://www.nuget.org/packages/rpclite
Late at night, writing articles than writing code trouble. This framework was written almost 2014 years ago, and has not had time to introduce. Interested friends can fork & pull request on Git.
Contact information
The successor will have a series of articles detailing
Thanks & Regards.
Chris
Building Soa/web Services with Rpclite