Class SOAP::RPC::CGIStub
In: lib/soap/rpc/cgistub.rb
Parent: Logger::Application

SYNOPSIS

  CGIStub.new

DESCRIPTION

  To be written...

Methods

Included Modules

SOAP WEBrick

Classes and Modules

Class SOAP::RPC::CGIStub::SOAPFCGIRequest
Class SOAP::RPC::CGIStub::SOAPRequest
Class SOAP::RPC::CGIStub::SOAPStdinRequest

Constants

HTTPVersion = WEBrick::HTTPVersion.new('1.0')

Public Class methods

[Source]

    # File lib/soap/rpc/cgistub.rb, line 77
77:   def initialize(appname, default_namespace)
78:     super(appname)
79:     set_log(STDERR)
80:     self.level = ERROR
81:     @default_namespace = default_namespace
82:     @remote_host = ENV['REMOTE_HOST'] || ENV['REMOTE_ADDR'] || 'unknown'
83:     @router = ::SOAP::RPC::Router.new(self.class.name)
84:     @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
85:     on_init
86:   end

Public Instance methods

[Source]

     # File lib/soap/rpc/cgistub.rb, line 149
149:   def add_document_operation(receiver, soapaction, name, param_def, opt = {})
150:     @router.add_document_operation(receiver, soapaction, name, param_def, opt)
151:   end

[Source]

     # File lib/soap/rpc/cgistub.rb, line 115
115:   def add_headerhandler(obj)
116:     @router.add_headerhandler(obj)
117:   end
add_method(obj, name, *param)

Alias for add_rpc_method

add_method_as(obj, name, name_as, *param)

Alias for add_rpc_method_as

add_method_with_namespace(namespace, obj, name, *param)
add_method_with_namespace_as(namespace, obj, name, name_as, *param)
add_rpc_headerhandler(obj)

Alias for add_headerhandler

method entry interface

[Source]

     # File lib/soap/rpc/cgistub.rb, line 122
122:   def add_rpc_method(obj, name, *param)
123:     add_rpc_method_with_namespace_as(@default_namespace, obj, name, name, *param)
124:   end

[Source]

     # File lib/soap/rpc/cgistub.rb, line 127
127:   def add_rpc_method_as(obj, name, name_as, *param)
128:     add_rpc_method_with_namespace_as(@default_namespace, obj, name, name_as, *param)
129:   end

[Source]

     # File lib/soap/rpc/cgistub.rb, line 132
132:   def add_rpc_method_with_namespace(namespace, obj, name, *param)
133:     add_rpc_method_with_namespace_as(namespace, obj, name, name, *param)
134:   end

[Source]

     # File lib/soap/rpc/cgistub.rb, line 137
137:   def add_rpc_method_with_namespace_as(namespace, obj, name, name_as, *param)
138:     qname = XSD::QName.new(namespace, name_as)
139:     soapaction = nil
140:     param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
141:     @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
142:   end

[Source]

     # File lib/soap/rpc/cgistub.rb, line 145
145:   def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
146:     @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
147:   end

servant entry interface

[Source]

     # File lib/soap/rpc/cgistub.rb, line 110
110:   def add_rpc_servant(obj, namespace = @default_namespace)
111:     @router.add_rpc_servant(obj, namespace)
112:   end
add_servant(obj, namespace = @default_namespace)

Alias for add_rpc_servant

[Source]

     # File lib/soap/rpc/cgistub.rb, line 100
100:   def generate_explicit_type
101:     @router.generate_explicit_type
102:   end

[Source]

     # File lib/soap/rpc/cgistub.rb, line 104
104:   def generate_explicit_type=(generate_explicit_type)
105:     @router.generate_explicit_type = generate_explicit_type
106:   end

[Source]

    # File lib/soap/rpc/cgistub.rb, line 92
92:   def mapping_registry
93:     @router.mapping_registry
94:   end

[Source]

    # File lib/soap/rpc/cgistub.rb, line 96
96:   def mapping_registry=(value)
97:     @router.mapping_registry = value
98:   end

[Source]

    # File lib/soap/rpc/cgistub.rb, line 88
88:   def on_init
89:     # do extra initialization in a derived class if needed.
90:   end

[Source]

     # File lib/soap/rpc/cgistub.rb, line 153
153:   def set_fcgi_request(request)
154:     @fcgi = request
155:   end

Private Instance methods

[Source]

     # File lib/soap/rpc/cgistub.rb, line 161
161:   def run
162:     res = WEBrick::HTTPResponse.new({:HTTPVersion => HTTPVersion})
163:     begin
164:       @log.info { "received a request from '#{ @remote_host }'" }
165:       if @fcgi
166:         req = SOAPFCGIRequest.new(@fcgi)
167:       else
168:         req = SOAPStdinRequest.new($stdin)
169:       end
170:       @soaplet.do_POST(req, res)
171:     rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
172:       res.set_error(ex)
173:     rescue HTTPStatus::Error => ex
174:       res.set_error(ex)
175:     rescue HTTPStatus::Status => ex
176:       res.status = ex.code
177:     rescue StandardError, NameError => ex # for Ruby 1.6
178:       res.set_error(ex, true)
179:     ensure
180:       if defined?(MOD_RUBY)
181:         r = Apache.request
182:         r.status = res.status
183:         r.content_type = res.content_type
184:         r.send_http_header
185:         buf = res.body
186:       else
187:         buf = ''
188:         res.send_response(buf)
189:         buf.sub!(/^[^\r]+\r\n/, '')       # Trim status line.
190:       end
191:       @log.debug { "SOAP CGI Response:\n#{ buf }" }
192:       if @fcgi
193:         @fcgi.out.print buf
194:         @fcgi.finish
195:         @fcgi = nil
196:       else
197:         print buf
198:       end
199:     end
200:     0
201:   end

[Validate]