From: Wolfgang W. <wol...@di...> - 2017-01-02 15:54:44
|
We have a different setup. A simple example, as we use tclws, would be: proc ::WS::AOLserver::call_op {when why} { # {{{ ::WS::AOLserver::Init ::WS::AOLserver::Return # return and stop all filters return -return_code return filter_break # }}} } proc ::WS::AOLserver::InitEchoSoapURLs {service host port service_desc} { if { ![nsv_exists init soap::${service}::init_done] } { nsv_set init soap::${service}::init_done 1 # register the service in tclws ::WS::Server::Service -mode aolserver -prefix "/SOAP/${service}" -service $service -description $service_desc -host $host -ports $port # register a filter for the ops (doc, op, wsdl) ad_register_filter -priority 400 preauth * /SOAP/${service}/* ::WS::AOLserver::call_op # Define any special types ::WS::Utils::ServiceTypeDef Server $service echoReply { echoBack {type string} echoTS {type dateTime} } # Define the operations available ::WS::Server::ServiceProc $service \ { SimpleEcho {type string comment {Requested Echo}} } { TestString {type string comment {The text to echo back}} } { Echo a string back } { return [list SimpleEchoResult $TestString] } } } set service "echo" set host "localhost:8080" set port "8080" set desc "Echo Service" ::WS::AOLserver::InitEchoSoapURLs $service $host $port $desc I've simpliefied the code a bit, so it should run on any naviserver installation, except for the ad_register_filter call. I haven't testet this simplified code, so expect some typos. But I think you'll get the general idea. This is all sourced at startup. The filter catches all requests to the service, an internal redirect is not necessary. Wolfgang Am 2017-01-02 um 16:06 schrieb Claudio Pasolini: > Thanks Gustaf and Wolfgang. > > I modified the proc ::WS::AOLserver::Return as per Gustaf suggestion, > but I have not yet succeeded executing the sample EchoWebService. > > To reduce the complexity I modified the call to the service so as to > make a single call to the SimpleEcho method. Executing the script > CallEchoWebService I receive a screen with the correct results, but > looking at the error.log it seems that the calls to > ::WS::AOLserver::Return be duplicated and finally I get an error > complaining that the connection is already closed. > > Here is an excerpt of the error log. > > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > WS::AOLserver::Redirect: from '{} tclws ws echoexample wsdl' to > '/tclws/ws/echoexample/index.tcl' > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > ...entering ::WS::AOLserver::Return requestType=wsdl > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > ... calling ::WS::Server::generateWsdl > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > ...entering ::WS::AOLserver::Return requestType=wsdl > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > ... calling ::WS::Server::generateWsdl > [02/Jan/2017:15:37:13][3409.7fa0d5499700][-conn:oacs-5-9:3-] Notice: > Calling SimpleEcho via DoCalls! > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > WS::AOLserver::Redirect: from '{} tclws ws echoexample op' to > '/tclws/ws/echoexample/index.tcl' > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > ...entering ::WS::AOLserver::Return requestType=op > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > ...::WS::AOLserver::Return calling ::WS::Server::callOperation > service=echoexample sock=nosock > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Notice: > ...entering ::WS::AOLserver::Return requestType=op > [02/Jan/2017:15:37:13][3409.7fa0d5499700][-conn:oacs-5-9:3-] Notice: > Received: {SimpleEchoResult {This is a test}} > [02/Jan/2017:15:37:13][3409.7fa0d5398700][-conn:oacs-5-9:4-] Error: > connection already closed, can't get content > while executing > "ns_conn content" > (procedure "ns_getcontent" line 75) > invoked from within > "ns_getcontent -as_file false -binary false" > ("uplevel" body line 37) > invoked from within > "uplevel 1 { > > set sock nosock > > ns_log notice "\n...entering ::WS::AOLserver::Return > requestType=$requestType" > switch -exact -- $requestType { > > ..." > (procedure "::WS::AOLserver::Return" line 3) > invoked from within > "::WS::AOLserver::Return" > > > I don't understand why this is happening. > > Wolfgang: did You modify the proc ::ws_aolserver_redirect replacing > ns_rewriteurl with ns_internalredirect? > > Best regards. > > Claudio > > 2017-01-02 13:34 GMT+01:00 Wolfgang Winkler > <wol...@di... > <mailto:wol...@di...>>: > > Hi Claudio! > > I can confirm what Gustaf wrote below. We are using our own > initialization routine, which is similar to the one provided by > the tclws package. We have our own logging facilities, wo we don't > need the log package: > > namespace eval ::WS::AOLserver { > if {![info exists wsVersion]} { > variable wsVersion [package require WS::Server] > } > #if {![info exists logVersion]} { > # variable logVersion [package require log] > #} > } > > For returning values, we use exactly the line from Gustaf: > > set data(query) [ns_getcontent -as_file false -binary false] > > This is handy for REST interfaces as well. > > regards, > > Wolfgang > > > > Am 2016-12-31 um 17:51 schrieb Gustaf Neumann: >> Am 30.12.16 um 19:00 schrieb Claudio Pasolini: >>> Hi all, >>> >>> I'm in the process of upgrading several OpenACS instances and >>> migrating them from AolServer 4.5 to the latest NaviServer. >>> >>> One of the instances makes use of TCLWS for bulding a couple of >>> SOAP web services and I'm having trouble to make it work. >>> >>> Here are the first problems encountered: >>> >>> * ns_ictl doesn't support the 'package' argument. I replaced >>> the command >>> ns_ictl package require log >>> with >>> ns_ictl trace allocate {package require log} >>> >> probably, using "package require log" will be sufficient as well. >> >>> * but I'm not sure about eventual side effects. >>> * In a proc called by ns_register_filter preauth I replaced >>> ns_rewrite with ns_internalredirect but I observed a strange >>> behaviour. ns_register_filter invokes the proc passing one >>> argument, but actually the proc receives two, prehauth being >>> added. >>> >> you are probably referring to the old module "nsredirect". >> Calling ns_internalredirect should be fine. >> >> Yes, there is a difference between the calling conventions in >> AOLserver and NaviServer: >> NaviServer tells the developer the stage, at which the proc was >> invoked (the same proc >> might be registered for multiple states (such as "preauth", >> "postauth" or "trace"). This >> difference is as well handled in e.g. OpenACS since 10+ years. >> >>> * I stumbled in the same problem posted by Wolfgang Winkler >>> Error: can't set "xsltSchemaDom": var is read-only >>> and solved it thanks to Gustaf tip. >>> >> should not happen in recent versions of NaviServer >>> >>> * Calling the sample EchoWebService I get a strange error >>> Error: invalid length: 779 >>> executing the command >>> ns_conn copy 0 $length $fp >>> >> this comes probably from this section: >> https://github.com/bovine/tclws/blob/master/AOLserver.tcl#L82 >> <https://github.com/bovine/tclws/blob/master/AOLserver.tcl#L82> >> >> I would think that you can replace the section "Get POSTed data" >> by something like: >> >> set data(query) [ns_getcontent -as_file false -binary false] >> >> This has at least the following advantages >> - less hacky >> - works for http and https >> - works also when spooling post data >> >> all the best >> -gn >> >> >>> I wonder if someone (Wolfgang?) having already a production site >>> running TCLWS with NaviServer could suggest me how to proceed. >>> >>> Happy New Year! >>> >>> Claudio >>> >>> >>> ------------------------------------------------------------------------------ >>> Check out the vibrant tech community on one of the world's most >>> engaging tech sites, SlashDot.org!http://sdm.link/slashdot >>> >>> _______________________________________________ >>> naviserver-devel mailing list >>> nav...@li... >>> <mailto:nav...@li...> >>> https://lists.sourceforge.net/lists/listinfo/naviserver-devel >>> <https://lists.sourceforge.net/lists/listinfo/naviserver-devel> >> >> -- >> Univ.Prof. Dr. Gustaf Neumann >> WU Vienna >> Institute of Information Systems and New Media >> Welthandelsplatz 1, A-1020 Vienna, Austria >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, SlashDot.org!http://sdm.link/slashdot >> >> _______________________________________________ >> naviserver-devel mailing list >> nav...@li... >> <mailto:nav...@li...> >> https://lists.sourceforge.net/lists/listinfo/naviserver-devel >> <https://lists.sourceforge.net/lists/listinfo/naviserver-devel> > -- > > *Wolfgang Winkler* Geschäftsführung > wol...@di... > <mailto:wol...@di...> mobil > +43.699.19971172 <tel:+43%20699%2019971172> dc:*büro* digital > concepts Novak Winkler OG Software & Design Landstraße 68, 5. > Stock, 4020 Linz www.digital-concepts.com > <http://www.digital-concepts.com> tel +43.732.997117.72 tel > +43.699.1997117.2 Firmenbuchnummer: 192003h Firmenbuchgericht: > Landesgericht Linz > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ naviserver-devel > mailing list nav...@li... > <mailto:nav...@li...> > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > <https://lists.sourceforge.net/lists/listinfo/naviserver-devel> > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- *Wolfgang Winkler* Geschäftsführung wol...@di... mobil +43.699.19971172 dc:*büro* digital concepts Novak Winkler OG Software & Design Landstraße 68, 5. Stock, 4020 Linz www.digital-concepts.com <http://www.digital-concepts.com> tel +43.732.997117.72 tel +43.699.1997117.2 Firmenbuchnummer: 192003h Firmenbuchgericht: Landesgericht Linz |