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 manoj dhyani <md...@hotmail.com> on 2013/02/13 21:55:43 UTC

axis2_svc_client_send_receive taking lot of memory

I am using Axis2c 1.6 

 

for one of the webservice the response is huge, the response XML is around 800 MB

while invoking this service from my Webservice Client which is using axis2c, the memory usage of th process goes to around 5 GB when axis2_svc_client_send_receive call is started

is their any way to tune this ? any options etc that can set on the client side

is their any way to stream the response to a file instead of caching in the memory, I do see a method to write to file (axiom_xml_writer_create), but that can be called after this call is done so that is not useful

 

following is the code, other thing is I am calling all the requierd free functions, but even after that the process memory doesn't go down is this a bug?

 

axiom_node_t * node = NULL;
node = axis2_svc_client_send_receive(_wsf_service_client, _env, firstChild);

if(node == NULL)
{
throw Error("Error");
}

if (axis2_svc_client_get_last_response_has_fault(_wsf_service_client, _env))
{
//handle fault

}
else
{
axis2_char_t* xmlreply = NULL;
axiom_xml_writer_t *xml_writer = NULL;
axiom_output_t* om_output = NULL;
xml_writer = axiom_xml_writer_create_for_memory(_env, NULL, AXIS2_TRUE, 0, AXIS2_XML_PARSER_TYPE_BUFFER);
om_output = axiom_output_create(_env, xml_writer);
axiom_namespace_t* ns_xsi =  axiom_namespace_create(_env, "http://www.w3.org/2001/XMLSchema-instance", "xsi");
axiom_element_t* node_ele  = (axiom_element_t*) axiom_node_get_data_element(node, _env);
axiom_element_declare_namespace_assume_param_ownership(node_ele, _env, ns_xsi);
axiom_node_serialize_sub_tree(node, _env, om_output);
xmlreply = (axis2_char_t*)axiom_xml_writer_get_xml(xml_writer, _env);
axiom_node_free_tree(node, _env);
}

if (om_output)
{
     axiom_output_free(om_output, env);
     om_output = NULL;
}

if (wsf_service_client)
{
axis2_svc_client_free(wsf_service_client, env);
wsf_service_client = NULL;
}

if(om_builder)
{
    axiom_stax_builder_free(om_builder, env);
om_builder = NULL;
}

if (env)
{
axutil_env_free((axutil_env_t *) env);
env = NULL;
}

 

Thanks and Regards

Manoj
 		 	   		  

AW: axis2_svc_client_send_receive taking lot of memory

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Use MTOM or SwA to transfer 800 MB chunked XML data. Best place it at
the server into a file and then use MTOM to catch it down to the client.
The question with large SOAP/XML maybe OM (Axiom) models is always, how
much data do you have to bring into memory to make your model work.

 

Also the archived AXIS2/C forums thread has some good notes on MTOM.

Josef 

 

------------- snipped of the archived mails ---------------

 

 

You may find some answers here

 

http://wso2.org/library/articles/sending-receiving-attachments-axis2-c
<http://wso2.org/library/articles/sending-receiving-attachments-axis2-c>


 

http://axis.apache.org/axis2/c/core/docs/axis2c_manual.html#mtom
<http://axis.apache.org/axis2/c/core/docs/axis2c_manual.html#mtom> 

 

thanks,

Dinesh

 

 

 

Von: manoj dhyani [mailto:mdhyani@hotmail.com] 
Gesendet: Mittwoch, 13. Februar 2013 21:56
An: c-dev@axis.apache.org; c-user@axis.apache.org
Betreff: axis2_svc_client_send_receive taking lot of memory

 

I am using Axis2c 1.6 
 
for one of the webservice the response is huge, the response XML is
around 800 MB
while invoking this service from my Webservice Client which is using
axis2c, the memory usage of th process goes to around 5 GB when
axis2_svc_client_send_receive call is started
is their any way to tune this ? any options etc that can set on the
client side
is their any way to stream the response to a file instead of caching in
the memory, I do see a method to write to file
(axiom_xml_writer_create), but that can be called after this call is
done so that is not useful
 
