You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Tony Hoyt <gm...@yahoo.com> on 2008/11/10 18:56:15 UTC
Axis2 Objects, Axiom and Serialization...
Okay, I'm workign with Axis2/C a lot lately. At the moment, I'm having a problem with converting my Axis2/C generated objects into a string and back. The problem is, I've managed to extract a string but, I'm not sure if I'm not deallocating the objects I'm creating correctly. Namely, when I call axiom_xml_writer_create_for_memory, should I call axiom_xml_writer_free?
I'm highly confused by all of this. Anyone can give me a hand? Recent examples I've been reading up on don't seem to offer a lot of good insight.
Here's the code I'm currently using to take my Axis2/C Generated structures and convert them into strings.
axis2_char_t *Output_XML( const axutil_env_t *env, axiom_node_t *root_node )
{
axiom_output_t *om_output;
axiom_xml_writer_t *xml_writer;
xml_writer = axiom_xml_writer_create_for_memory( env, NULL, AXIS2_FALSE, AXIS2_FALSE, AXIS2_XML_PARSER_TYPE_BUFFER );
if ( xml_writer )
{
om_output = axiom_output_create( env, xml_writer );
if ( om_output )
{
if ( axiom_node_serialize( root_node, env, om_output ) == AXIS2_SUCCESS)
{
return (axis2_char_t *)axiom_xml_writer_get_xml( xml_writer, env );
}
}
}
return NULL;
}
void serializeMyResponseObject( const axutil_env_t *env, adb_ResponseObj_t *msgResponse )
{
axis2_char_t *buffer = NULL;
axiom_node_t *root_node = NULL;
root_node = adb_ResponseObj_serialize( msgResponse, env, NULL, NULL, AXIS2_TRUE, NULL, NULL );
buffer = Output_XML( env, root_node );
printf("Group Response: \n%s\n", buffer);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org