Web Services Definition Language
http://www.w3.org/TR/wsdl is the official definition for WSDL
Anyone taken the WSDL for google and written a Tcl binding, perhaps making use of TclSOAP?
A tDOM based WSDL tool is available at: [L1 ]
Name: | twsdl |
Who: | tom rmadilo |
Where: | http://code.google.com/p/twsdl/ http://junom.com/document/tWSDL/api-twist.html http://twsdl.googlecode.com/svn/trunk/ |
What: | Tcl API for building and accessing Web Services |
Description: | TWSDL uses the Web Services Description Language (WSDL 1.1) to define, impliment and access Web Services. TWSDL follows the interoperability guidelines found in the WS-I Basic Profile. |
LV Has anyone worked on, or discovered, tools to help generate web services discovery language WSDL files given some xml-rpc code? I inherited some non-Tcl code that provides a web service. I can read the code and understand what it does, but would love to find some kind of tool that would help create the WSDL.
GWL 10/18/2006 See WebServices for Tcl (aka 'TclWS).
"A Busy Developers Guide to WSDL 1.1" [L2 ]
A WSDL4TCL binding is available through http://oss.software.ibm.com/developerworks/opensource/wsdl4tcl .
escargo 05/05/05 - Trying to follow that link brought me to this:
So, although I would like to experiment with WSDL4TCL, I cannot until I can find the code somewhere.
CL has also been working on tying WSDL into TclSOAP.
escargo 14 Jul 2005 - Trying to follow that link brought me to an unrelated DeveloperWorks page.
lexfiend 13 Feb 2006 With the disappearance of WSDL4Tcl and the limitations of TclSOAP's WSDL parser (still under development at the time of this writing), I've devised an alternative approach to using WSDL files published by eBay et al. Basically, I run gSOAP [L3 ] on the WSDL file, then parameterize the sample XML files generated as a side-effect of that run. For example, to create a procedure that gets the official eBay time:
wsdl2h -c -o eBaySvc.h http://developer.ebay.com/webservices/latest/eBaySvc.wsdl
soapcpp2 eBaySvc.h
#!/usr/bin/env tclsh array set a { -uriBase https://api.sandbox.ebay.com/wsapi -appID <myAppID> -devID <myDevID> -certID <myAuthCert> -siteID 0 -APIversion 439 -authToken <myAuthToken> } if {$argc > 0} { array set a $argv } package require dom 2.0 package require SOAP package require SOAP::https package require tls http::register https 443 ::tls::socket package require rpcvar namespace import -force rpcvar::typedef # XML character mapping (thanks to David Gravereaux) # WARNING: May be incomplete variable entityMap [list & &\; < <\; > >\; \" "\;\ \u0000 �\; \u0001 \; \u0002 \; \u0003 \;\ \u0004 \; \u0005 \; \u0006 \; \u0007 \;\ \u0008 \; \u000b \; \u000c \; \u000d 
\;\ \u000e \; \u000f \; \u0010 \; \u0011 \;\ \u0012 \; \u0013 \; \u0014 \; \u0015 \;\ \u0016 \; \u0017 \; \u0018 \; \u0019 \;\ \u001A \; \u001B \; \u001C \; \u001D \;\ \u001E \; \u001F \;] proc entityEncode {text} { variable entityMap return [string map $entityMap $text] } proc mkServiceURI {svcName} { return "$::a(-uriBase)?callname=${svcName}&siteid=$::a(-siteID)&appid=$::a(-appID)&version=$::a(-APIversion)&routing=default" } # The XML below is ripped straight from the generated eBayAPISoapBinding.GeteBayOfficialTime.req.xml # I inserted variable references that will be [subst]ed when the request is sent array set xml { GeteBayOfficialTime {<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:ebay:apis:eBLBaseComponents"> <SOAP-ENV:Header> <ns1:RequesterCredentials> <ns1:eBayAuthToken>${eBayAuthToken}</ns1:eBayAuthToken> <ns1:Credentials> <ns1:AppId>${AppId}</ns1:AppId> <ns1:DevId>${DevId}</ns1:DevId> <ns1:AuthCert>${AuthCert}</ns1:AuthCert> </ns1:Credentials> </ns1:RequesterCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:GeteBayOfficialTimeRequest> <ns1:Version>${Version}</ns1:Version> </ns1:GeteBayOfficialTimeRequest> </SOAP-ENV:Body> </SOAP-ENV:Envelope>} } # Generic eBay XML generation procedure proc GeneBayXML {procVarName args} { set procName [lindex [split $procVarName {_}] end] foreach {key val} $args { set $key [entityEncode $val] } return [subst $::xml($procName)] } SOAP::create GeteBayOfficialTime \ -proxy [mkServiceURI GeteBayOfficialTime] \ -wrapProc GeneBayXML \ -params { AppId string DevId string AuthCert string eBayAuthToken string Version string } \ -action { } proc getEbayTime {} { return [GeteBayOfficialTime \ AppId $::a(-appID) DevId $::a(-devID) AuthCert $::a(-certID) \ eBayAuthToken $::a(-authToken) \ Version $::a(-APIversion)] } puts "getEbayTime = [getEbayTime]"
snichols 10 Mar 06. That's crafty what you did, but since you are not using an XML package to insert your XML values there's some potentials for problems. Such as values containing XML special characters that are not escaped. Your solution is a quick fix.
lexfiend 11 Mar 2006 - Good point. I can't think off-hand of any other issues than character-mapping, so I've added DG's entityEncode procedure from XML to the above code. Hope that works for you.
escargo 13 Feb 2006 - It is possible to use gSOAP and SWIG together to produce a binding between a webservice described by a WSDL file and a Tcl client. It is not necessarily easy; both SWIG and gSOAP make some assumptions in their respective Makefiles that require a hybrid Makefile that does all the stuff. The most painful part is getting the headers out of the gSOAP-generated code into a SWIG interface file. In the case where we tried it, 102 web service operations resulted in the creation of over 3000 new Tcl commands. So far as I know these were all loaded successfully with the shared library built by SWIG. Ultimately, this implementation did not meet all of our needs, so we abandoned it, but WSDL + gSOAP + SWIG can produce working Tcl-callable code.
lexfiend 13 Feb 2006 Yes, the breadth of the generated gSOAP interface by itself made me shy away from a SWIG approach (it might have been manageable with an under-10-call API like Google, but as you pointed out, even that might prove to be a pain). Another factor was the requirement to deploy the final code across several different platforms, so a pure-Tcl deployment solution (aside from perhaps TclDOM/C, though I might give TclDOM/Tcl a try) was much preferred.
escargo - The breadth of the interface, having to manage memory carefully, and the difficulting of deploying the final code across platforms were all issues weighing against the SWIG solution.
Byron Whitlock writes during Jan, 2005 on the tclxml mailing list:
"I've wrote a package that allows wsdl generation from Tcl SOAP. I hope someone finds this useful. http://www.geocities.com/blackboy9692002/tclsoap/
I based this off the 2.6 version of TCLDOM/TCLXML, (though it should work with 3.x, not tested)"
LV Unfortunately, geocities.com is no longer available.
We learn (among other ways) by reading the works of those who have gone before. Study working WSDL instances at
Analyze your WSDL at
See also tclsoap.
LV Any Tclers make use of the data mentioned at http://www.nws.noaa.gov/forecasts/xml/ to work up some Tcl weather applications?