Minor correction in the code below (I merged two functions) ...

On Thu, 2011-01-27 at 13:03 +0100, Thomas Gentsch wrote:
> Hi all,
> 
> I'm still with Axis2c 1.6 and have a problem (de)serializing an XML
> string. Is there anything know about such a problem (haven't found
> anything in Jira)?
> 
> The essential piece is a string buffer containing an XML structure,
> which is created from a Tuscany SDO. Then that string buffer gets
> converted to an Axiom Node (using the Tuscany AxiomHelper) to be
> returned to the calling Axis2c client. Normally this works nicely, but
> if the XML is very long (in my example 484460 bytes), it gets truncated.
> 
> I can see the string buffer "str" (below) as still intact. Then,
> essentially the following happens:
> ===========
> AxiomHelper::toAxiomNode()
> {
> ...
> axiom_xml_reader_t * reader =
> axiom_xml_reader_create_for_memory(
>   the_env, (void*)str, strlen(str),
>   (const axis2_char_t *)"UTF-8", AXIS2_XML_PARSER_TYPE_BUFFER);
> axiom_stax_builder_t* builder =
>   axiom_stax_builder_create(the_env, reader);
> axiom_document_t* document =
>   axiom_stax_builder_get_document(builder, the_env);
> axiom_node_t* root_node =
>   axiom_document_get_root_element(document, the_env);
> axiom_document_build_all(document, the_env);

The code above is function1 and returns "document".
Below is function2 dealing with that document.

> axiom_node_t* root_node =
>   axiom_document_get_root_element(doc, the_env);
> return  root_node;
> }
> 
> Now I have the Axiom node "n" and dump it (just for testing):
> 
> axiom_xml_writer_t * w = axiom_xml_writer_create_for_memory(env,
>   NULL, AXIS2_TRUE, 0, AXIS2_XML_PARSER_TYPE_BUFFER);
> axiom_output_t * om_output = axiom_output_create(env, w);
> axiom_node_serialize(n, env, om_output);
> axis2_char_t * buf = (axis2_char_t *) axiom_xml_writer_get_xml(w, env);
> 
> fprintf(f, "\nData: '%s'\n", buf);
> =============
> 
> and the output is truncated to 17253 bytes ending with some control
> characters.
> As said, that code has been working for months/years now w/o any
> problems, so I believe that it is OK in general and I rather suspect the
> Axis2c XML handling in conjunction with large buffers ...
> 
> I'll extract the pieces into a standalone testprog for easier
> troubleshooting - but still: Any ideas?
> 
> Many thx!!!
>   tge
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: c-user-unsubscr...@axis.apache.org
For additional commands, e-mail: c-user-h...@axis.apache.org

Reply via email to