-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathWubServer.tcl
42 lines (36 loc) · 1.02 KB
/
WubServer.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# WSWub - Wub interface to WebServices
package require Tcl 8.4-
# WS::Utils usable here for dict?
if {![llength [info command dict]]} {
package require dict
}
package require WS::Server
package require OO
package require Direct
package require Debug
Debug off wsdl 10
package provide WS::Wub 2.5.0
package provide Wsdl 2.4.0
class create Wsdl {
method / {r args} {
return [Http Ok $r [::WS::Server::generateInfo $service 0] text/html]
}
method /op {r args} {
if {[catch {::WS::Server::callOp $service 0 [dict get $r -entity]} result]} {
return [Http Ok $r $result]
} else {
dict set r -code 500
dict set r content-type text/xml
dict set r -content $result
return [NoCache $r]
}
}
method /wsdl {r args} {
return [Http Ok $r [::WS::Server::GetWsdl $service] text/xml]
}
mixin Direct ;# Direct mixin maps the URL to invocations of the above methods
variable service
constructor {args} {
set service [dict get $args -service] ;# we need to remember the service name
}
}