eXist-db SOAP and Web Services for Tcl

使用 Web Services for Tcl 來連線 eXist-db 和斷線。eXist-db 有支援 REST 和 SOAP,這裡嘗試使用 eXist-db 提供的 SOAP介面

package require WS::Client
# package require dict

::WS::Client::GetAndParseWsdl "http://localhost:8080/exist/services/Query?WSDL"

# Connect to eXist-db
dict set args userId "guest"
dict set args password "guest"

set result [::WS::Client::DoCall QueryService connect $args]
set sessionId [dict get $result connectReturn]

# Disconnect
dict set args sessionId $sessionId
set result [::WS::Client::DoCall QueryService disconnect $args]

http://localhost:8080/exist/services/Query?WSDL 就是所有提供的 function。

PS. eXist-db 3.0 RC1 移除了 SOAP 的支援,不過 2.2 的還可以用。