| Author |
Soap and Complex Data
|
|
| dgeiselman 2007-02-23, 7:14 pm |
| I am trying to get a soap object using Complex data. I am fairly new
to TCL and I am having trouble finding answer to a problem I'm
having. Here is my typedefs for the soap
typedef { \
station_id DATA \
status DATA \
source DATA \
decision_date DATA \
} affiliatedecision
typedef { \
AffiliateDecision affiliatedecision \
} affiliates
typedef { \
DMRID DATA \
network DATA \
status DATA \
source DATA \
Affiliates affiliates \
} networkdecision
typedef { \
NetworkDecision networkdecision \
} networks
typedef { \
account DATA \
Networks networks \
update_time DATA \
User DATA \
} updateRequestStatus
and I am setting these with
set affiliatedec{station_id} [lindex $XMLArray 5]
set affiliatedec{status} [lindex $XMLArray 6]
set affiliatedec{source} [lindex $XMLArray 7]
set affiliatedec{decision_date} [lindex $XMLArray 8]}
set affiliate{AffiliateDecision} [array get affiliatedec]
set networkdec{DMRID} [lindex $XMLArray 1]
set networkdec{network} [lindex $XMLArray 2]
set networkdec{status} [lindex $XMLArray 3]
set networkdec{source} [lindex $XMLArray 4]
set networkdec{Affiliates} [array get affiliate]
set network{NetworkDecision} [array get networkdec]
set updateRequest{account} [lindex $XMLArray 0]
set updateRequest{Networks} [array get network]
set updateRequest{update_time} [lindex $XMLArray 9]
set updateRequest{User} [lindex $XMLArray 10]
And then creating a soap object with this example
SOAP::create Test -uri "http://localhost/" -proxy "http://localhost/" -
params {UpdateRequestStatus updateRequestStatus}
SOAP::configure Test -transport SOAP::Transport::print::print
Setting the soap object with
Test updateRequest
Now, I get all kinds of errors, one of which is
wrong # args: type updateRequestStatus contains " account DATA
Networks networks update_time DATA User DATA "
while executing
Can anyone possibly tell me what I am doing wrong so I can get this to
work in my tests so I can move on? I am unsure where I've gone wrong
in my code and like I said, I'm having difficulty finding examples
trying to do what I'm doing. Any help is appreciated.
Thanks
| |
|
| What simple SOAP calls have you used through Tcl? Are you building
off of known working knowledge or trying something you believe should
work? This seems like a lot of code to debug at one shot.
| |
| dgeiselman 2007-02-23, 7:14 pm |
| On Feb 23, 1:37 pm, "jkj" <k...@vexona.com> wrote:
> What simple SOAP calls have you used through Tcl? Are you building
> off of known working knowledge or trying something you believe should
> work? This seems like a lot of code to debug at one shot.
Well, the other issue is I'm not sure if the data is getting set into
my structures as well. This is what I think should work. I haven't
found too many simple examples for soap either.
| |
| dgeiselman 2007-02-26, 7:13 pm |
| I'm trying to write a little server that receives a Soap message like
this and then send out a reply Soap message. I get hung up on this
error below and I don't think I'll have the permissions to edit the
soap.tcl code on the servers.
wrong # args: type updateRequestStatus contains " account DATA
Networks networks update_time DATA User DATA "
while executing
"error "wrong # args: type $type contains \"$typeinfo\"""
(procedure "insert_value" line 86)
invoked from within
"insert_value $d_param [rpcvar $type $val]"
(procedure "::SOAP::soap_request" line 99)
invoked from within
"::SOAP::soap_request ::SOAP::_Test { account [lindex $XMLArray 0]
Networks { NetworkDecision { DMRID [lindex $XMLArray 1] network
[lindex $XMLArr..."
("eval" body line 1)
invoked from within
"eval "$procvar(wrapProc) $procVarName $args""
(procedure "::SOAP::invoke" line 14)
invoked from within
"::SOAP::invoke ::SOAP::_Test { account [lindex $XMLArray 0]
Networks { NetworkDecision { DMRID [lindex $XMLArray 1] network
[lindex $XMLArray 2] ..."
("eval" body line 1)
invoked from within
"eval ::SOAP::invoke ::SOAP::_Test $args"
(procedure "Test" line 1)
invoked from within
"Test { \
account [lindex $XMLArray 0] \
Networks { \
NetworkDecision { \
DMRID [lindex $XMLArray 1] \
network [lindex $XMLArray 2] \
stat..."
(file "./testsoap.tcl" line 69)
| |
| Christian Nassau 2007-02-26, 7:13 pm |
| dgeiselman wrote:
> I'm trying to write a little server that receives a Soap message like
> this and then send out a reply Soap message. I get hung up on this
> error below and I don't think I'll have the permissions to edit the
> soap.tcl code on the servers.
Ok, I've (slightly) changed my mind regarding the problematic error
check: it seems to me the code is simply checking whether all possible
fields are really given a value, so you might get it to work without
actually patching anything as long as your data is well formed.
From your error message it seems you've been trying something like
Test { \
account [lindex $XMLArray 0] \
Networks { \
<<stuff ommitted>>
} \
}
This will not work because the curly braces prevent substitution of the
values from XMLArray. You could try this instead:
# test data
set XMLArray {0 1 2 3 4 5 6 7 8 9 a b c d e f g h}
# first fill Tcl arrays from values
foreach {
stuff(account)
stuff(update_time)
stuff(User)
netdec(DMRID)
netdec(network)
netdec(status)
netdec(source)
affdec(status)
affdec(decision_date)
affdec(station_id)
affdec(source)
} $XMLArray break
# link affiliate dedision into network decision:
set netdec(Affiliates) [list AffiliateDecision [array get affdec]]
# link betwork decision into main data
set stuff(Networks) [list NetworkDecision [array get netdec]]
Test [array get stuff]
This gives me
<?xml version='1.0'?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns:Test
xmlns:ns="http://localhost/"><UpdateRequestStatus><Networks><NetworkDecision><Affiliates><AffiliateDecision><status>7</status><source>a</source><station_id>9</station_id><decision_date>8</decision_date></AffiliateDecision></Affiliates><status>5</status><D
MRID>3</DMRID><source>6</source><network>4</network></NetworkDecision></Networks><update_time>1</update_time><account>0</account><User>2</User></UpdateRequestStatus></ns:Test></SOAP-ENV:Body></SOAP-ENV:Envelope>
--
=> Christian Nassau, http://www.nullhomotopie.de
| |
| dgeiselman 2007-02-26, 7:13 pm |
| > # first fill Tcl arrays from values
> foreach {
> stuff(account)
> stuff(update_time)
> stuff(User)
> netdec(DMRID)
> netdec(network)
> netdec(status)
> netdec(source)
> affdec(status)
> affdec(decision_date)
> affdec(station_id)
> affdec(source)
>
> } $XMLArray break
>
Ok, maybe I'm just missing something. But is this supposed to be a
set for each of the different lines or is it something I have not
learned yet and I'm completly missing?
| |
| Christian Nassau 2007-02-26, 7:13 pm |
| dgeiselman wrote:
>
> Ok, maybe I'm just missing something. But is this supposed to be a
> set for each of the different lines or is it something I have not
> learned yet and I'm completly missing?
>
It's actually equivalent to a sequence of assignments like
set stuff(account_time) [lindex $XMLArray 0]
set stuff(update_time) [lindex $XMLArray 1]
... etc ...
[except that it's nicer to look at ;-) ]
--
=> Christian Nassau, http://www.nullhomotopie.de
| |
| dgeiselman 2007-02-26, 7:13 pm |
| Ok, that makes sense then. Next problem. My order is way off so I'm
trying to figure out how to make things the right order and a new
error has croped up.
unable to allocate parser context
while executing
"dom::DOMImplementation parse $xml"
(procedure "::SOAP::parse_soap_response" line 14)
invoked from within
"$parseProc $procVarName $reply"
(procedure "invoke2" line 17)
invoked from within
"invoke2 $procVarName $reply"
(procedure "::SOAP::invoke" line 25)
invoked from within
"::SOAP::invoke ::SOAP::_Test {update_time Networks {NetworkDecision
{status DMRID Affiliates {AffiliateDecision {stat..."
("eval" body line 1)
invoked from within
"eval ::SOAP::invoke ::SOAP::_Test $args"
(procedure "Test" line 1)
invoked from within
"Test [array get UpdateRequest]"
(file "./testsoap.tcl" line 97)
| |
| dgeiselman 2007-02-26, 7:13 pm |
| I figured out why my order is all out of whack. TCL pulls out of the
array unexpectedly.
| |
| dgeiselman 2007-02-26, 7:13 pm |
| I figured out why my order is all out of whack. TCL pulls data out of
the array in a unexpected way.
|
|
|
|