following is the code, other thing is I am calling all the requierd free
functions, but even after that the process memory doesn't go down is
this a bug?
 
axiom_node_t * node = NULL;
node = axis2_svc_client_send_receive(_wsf_service_client, _env,
firstChild);
if(node == NULL)
{
throw Error("Error");
}
if (axis2_svc_client_get_last_response_has_fault(_wsf_service_client,
_env))
{
//handle fault
}
else
{
axis2_char_t* xmlreply = NULL;
axiom_xml_writer_t *xml_writer = NULL;
axiom_output_t* om_output = NULL;
xml_writer = axiom_xml_writer_create_for_memory(_env, NULL, AXIS2_TRUE,
0, AXIS2_XML_PARSER_TYPE_BUFFER);
om_output = axiom_output_create(_env, xml_writer);
axiom_namespace_t* ns_xsi =  axiom_namespace_create(_env,
"http://www.w3.org/2001/XMLSchema-instance", "xsi");
axiom_element_t* node_ele  = (axiom_element_t*)
axiom_node_get_data_element(node, _env);
axiom_element_declare_namespace_assume_param_ownership(node_ele, _env,
ns_xsi);
axiom_node_serialize_sub_tree(node, _env, om_output);
xmlreply = (axis2_char_t*)axiom_xml_writer_get_xml(xml_writer, _env);
axiom_node_free_tree(node, _env);
}
if (om_output)
{
     axiom_output_free(om_output, env);
     om_output = NULL;
}
if (wsf_service_client)
{
axis2_svc_client_free(wsf_service_client, env);
wsf_service_client = NULL;
}
if(om_builder)
{
    axiom_stax_builder_free(om_builder, env);
om_builder = NULL;
}
if (env)
{
axutil_env_free((axutil_env_t *) env);
env = NULL;
}
 
Thanks and Regards
Manoj


axis2_http_client_connect_ssl_host() HTTP Protocol Version Hardcoded to 1.0 ?

Posted by manoj dhyani <md...@hotmail.com>.
I am running into a issue when connecting to a HTTPS webservice via certain proxy servers (like ASTARO) where connection is getting closed, the HTTP Protocol in Axis2.xml is set to HTTP/1.1

looking at the code, I see the following

Axis2c version 1.6.0

 

file - src\core\transport\http\sender\http_client.c

 

function - axis2_http_client_connect_ssl_host(

axis2_http_client_t * client,

const axutil_env_t * env,

axis2_char_t * host,

int port)

 

sprintf(connect_string, "CONNECT %s:%d HTTP/1.0\r\n\r\n", host, port);

axutil_stream_write(tmp_stream, env, connect_string,

axutil_strlen(connect_string) * sizeof(axis2_char_t));

 

why is this hardcoded ? is this by design or a bug ?

 

is there any way to keep the connection alive ? I tried passing Connection : Keep-Alive in the header but that is not working either

I haven't tried changing the hardcoded value from 1.0 to 1.1 not sure what will be the implication ?


 
 		 	   		  

axis2_http_client_connect_ssl_host() HTTP Protocol Version Hardcoded to 1.0 ?

Posted by manoj dhyani <md...@hotmail.com>.
I am running into a issue when connecting to a HTTPS webservice via certain proxy servers (like ASTARO) where connection is getting closed, the HTTP Protocol in Axis2.xml is set to HTTP/1.1

looking at the code, I see the following

Axis2c version 1.6.0

 

file - src\core\transport\http\sender\http_client.c

 

function - axis2_http_client_connect_ssl_host(

axis2_http_client_t * client,

const axutil_env_t * env,

axis2_char_t * host,

int port)

 

sprintf(connect_string, "CONNECT %s:%d HTTP/1.0\r\n\r\n", host, port);

axutil_stream_write(tmp_stream, env, connect_string,

axutil_strlen(connect_string) * sizeof(axis2_char_t));

 

why is this hardcoded ? is this by design or a bug ?

 

is there any way to keep the connection alive ? I tried passing Connection : Keep-Alive in the header but that is not working either

I haven't tried changing the hardcoded value from 1.0 to 1.1 not sure what will be the implication ?