Ruby Developer's Guide

Chapter 5: Web Services and Distributed Ruby

Introduction

In this chapter we'll introduce you into three libraries, XML-RPC for Ruby (xmlrpc4r), Simple Object Access Protocol for Ruby (SOAP4R) and Distributed Ruby (DRb). The first two are interfaces to XML-RPC and SOAP, which are XML-based and language-independent protocols; both are used for writing or accessing Web services. The third library is a pure Ruby solution for remote method calls, and is limited to Ruby That is, it's not possible to write a client or a server in a language other than Ruby using Distributed Ruby.

Developing & Deploying : Monitoring TCP/IP Based Services

We can monitor Web services, or any TCP/IP-based client and server, by using a very simple monitor application that comes with XML-RPC for Ruby (see file samples/monitor/monitor.rb) or TCPSocketPipe (available from the Ruby Application Archive [RAA]).

Suppose you are running a SOAP service on port 8070. To display the traffic between that service and a SOAP client, start the monitor with the following:

ruby monitor.rb 8060 localhost 8070

The SOAP client should now access the service through port 8060 instead of port 8070.

In addition to the graphical user interface (GUI) displaying the traffic, a hex dump of the TCP/IP traffic and some logging messages are stored in the directory's TCPSocketPipe.log file.

Using XML-RPC for Ruby

XML-RPC takes a pragmatic approach to distributed computing between different systems and languages, based on two major Internet standards: HTTP for transmission, and XML to encode information in a human-readable and portable way.

XML-RPC's specification (see www.xmlrpc.com/spec) defines a...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Integrated Development Environment (IDE)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.