[Vortex] xml-rpc-gen and code generation containing an array of
structs
Vincent AE Scott
aspl at gestic.ulat.es
Wed Mar 14 23:20:47 CET 2007
Hi there,
i've been playing around with the Vortex library and been trying out the
auto code generation tool xml-rpc-gen, but i think i've hit a problem
with it.
Using the following idl file:
xml-rpc interface ar {
/* struct declaration */
struct EventToken {
string tk_name;
string tk_value;
}
/* array declaration */
array EventTokenArray of EventToken;
int submit_new_event ( string Identifier, EventTokenArray event );
}
It all just about works when i send a "submit_new_event" to the server.
In short, the client is composing a "payload", using the following:
EventToken *ev_tok1 = NULL;
EventToken *ev_tok2 = NULL;
EventTokenArray *ev_arr = NULL;
ev_tok1 = ar_eventtoken_new( "TOKEN=1", "VALUE=1111111111" );
ev_tok2 = ar_eventtoken_new( "TOKEN=2", "VALUE=2222222222" );
ev_arr = ar_eventtokenarray_new( 2 );
ar_eventtokenarray_set( ev_arr, 1, ev_tok1 );
ar_eventtokenarray_set( ev_arr, 2, ev_tok2 );
...
ar_submit_new_event_string_eventtokenarray_s( "id1",
ev_arr, channel, &xml_resp, &fault_code, &fault_msg );
The problem lies ( i think ) within the server component when it comes
to decode the above message. What happens is it appears to be decoding
this incorrectly, from the log files on the server i see the following:
vortex-xml-rpc:proc 2750(debug): frame received on XML-RPC channel
vortex-xml-rpc:proc 2750(debug): invocation detected for:
submit_new_event, with 2 parameters
vortex-xml-rpc:proc 2750(debug): node name=<param>
vortex-xml-rpc:proc 2750(debug): node name(2)=<value>
vortex-xml-rpc:proc 2750(debug): received a value tag, containing a
<string>
vortex-xml-rpc:proc 2750(debug): received simple value='id1'
vortex-xml-rpc:proc 2750(debug): node name=<param>
vortex-xml-rpc:proc 2750(debug): node name(2)=<value>
vortex-xml-rpc:proc 2750(debug): received a value tag, containing a
<array>
vortex-xml-rpc:proc 2750(debug): received a complex value <array>
vortex-xml-rpc:proc 2750(debug): received a value tag, containing a
<none>
vortex-xml-rpc:proc 2750(debug): none value received
vortex-xml-rpc:proc 2750(debug): received a value tag, containing a
<struct>
vortex-xml-rpc:proc 2750(debug): received a complex value <struct>
vortex-xml-rpc:proc 2750(debug): parsing struct member name=tk_name
vortex-xml-rpc:proc 2750(debug): received a value tag, containing a
<string>
vortex-xml-rpc:proc 2750(debug): received simple value='TOKEN=1'
vortex-xml-rpc:proc 2750(debug): parsing struct member name=tk_value
vortex-xml-rpc:proc 2750(debug): received a value tag, containing a
<string>
vortex-xml-rpc:proc 2750(debug): received simple
value='VALUE=1111111111'
vortex-xml-rpc:proc 2750(debug): struct parsed: type 8
vortex-xml-rpc:proc 2750(debug): returning an array with (2) items
vortex-xml-rpc:proc 2750(debug): array parsed: type 9
vortex-xml-rpc:proc 2750(debug): method call name received:
submit_new_event (params 2), dispatching...
**** val[], type=5 ****
**** val[], type=9 ****
:proc 2750(critical): Expresion 'value->type == XML_RPC_STRUCT_VALUE'
have failed, returning: NULL at
vortex_xml_rpc_method_value_get_as_struct (vortex_xml_rpc_types.c:1774)
vortex-xml-rpc:proc 2750(debug): XML-RPC reply performed, sending it
back to the client
vortex-xml-rpc:proc 2750(debug): ok reply to be marshalled, type=2
vortex-channel:proc 2750(debug): sending reply for message 0 (size: 120)
The last (critical) message above appears to be coming from this
generated chunk of code on the server:
/* This is a support function to invoke 'submit_new_event' service , do
* not modify it!! */
XmlRpcMethodResponse * __submit_new_event_2_string_eventtokenarray
(XmlRpcMethodCall * method_call)
{
/* error support variables */
char * fault_error = NULL;
int fault_code = -1;
int result;
/* temporal variable declaration */
bool unmarshall_failure = FALSE;
EventTokenArray * event = ar_eventtokenarray_unmarshall (method_call_get_param_value_as_struct (method_call, 1), FALSE);
if (event == NULL)
unmarshall_failure = TRUE;
It would appear from the (****) debug i've put in that
method_call_get_param_value_as_struct() is being passed an array, when
its expecting a struct.
Have i missed something obvious in?
can anyone else confirm that xml-rpc-gen works OK for them with arrays
of structs?
I'll take a closer look again at this tomorrow when i get some more
time, and see if can figure out whats going on.
If anyone's got any hints/tips things to watch out for, i'd love to
hear.
Cheers,
-vince
--
keys: http://codex.net/gpg.asc
I love deadlines. I like the whooshing sound as they fly by.
-- Douglas Adams
More information about the Vortex
mailing list