The axiom data handler returns incorrect length
-----------------------------------------------

                 Key: AXIS2C-635
                 URL: https://issues.apache.org/jira/browse/AXIS2C-635
             Project: Axis2-C
          Issue Type: Bug
          Components: xml/om
         Environment: UNIX
            Reporter: Malinda Kaushalye Kapuruge


Call to axiom_data_handler_read_from(*****, length) returns incorrect value for 
the length.

When I send a message as follows[1] the content returns by the above method 
contains EOL characters. If the service echos the MIME content the response 
contains these characters. Here[2] is my server program.

[1]<soapenv:Envelope>...</soapenv:Envelope>
 --MIMEBoundary4b94e18e-2ade-1dc1-3b86-0010c6de319e

content-transfer-encoding: binary

content-id: <[EMAIL PROTECTED]>

content-type: application/octet-stream



[MY CONTENT]


--MIMEBoundary4b94e18e-2ade-1dc1-3b86-0010c6de319e--


[2]
axis2_mtom_mtom(const axutil_env_t *env, axiom_node_t *node)
{
    axiom_node_t *ret_node = NULL;
    axiom_node_t *array_node = NULL;
    AXIS2_ENV_CHECK(env, NULL);

    array_node = axiom_node_get_first_child(node, env);
    if(array_node){
        axiom_node_t *inc_node = NULL;
        inc_node = axiom_node_get_first_child(array_node, env);
        if(inc_node){
            axiom_node_t *binary_node = NULL;
            binary_node = axiom_node_get_first_child(inc_node, env);
            if(binary_node){
                axiom_data_handler_t *data_handler = NULL;
                axiom_text_t *bin_text = (axiom_text_t *)
                axiom_node_get_data_element(binary_node, env);
                data_handler = axiom_text_get_data_handler(bin_text, env);
                if (data_handler)
                {
                    axis2_char_t *text_str = NULL;
                    int length;
                    /*text_str = 
axiom_data_handler_get_content_type(data_handler, env);*/
                    /*text_str = 
axiom_data_handler_get_input_stream(data_handler, env);*/
                    axiom_data_handler_read_from(data_handler, env, &text_str, 
&length );
                    printf("Str[%d]= %s", length-2, text_str);
                    text_str[length-2]='\0';
                    ret_node = build_om_programatically(env, text_str);
                }

            }
        }
    }
    return ret_node;
}


/* Builds the response content */
axiom_node_t *
build_om_programatically(const axutil_env_t *env, axis2_char_t *text)
{
    axiom_node_t *mtom_om_node = NULL;
    axiom_element_t* mtom_om_ele = NULL;
    axiom_node_t *mtom2_om_node = NULL;
    axiom_element_t* mtom2_om_ele = NULL;
    axiom_namespace_t *ns1 = NULL;

    ns1 = axiom_namespace_create(env, "http://xmlsoap.org/Ping";, "ns1");

    mtom_om_ele = axiom_element_create(env, NULL, "EchoBinaryAsStringResponse", 
ns1, &mtom_om_node);
    mtom2_om_ele = axiom_element_create(env, mtom_om_node, 
"EchoBinaryAsStringResult", ns1, &mtom2_om_node);

    axiom_element_set_text(mtom2_om_ele, env, text, mtom2_om_node);

    return mtom_om_node;
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to