From: tom.rmadilo on 20 Jan 2010 21:03 On Jan 20, 4:56 pm, Doug du Boulay <doug.dubou...(a)gmail.com> wrote: > Hi, > > I need to add a Web Service client to an existing project that uses an > embedded Tcl-8.4 interpreter. This project already has a dependency > on tDOM. > There is no likelihood to upgrade Tcl to 8.5 where, as I understand > it, the > "dict" type was introduced (and made heavy use of in tclws). > The server endpoint itself is actually a JDeveloper/Oracle based > service > that will be evolving. > > What I was hoping was that there would be a way to take the server's > WSDL > file and generate client side Tcl stubs that I could then use in the > project > I will be working with. Because of the existing tDOM dependence, I'm > guessing my best option for creating a client is either tSOAP or > tWSDL. > But tWSDL seems to be oriented towards running web services in an > AOLserver > and I have no need for that. > > Maybe its possible to generate Tcl stubs from the WSDL using a more > recent Tcl and use those in the older interpreter? > I could really use some advice at this point! > Thanks in advance As the author of tWSDL, I understand your concerns. In fact, tWSDL was designed to address these concerns. First: tWSDL is not dependent on AOLserver, it isn't even dependent on Tcl 8.5+ features. I was very careful to avoid using any advanced features because web services tend to be designed to leverage existing code, not cutting edge code. If you look at the API there is a thin interface between AOLserver and tWSDL. However, the TWiST API is even more abstracted from AOLserver. A TWiST service runs with or without AOLserver requiring no changes to the service configuration file. Second: A generic WSDL client does not work well in every situation. In fact, it is almost guaranteed that any significant web service will run into problems interacting with a generic client (unless the client is tailored to the server). Third: Although tWSDL/TWiST does not have a client, each service includes a web interface which generates client requests to the server, somewhat like a proxy or even a protocol proxy (like SOCKS). You could call this code example code for using the tWSDL API to generate client requests. But you have to work to understand it. Sorry. Fourth: There is some unfinished code for client development. At least three different strategies are under development. One uses an XSL transform to read a WSDL and create a web service (transforming into tWSDL API calls). Another reads a WSDL into a Tcl structure and then introspects the structure. The third is a redirected proxy server where the target web service is replicated (manually) locally and exposed as either a different type of web service or as a Tcl API (this is very much patterned on the TWiST client). I can always help out with a specific request.
From: Doug du Boulay on 21 Jan 2010 01:01 Hi Tom, thanks for the lightning quick response! On Jan 21, 1:03 pm, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote: > On Jan 20, 4:56 pm, Doug du Boulay <doug.dubou...(a)gmail.com> wrote: > > > > > Hi, > > > I need to add a Web Service client to an existing project that uses an > > embedded Tcl-8.4 interpreter. This project already has a dependency > > on tDOM. > > There is no likelihood to upgrade Tcl to 8.5 where, as I understand > > it, the > > "dict" type was introduced (and made heavy use of in tclws). > > The server endpoint itself is actually a JDeveloper/Oracle based > > service > > that will be evolving. > > > What I was hoping was that there would be a way to take the server's > > WSDL > > file and generate client side Tcl stubs that I could then use in the > > project > > I will be working with. Because of the existing tDOM dependence, I'm > > guessing my best option for creating a client is either tSOAP or > > tWSDL. > > But tWSDL seems to be oriented towards running web services in an > > AOLserver > > and I have no need for that. > > > Maybe its possible to generate Tcl stubs from the WSDL using a more > > recent Tcl and use those in the older interpreter? > > I could really use some advice at this point! > > Thanks in advance > > As the author of tWSDL, I understand your concerns. In fact, tWSDL was > designed to address these concerns. > > First: tWSDL is not dependent on AOLserver, it isn't even dependent on > Tcl 8.5+ features. I was very careful to avoid using any advanced > features because web services tend to be designed to leverage existing > code, not cutting edge code. If you look at the API there is a thin > interface between AOLserver and tWSDL. However, the TWiST API is even > more abstracted from AOLserver. A TWiST service runs with or without > AOLserver requiring no changes to the service configuration file. > > Second: A generic WSDL client does not work well in every situation. > In fact, it is almost guaranteed that any significant web service will > run into problems interacting with a generic client (unless the client > is tailored to the server). > > Third: Although tWSDL/TWiST does not have a client, each service > includes a web interface which generates client requests to the > server, somewhat like a proxy or even a protocol proxy (like SOCKS). > You could call this code example code for using the tWSDL API to > generate client requests. But you have to work to understand it. > Sorry. > > Fourth: There is some unfinished code for client development. At least > three different strategies are under development. One uses an XSL > transform to read a WSDL and create a web service (transforming into > tWSDL API calls). Another reads a WSDL into a Tcl structure and then > introspects the structure. The third is a redirected proxy server > where the target web service is replicated (manually) locally and > exposed as either a different type of web service or as a Tcl API > (this is very much patterned on the TWiST client). > > I can always help out with a specific request. You may regret saying that :) - just FYI, I haven't done any Tcl work since about 10 years ago - back at version 8.2, I think, so I'm pretty rusty, as you will shortly discover ... I was trying to dabble a bit with twist-0.9.10 and from the top level directory ran: > tclsh % package require tdom 0.8.3 % source init.tcl TWS:init.tcl Unable to find libnsd.so at /usr/share/tcltk/libnsd.so which was followed by around 700 lines of Notice TWS:, Debug TWS: and occasional Error TWS: invalid command name "ns_*" IIUC libnsd.so is from AOLserver, and provides all the ns_* commands? Is it possible to start this without all that info and without throwing the Errors? I suspect what I really need to know though is how to get packages/wsclient/www/get-wsdl.tcl or a variant thereof, to run from a command line, and without AOLserver (since it makes calls to ns_queryget, ns_httpsget, ns_httpget and ns_log), i.e. effectively the "Hello World" of tWSDL clients. Is there some basic or standard http communication library that might come with tcl that could replace those ns_* functions? Something from tDOM perhaps? A bare bones tutorial for building a minimal client, would be useful. e.g. do I need to source the top level init.tcl to load every tWSDL package to get a client running? And I'm guessing that get-wsdl.tcl follows strategy two from your Fourth point above? Actually, I don't need a "generic", dynamic client, so even if there was a WSDL mapping to some Tcl struct that I could make manually, and just update from time to time as the WSDL evolves, that would be a step in the right direction... Thanks again! All your advice and suggestions are greatly appreciated. cheers Doug
From: tom.rmadilo on 21 Jan 2010 02:08 On Jan 20, 10:01 pm, Doug du Boulay <doug.dubou...(a)gmail.com> wrote: > Hi Tom, > thanks for the lightning quick response! > > On Jan 21, 1:03 pm, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote: > > > > > On Jan 20, 4:56 pm, Doug du Boulay <doug.dubou...(a)gmail.com> wrote: > > > > Hi, > > > > I need to add a Web Service client to an existing project that uses an > > > embedded Tcl-8.4 interpreter. This project already has a dependency > > > on tDOM. > > > There is no likelihood to upgrade Tcl to 8.5 where, as I understand > > > it, the > > > "dict" type was introduced (and made heavy use of in tclws). > > > The server endpoint itself is actually a JDeveloper/Oracle based > > > service > > > that will be evolving. > > > > What I was hoping was that there would be a way to take the server's > > > WSDL > > > file and generate client side Tcl stubs that I could then use in the > > > project > > > I will be working with. Because of the existing tDOM dependence, I'm > > > guessing my best option for creating a client is either tSOAP or > > > tWSDL. > > > But tWSDL seems to be oriented towards running web services in an > > > AOLserver > > > and I have no need for that. > > > > Maybe its possible to generate Tcl stubs from the WSDL using a more > > > recent Tcl and use those in the older interpreter? > > > I could really use some advice at this point! > > > Thanks in advance > > > As the author of tWSDL, I understand your concerns. In fact, tWSDL was > > designed to address these concerns. > > > First: tWSDL is not dependent on AOLserver, it isn't even dependent on > > Tcl 8.5+ features. I was very careful to avoid using any advanced > > features because web services tend to be designed to leverage existing > > code, not cutting edge code. If you look at the API there is a thin > > interface between AOLserver and tWSDL. However, the TWiST API is even > > more abstracted from AOLserver. A TWiST service runs with or without > > AOLserver requiring no changes to the service configuration file. > > > Second: A generic WSDL client does not work well in every situation. > > In fact, it is almost guaranteed that any significant web service will > > run into problems interacting with a generic client (unless the client > > is tailored to the server). > > > Third: Although tWSDL/TWiST does not have a client, each service > > includes a web interface which generates client requests to the > > server, somewhat like a proxy or even a protocol proxy (like SOCKS). > > You could call this code example code for using the tWSDL API to > > generate client requests. But you have to work to understand it. > > Sorry. > > > Fourth: There is some unfinished code for client development. At least > > three different strategies are under development. One uses an XSL > > transform to read a WSDL and create a web service (transforming into > > tWSDL API calls). Another reads a WSDL into a Tcl structure and then > > introspects the structure. The third is a redirected proxy server > > where the target web service is replicated (manually) locally and > > exposed as either a different type of web service or as a Tcl API > > (this is very much patterned on the TWiST client). > > > I can always help out with a specific request. > > You may regret saying that :) > > - just FYI, I haven't done any Tcl work since about 10 years ago - > back at version 8.2, I think, so I'm pretty rusty, as you will shortly > discover ... > > I was trying to dabble a bit with twist-0.9.10 and from the top level > directory ran: > > > tclsh > > % package require tdom > 0.8.3 > % source init.tcl > TWS:init.tcl Unable to find libnsd.so at /usr/share/tcltk/libnsd.so > > which was followed by around 700 lines of Notice TWS:, Debug TWS: and > occasional Error TWS: invalid command name "ns_*" > > IIUC libnsd.so is from AOLserver, and provides all the ns_* commands? > > Is it possible to start this without all that info and without > throwing the Errors? Just redirect stderr to /dev/null. Unless you want to know why it isn't working, then the logging is somewhat helpful. > I suspect what I really need to know though is how to get > packages/wsclient/www/get-wsdl.tcl > or a variant thereof, to run from a command line, and without > AOLserver (since it makes calls to ns_queryget, ns_httpsget, > ns_httpget and ns_log), i.e. effectively the "Hello World" of tWSDL > clients. > Get the most recent version at: http://www.junom.com/gitweb/gitweb.perl?p=twsdl.git This version contains replacement procs for the ns_* commands, so you don't need AOLserver or libnsd, although it will take advantage of them if available. You should not need to load tDOM either, just use the tclsh which is associated with the tDOM installation. > A bare bones tutorial for building a minimal client, would be useful. > e.g. do I need to source the top level init.tcl to load every tWSDL > package to get a client running? That would be nice, wouldn't it. TWiST has a client built in, but it only POSTs back to itself. There is a somewhat developed wsclient: http://www.junom.com/gitweb/gitweb.perl?p=twsdl.git;a=tree;f=packages/wsclient In the www directory, look at get-wsdl2.tcl to see how to grab a wsdl file and start querying it. You will have to replace ns_httpget and ns_httpsget with something simple (<ws>return has an example). The example in get-wsdl2.tcl uses Google Adsense. Also in the www directory is a start at using <ws>client API, an extension of the TWiST API which will also serve as a proxy for web services. The client API configures an external endpoint...the target service. It could also be used to provide a defined WSDL for external services which don't provide one. Also, TWiST has a REST interface (just HTTP GET). It could be easier to write an simple application which creates the REST url, sends it to a TWiST service and redirect the POST request to an external client. Unfortunately none of this is finished since WS::Client seems to work well for many applications. I decided to focus on the server. Lemme know if you get stuck.
From: bobicanprogram on 21 Jan 2010 10:55 On Jan 20, 7:56 pm, Doug du Boulay <doug.dubou...(a)gmail.com> wrote: > Hi, > > I need to add a Web Service client to an existing project that uses an > embedded Tcl-8.4 interpreter. This project already has a dependency > on tDOM. > There is no likelihood to upgrade Tcl to 8.5 where, as I understand > it, the > "dict" type was introduced (and made heavy use of in tclws). > The server endpoint itself is actually a JDeveloper/Oracle based > service > that will be evolving. > > What I was hoping was that there would be a way to take the server's > WSDL > file and generate client side Tcl stubs that I could then use in the > project > I will be working with. Because of the existing tDOM dependence, I'm > guessing my best option for creating a client is either tSOAP or > tWSDL. > But tWSDL seems to be oriented towards running web services in an > AOLserver > and I have no need for that. > > Maybe its possible to generate Tcl stubs from the WSDL using a more > recent Tcl and use those in the older interpreter? > I could really use some advice at this point! > Thanks in advance > Doug If you can't find what you need in the existing Tcl/Tk webservices kits you may want to look at the "webservices lite" SIMPL toolkit (http://www.icanprogram.com/simpl). To my knowledge only C++ and Python have been used by SIMPL developers in a "webservices lite" mode. However, there is no reason that Tcl/Tk (which is well supported by the SIMPL toolkit) could not be used in a similar manner. bob
|
Pages: 1 Prev: writing a tWSDL/TWiST or TSOAP based client? Next: ftp package put -data option |