WS::Client parameter question : TCL
This is a discussion on WS::Client parameter question within the TCL forums in Programming Languages category; I have a basic question regarding the WS::Client portion of Gerald Lester's Tcl Web Services package. I was able to get a simple service consumer working that only required a single parameter, but I'm having trouble with more complex types. For example, say I have a web service with the stub: : ets::registerPet {petOwner petInfo} where "petOwner" is a simple string and "petInfo" is a complex type of petType: petType {petName {type string comment {}} petSpecies {type string comment {}}} How would I consume such a service? When I try to set it up with: dict set args1 petOwner John ...
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| Lester's Tcl Web Services package. I was able to get a simple service consumer working that only required a single parameter, but I'm having trouble with more complex types. For example, say I have a web service with the stub: : ets::registerPet {petOwner petInfo}where "petOwner" is a simple string and "petInfo" is a complex type of petType: petType {petName {type string comment {}} petSpecies {type string comment {}}} How would I consume such a service? When I try to set it up with: dict set args1 petOwner John dict set args2 petName Fluffy dict set args2 petType Kitty : ets::registerPet $args1 $args2I don't get what I need - the XML doesn't contain all the values. I've also tried dot notation and a few other permutations but am having no luck, and feel I'm probably missing something basic... But I don't see any examples of complex input on the web pages I've searched. I tried setting up as arrays since I saw some "simple array" and "complex array" logic in the code, but haven't been able to figure it out. Thanks in advance! Wayland Augur |
|
#2
| |||
| |||
| wbaugur@landacorp.com wrote: > I have a basic question regarding the WS::Client portion of Gerald > Lester's Tcl Web Services package. I was able to get a simple service > consumer working that only required a single parameter, but I'm having > trouble with more complex types. For example, say I have a web service > with the stub: > > : ets::registerPet {petOwner petInfo}> where "petOwner" is a simple string and "petInfo" is a complex type of > petType: > > petType {petName {type string comment {}} petSpecies {type string > comment {}}} > > How would I consume such a service? When I try to set it up with: > > dict set args1 petOwner John > dict set args2 petName Fluffy > dict set args2 petType Kitty > : ets::registerPet $args1 $args2> > I don't get what I need - the XML doesn't contain all the values. I've > also tried dot notation and a few other permutations but am having no > luck, and feel I'm probably missing something basic... But I don't see > any examples of complex input on the web pages I've searched. I tried > setting up as arrays since I saw some "simple array" and "complex > array" logic in the code, but haven't been able to figure it out. You have it half right and half wrong! set arg1 John dict set args2 petName Fluffy dict set args2 petSpecies Kitty : ets::registerPet $args1 $args2That being said, I actual tend not to use the stubs myself but rather the ::WS::Client: oCalls. The equivalent call would be:dict set inputDict petOwner John dict set inputDict petType petName Fluffy dict set inputDict petType petSpecies Kitty ::WS::Client: oCalls pet registerPet $inputDictNot sure why I do not use the stubs, but I don't. -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+ |
|
#3
| |||
| |||
| On Jan 23, 12:35 pm, "Gerald W. Lester" <Gerald.Les...@cox.net> wrote: > wbau...@landacorp.com wrote: > > I have a basic question regarding the WS::Client portion of Gerald > > Lester's Tcl Web Services package. I was able to get a simple service > > consumer working that only required a single parameter, but I'm having > > trouble with more complex types. For example, say I have a web service > > with the stub: > > > : ets::registerPet {petOwner petInfo}> > where "petOwner" is a simple string and "petInfo" is a complex type of > > petType: > > > petType {petName {type string comment {}} petSpecies {type string > > comment {}}} > > > How would I consume such a service? When I try to set it up with: > > > dict set args1 petOwner John > > dict set args2 petName Fluffy > > dict set args2 petType Kitty > > : ets::registerPet $args1 $args2> > > I don't get what I need - the XML doesn't contain all the values. I've > > also tried dot notation and a few other permutations but am having no > > luck, and feel I'm probably missing something basic... But I don't see > > any examples of complex input on the web pages I've searched. I tried > > setting up as arrays since I saw some "simple array" and "complex > > array" logic in the code, but haven't been able to figure it out. > > You have it half right and half wrong! > > set arg1 John > dict set args2 petName Fluffy > dict set args2 petSpecies Kitty > : ets::registerPet $args1 $args2> > That being said, I actual tend not to use the stubs myself but rather the > ::WS::Client: oCalls. The equivalent call would be:> dict set inputDict petOwner John > dict set inputDict petType petName Fluffy > dict set inputDict petType petSpecies Kitty > ::WS::Client: oCalls pet registerPet $inputDict> > Not sure why I do not use the stubs, but I don't. > > -- > +--------------------------------+---------------------------------------+ > | Gerald W. Lester | > |"The man who fights for his ideals is the man who is alive." - Cervantes| > +------------------------------------------------------------------------+ On Jan 23, 12:35 pm, "Gerald W. Lester" <Gerald.Les...@cox.net> wrote: > wbau...@landacorp.com wrote: > > I have a basic question regarding the WS::Client portion of Gerald > > Lester's Tcl Web Services package. I was able to get a simple service > > consumer working that only required a single parameter, but I'm having > > trouble with more complex types. For example, say I have a web service > > with the stub: > > > : ets::registerPet {petOwner petInfo}> > where "petOwner" is a simple string and "petInfo" is a complex type of > > petType: > > > petType {petName {type string comment {}} petSpecies {type string > > comment {}}} > > > How would I consume such a service? When I try to set it up with: > > > dict set args1 petOwner John > > dict set args2 petName Fluffy > > dict set args2 petType Kitty > > : ets::registerPet $args1 $args2> > > I don't get what I need - the XML doesn't contain all the values. I've > > also tried dot notation and a few other permutations but am having no > > luck, and feel I'm probably missing something basic... But I don't see > > any examples of complex input on the web pages I've searched. I tried > > setting up as arrays since I saw some "simple array" and "complex > > array" logic in the code, but haven't been able to figure it out. > > You have it half right and half wrong! > > set arg1 John > dict set args2 petName Fluffy > dict set args2 petSpecies Kitty > : ets::registerPet $args1 $args2> > That being said, I actual tend not to use the stubs myself but rather the > ::WS::Client: oCalls. The equivalent call would be:> dict set inputDict petOwner John > dict set inputDict petType petName Fluffy > dict set inputDict petType petSpecies Kitty > ::WS::Client: oCalls pet registerPet $inputDict> > Not sure why I do not use the stubs, but I don't. > > -- > +--------------------------------+---------------------------------------+ > | Gerald W. Lester | > |"The man who fights for his ideals is the man who is alive." - Cervantes| > +------------------------------------------------------------------------+ Thanks for the quick response, Gerald! I had actually tried that earlier on... There must be something odd with my setup, as it still doesn't seem to be working for me. The generated XML is still missing an element (I had to resort to adding "puts" in ClientSide.Tcl). What I get is missing the "petName" element. Here it is (without the SOAP header which is pretty huge as it actually provides a lot of services... as you may have guessed it's not really about pets, I'm having to change the names to protect the innocent as this is a company project): % dict set inputDict petOwner John petOwner John % dict set inputDict petType petName Fluffy petOwner John petType {petName Fluffy} % dict set inputDict petType petSpecies Kitty petOwner John petType {petSpecies Kitty petName Fluffy} % ::WS::Client: oCall pet registerPet $inputDict.. .. .. <SOAP-ENV:Body> <tns17 et><tns17 etOwner>John</tns17 etOwner><tns17 etType><tns26 etSpecies>Kitty</tns26 etSpecies></tns17 etType></tns17 et></SOAP-ENV:Body> I actually took a step back and reinstalled everything in Tcl 8.4 (what we currently use / distribute) using MINGW/MSYS and got the same results there. Yesterday I had traced the problem down to where the "Non-simple non-array" gets processed... only the last element seemed to be getting set up there. - Wayland Augur |
|
#4
| |||
| |||
| wbaugur@landacorp.com wrote: > Thanks for the quick response, Gerald! I had actually tried that > earlier on... > > There must be something odd with my setup, as it still doesn't seem to > be working for me. The generated XML is still missing an element (I > had to resort to adding "puts" in ClientSide.Tcl). > > What I get is missing the "petName" element. Here it is (without the > SOAP header which is pretty huge as it actually provides a lot of > services... as you may have guessed it's not really about pets, I'm > having to change the names to protect the innocent as this is a > company project): > > % dict set inputDict petOwner John > petOwner John > % dict set inputDict petType petName Fluffy > petOwner John petType {petName Fluffy} > % dict set inputDict petType petSpecies Kitty > petOwner John petType {petSpecies Kitty petName Fluffy} > % ::WS::Client: oCall pet registerPet $inputDict> . > . > . > <SOAP-ENV:Body> > <tns17 et>> <tns17 etOwner>John</tns17 etOwner>> <tns17 etType>> <tns26 etSpecies>Kitty</tns26 etSpecies>> </tns17 etType>> </tns17 et>> </SOAP-ENV:Body> Can you email me the WSDL to take a look at (or the URL of the WSDL)? -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+ |


ets::registerPet {petOwner petInfo}
oCalls. The equivalent call would be: