This page contains examples of how to use the „Web services for Tcl“ [L1 ] client side package. The package was created and is maintained by Gerald Lester, who also patiently provides support for ignorant users.
The client parses so-called wsdl files [L2 ]. From this file you get all the information you need:
You may also get the information from the documentation of the service, or by a tool like soapUI, or by the CreateStubs command of the package (see below).
The wsdl file contains the information in tags like
<wsdl:service name="country"> <wsdl:operation name="GetCountryByCountryCode"> <s:element name="GetCountryByCountryCode"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="CountryCode" type="s:string"/> </s:sequence> </s:complexType> </s:element>
Even those not familiar with wsdl can certainly identify the elements in this example (from the wsdl file "http://www.webservicex.net/country.asmx?WSDL ")
package require Tcl 8.5 package require WS::Client ::WS::Client::GetAndParseWsdl "http://www.webservicex.net/MortgageIndex.asmx?WSDL" # DoCall: get result as a nested dict set monthlyIndex [ ::WS::Client::DoCall MortgageIndex GetCurrentMortgageIndexMonthly {} ] set key [ dict keys $monthlyIndex ] flush stdout puts "Key: $key" foreach { i v } [ dict get $monthlyIndex $key ] { puts "$i $v" }
should return something like
Key: GetCurrentMortgageIndexMonthlyResult IndexDate 7/1/2004 OneYearConstantMaturityTreasury 2.1 ThreeYearConstantMaturityTreasury 3.05 FiveYearConstantMaturityTreasury 3.69 ThreeMonthTreasuryBill 1.36 SixMonthTreasuryBill 1.69 ThreeMonthSecondaryMarketCD 1.4625 SixMonthSecondaryMarketCD - EleventhDistrictCOFI 1.4929 CostOfSavingsIndex 1.6945 OneMonthLIBOR 1.9857 ThreeMonthLIBOR 2.4632 SixMonthLIBOR 1.1617 OneYearLIBOR 1.91 CostOfDepositsIndex 1.57 TwelveMonthTreasuryAverage 1.85