# Dispatching requests in SOAP

**URL:** <https://www.ruby-forum.com/t/dispatching-requests-in-soap/101728>\
**Category:** Ruby\
**Created:** [August 7, 2006, 6:00pm UTC](https://www.ruby-forum.com/t/dispatching-requests-in-soap/101728 "2006-08-07T18:00:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rickthemick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6bbea6/32.png) [@rickthemick](https://www.ruby-forum.com/u/rickthemick)\
**Post date:** [August 7, 2006, 6:00pm UTC](https://www.ruby-forum.com/t/dispatching-requests-in-soap/101728/1 "2006-08-07T18:00:32Z")

</div>

Hi!

1. I have built a small SOAP server and wonders and have a few  
questions. I included the code below if it is of interest!

2. What is the best trick to get these requests spawned into new  
threads/processes so that the server will always be available? (if  
running as standalone server)

3. Is the trick to have it to run in the web server?

4. Is the web server thing accomplished by letting the script run as a  
CGI script?

This how I have done my SOAP server test:

* * *

require ‘server\_dispatcher’  
require ‘soap/rpc/standaloneServer’

class DeliveryService \< SOAP::RPC::StandaloneServer  
#will be run when an instance of this class is created  
def on\_init  
obj = MyClass.new  
add\_method(obj, “find”, “array”)  
end  
end

## class MyClass def find(array) return array.push(“extra”) end end

## main prog:

require ‘delivery\_service’

server = DeliveryService.new(“Test”,  
“[http://rickthemick.com/DeliveryService](http://rickthemick.com/DeliveryService)”, “0.0.0.0”, 9090)  
trap(‘INT’) {  
server.shutdown  
}

## puts “Service started…” server.start

---

<div class="post-metadata">

**Author:** ![rickthemick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6bbea6/32.png) [@rickthemick](https://www.ruby-forum.com/u/rickthemick)\
**Post date:** [August 8, 2006, 5:07am UTC](https://www.ruby-forum.com/t/dispatching-requests-in-soap/101728/2 "2006-08-08T05:07:48Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Rickard Sjostrom wrote:

> 1. What is the best trick to get these requests spawned into new  
> threads/processes so that the server will always be available? (if  
> running as standalone server)

Standalone server creates threads for each request. Your sample ar  
already doing that and the server should always be available.

> 1. Is the trick to have it to run in the web server?

Standalone server does. In web server, creating threads/processes is  
generally a task of web server (you don’t have to mind.)

> 1. Is the web server thing accomplished by letting the script run as a  
> CGI script?

With web server, yes. CGI or FCGI. See the blog [1] (not mine) for let  
FCGI work though it’s in Japanese.  
[1] [SOAP4Rをfcgi経由で動かす - 世界線航跡蔵](http://idm.s9.xrea.com/ratio/2006/03/27/000401.html)

Regards,  
// NaHi  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRNf/fR9L2jg5EEGlAQKnTwf/V86J437yf8579J5x1yqSdVfLTEmjdM1n  
zdWsdqSm9Id2ek/Vxmlpa7CMYgortWxUvPZT2y0rKlyMkrg763UswKrhy29GuHkp  
n908txdFpBZbvsNxrYoyg3diSQEG1ZGFfUQIkVcW25LhD5FeXGD8N1J9iV6eQ5pf  
W+Tj6OVhRXZr6Pm0KuaxeqvAjhm6g5b3k8lsxk6ev+OJ06FOPYj2GnxnxEEHwfRu  
ux+ErzvWBOUFZZuzA7a8E9LGKkE1CqbcRGGyGL1q0oTE6oe7KS5Nho99J+uARE5Q  
wCNHHYuj1JLgMBo/yJzjmwxQABzHSR4tM0Fjql35wwses3A11dlDzA==  
=Rxli  
-----END PGP SIGNATURE-----
