RPC versus message based services Archives - Anuj Varma, Hands-On Technology Architect, Clean Air Activist https://www.anujvarma.com/tag/rpc-versus-message-based-services/ Production Grade Technical Solutions | Data Encryption and Public Cloud Expert Thu, 12 Dec 2013 21:47:18 +0000 en-US hourly 1 https://wordpress.org/?v=7.0.2 https://www.anujvarma.com/wp-content/uploads/anujtech.png RPC versus message based services Archives - Anuj Varma, Hands-On Technology Architect, Clean Air Activist https://www.anujvarma.com/tag/rpc-versus-message-based-services/ 32 32 Message Based versus RPC Style Services https://www.anujvarma.com/message-based-versus-rpc-style-services/ https://www.anujvarma.com/message-based-versus-rpc-style-services/#respond Mon, 04 Nov 2013 22:22:41 +0000 http://www.anujvarma.com/?p=1676 Choose Message-Based Programming Over RPC Style You can design Web services by using either of two programming models: messaging style and RPC style. The RPC style is based on the […]

The post Message Based versus RPC Style Services appeared first on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.

]]>
Choose Message-Based Programming Over RPC Style

You can design Web services by using either of two programming models: messaging style and RPC style. The RPC style is based on the use of objects and methods. Web methods take object parameters to do the processing, and then return the results. This style generally relies on making multiple Web method calls to complete a single logical operation, as shown in the following code snippet.

//client calling a Web service

Serv.SendItemsToBePurchased(Array[] items);

Serv.ShippingAddress(string Address);

Serv.CheckOut();

The messaging style does not focus on objects as parameters. It is based on a data contract (schema) between the Web service and its clients. The Web service expects the message to be XML that conforms to the published data contract.

//Client

string msg = "<Items>…</Items>";

MyMethod(msg);

 

//Server

[WebMethod]

void MyMethod(string msg){ . . . }

This approach allows you to package and send all parameters in a single message payload and complete the operation with a single call, thus reducing chatty communication. The Web service may or may not return results immediately; therefore, the clients do not need to wait for results.

The post Message Based versus RPC Style Services appeared first on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.

]]>
https://www.anujvarma.com/message-based-versus-rpc-style-services/feed/ 0