You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by du...@apache.org on 2007/07/27 10:53:19 UTC
svn commit: r560152 - in /webservices/axis2/scratch/c/dumindu/c:
axiom/src/attachments/mime_parser.c axiom/src/soap/soap_builder.c
samples/client/mtom/mtom_client.c samples/server/mtom/mtom.c
Author: dumindu
Date: Fri Jul 27 01:53:18 2007
New Revision: 560152
URL: http://svn.apache.org/viewvc?view=rev&rev=560152
Log:
Fixed the mtom bug in handling xop:Include
Modified:
webservices/axis2/scratch/c/dumindu/c/axiom/src/attachments/mime_parser.c
webservices/axis2/scratch/c/dumindu/c/axiom/src/soap/soap_builder.c
webservices/axis2/scratch/c/dumindu/c/samples/client/mtom/mtom_client.c
webservices/axis2/scratch/c/dumindu/c/samples/server/mtom/mtom.c
Modified: webservices/axis2/scratch/c/dumindu/c/axiom/src/attachments/mime_parser.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dumindu/c/axiom/src/attachments/mime_parser.c?view=diff&rev=560152&r1=560151&r2=560152
==============================================================================
--- webservices/axis2/scratch/c/dumindu/c/axiom/src/attachments/mime_parser.c (original)
+++ webservices/axis2/scratch/c/dumindu/c/axiom/src/attachments/mime_parser.c Fri Jul 27 01:53:18 2007
@@ -272,9 +272,9 @@
pos = memchr(old_pos, AXIOM_MIME_BOUNDARY_BYTE,
(mime_binary_len - (old_pos - mime_binary)));
if (!pos)
- {
+ {
break;
- }
+ }
else
{
old_pos = pos + 1;
@@ -294,9 +294,9 @@
mime_binary_len = pos - mime_binary;
}
else
- {
+ {
pos = NULL;
- }
+ }
}
if (!pos)
@@ -360,19 +360,19 @@
axis2_char_t *temp_type = NULL;
type += axutil_strlen(AXIOM_MIME_PARSER_CONTENT_TYPE);
while (type && *type && *type != ':')
- {
+ {
type++;
- }
+ }
type++;
while (type && *type && *type == ' ')
- {
+ {
type++;
- }
+ }
end = type;
while (end && *end && !isspace(*end))
- {
+ {
end++;
- }
+ }
if ((end - type) > 0)
{
temp_type = AXIS2_MALLOC(env->allocator,
@@ -413,9 +413,8 @@
data_handler = axiom_data_handler_create(env, NULL, type);
AXIS2_FREE(env->allocator, type);
-
axiom_data_handler_set_binary_data(data_handler, env,
- mime_binary, mime_binary_len);
+ mime_binary, mime_binary_len - 2);
axutil_hash_set(mime_parser->mime_parts_map, mime_id,
AXIS2_HASH_KEY_STRING, data_handler);
}
@@ -430,9 +429,9 @@
sprintf(temp_boundry, "%s", mime_boundary);
sprintf(temp_boundry, "%s", "--");
if (body_mime && axutil_strstr(body_mime, temp_boundry))
- {
+ {
break;
- }
+ }
}
Modified: webservices/axis2/scratch/c/dumindu/c/axiom/src/soap/soap_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dumindu/c/axiom/src/soap/soap_builder.c?view=diff&rev=560152&r1=560151&r2=560152
==============================================================================
--- webservices/axis2/scratch/c/dumindu/c/axiom/src/soap/soap_builder.c (original)
+++ webservices/axis2/scratch/c/dumindu/c/axiom/src/soap/soap_builder.c Fri Jul 27 01:53:18 2007
@@ -355,7 +355,7 @@
}
return ret_val;
}
-
+/*TODO:Fixme*/
static axis2_status_t
axiom_soap_builder_construct_node(axiom_soap_builder_t *soap_builder,
const axutil_env_t *env,
@@ -428,8 +428,14 @@
axiom_text_t *data_text = NULL;
axiom_node_t *data_om_node = NULL;
data_text = axiom_text_create_with_data_handler(
- env, om_element_node, data_handler, &data_om_node);
- axiom_text_set_optimize(data_text, env, AXIS2_FALSE);
+ env, om_element_node,
+ data_handler, &data_om_node);
+ axiom_text_set_optimize(data_text, env,
+ AXIS2_FALSE);
+
+ axiom_node_detach(om_element_node, env);
+ axiom_node_add_child(parent, env,
+ data_om_node);
}
}
}
Modified: webservices/axis2/scratch/c/dumindu/c/samples/client/mtom/mtom_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dumindu/c/samples/client/mtom/mtom_client.c?view=diff&rev=560152&r1=560151&r2=560152
==============================================================================
--- webservices/axis2/scratch/c/dumindu/c/samples/client/mtom/mtom_client.c (original)
+++ webservices/axis2/scratch/c/dumindu/c/samples/client/mtom/mtom_client.c Fri Jul 27 01:53:18 2007
@@ -20,6 +20,8 @@
#include <axis2_util.h>
#include <axiom_soap.h>
#include <axis2_client.h>
+#include <neethi_util.h>
+#include <neethi_policy.h>
axiom_node_t *
build_om_programatically(const axutil_env_t *env,
@@ -40,7 +42,9 @@
const axis2_char_t *image_name = "resources/axis2.jpg";
const axis2_char_t *to_save_name = "test.jpg";
axis2_bool_t optimized = AXIS2_TRUE;
-
+ axis2_char_t *file_name;
+ neethi_policy_t *policy = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
/* Set up the environment */
env = axutil_env_create_all("mtom.log", AXIS2_LOG_LEVEL_TRACE);
@@ -71,7 +75,7 @@
options = axis2_options_create(env);
axis2_options_set_to(options, env, endpoint_ref);
axis2_options_set_action(options, env,
- "http://ws.apache.org/axis2/c/samples/mtomSample");
+ "http://ws.apache.org/axis2/c/samples/mtom");
axis2_options_set_soap_version(options, env, AXIOM_SOAP11);
axis2_options_set_enable_mtom(options, env, AXIS2_TRUE);
@@ -97,6 +101,33 @@
AXIS2_ERROR_GET_MESSAGE(env->error));
return -1;
}
+
+ if (client_home)
+ {
+ file_name = axutil_stracat(env, client_home, AXIS2_PATH_SEP_STR);
+ file_name = axutil_stracat(env, file_name, "policy.xml");
+ }
+ else
+ {
+ printf("Client Home not Specified\n");
+ printf("echo client invoke FAILED!\n");
+ return 0;
+ }
+
+ policy = neethi_util_create_policy_from_file(env, file_name);
+
+ if(!policy)
+ {
+ printf("\nPolicy creation failed from the file. %s\n", file_name);
+ }
+
+ status = axis2_svc_client_set_policy(svc_client, env, policy);
+
+ if(status == AXIS2_FAILURE)
+ {
+ printf("Policy setting failed\n");
+ }
+
/* Set service client options */
axis2_svc_client_set_options(svc_client, env, options);
@@ -105,7 +136,10 @@
axis2_svc_client_engage_module(svc_client, env, AXIS2_MODULE_ADDRESSING);
/* Build the SOAP request message payload using OM API.*/
- payload = build_om_programatically(env, image_name, to_save_name, optimized);
+ payload = build_om_programatically(env, image_name, to_save_name,
+ AXIS2_TRUE/*optimized*/);
+
+ printf("payload: %s\n", axiom_node_to_string(payload, env));
/* Send request */
ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
@@ -175,7 +209,7 @@
data_handler = axiom_data_handler_create(env, image_name, "image/jpeg");
data_text = axiom_text_create_with_data_handler(env, image_om_node, data_handler, &data_om_node);
- axiom_text_set_optimize(data_text, env, optimized);
+ axiom_text_set_optimize(data_text, env, AXIS2_TRUE);
om_str = axiom_node_to_string(mtom_om_node, env);
if (om_str)
{
Modified: webservices/axis2/scratch/c/dumindu/c/samples/server/mtom/mtom.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dumindu/c/samples/server/mtom/mtom.c?view=diff&rev=560152&r1=560151&r2=560152
==============================================================================
--- webservices/axis2/scratch/c/dumindu/c/samples/server/mtom/mtom.c (original)
+++ webservices/axis2/scratch/c/dumindu/c/samples/server/mtom/mtom.c Fri Jul 27 01:53:18 2007
@@ -72,12 +72,12 @@
image_node = axiom_node_get_next_sibling(file_name_node, env);
if (image_node)
{
- axiom_node_t *inc_node = NULL;
+ /* axiom_node_t *inc_node = NULL;
inc_node = axiom_node_get_first_child(image_node, env);
if (inc_node)
- {
+ {*/
axiom_node_t *binary_node = NULL;
- binary_node = axiom_node_get_first_child(inc_node, env);
+ binary_node = axiom_node_get_first_child(image_node, env);
if (binary_node)
{
axiom_data_handler_t *data_handler = NULL;
@@ -90,27 +90,27 @@
axiom_data_handler_write_to(data_handler, env);
ret_node = build_om_programatically(env, text_str);
}
- }
- else /* attachment has come by value, as non-optimized binary */
- {
- axiom_text_t *bin_text = (axiom_text_t *)
- axiom_node_get_data_element(inc_node, env);
- int plain_binary_len = 0;
- axis2_byte_t *plain_binary = NULL;
- axiom_data_handler_t *data_handler = NULL;
-
- axis2_char_t *base64text = (axis2_char_t *)axiom_text_get_value(bin_text, env);
- printf("base64text = %s\n", base64text);
- plain_binary_len = axutil_base64_decode_len(base64text);
- plain_binary = AXIS2_MALLOC(env->
- allocator, sizeof(unsigned char) * plain_binary_len);
- axutil_base64_decode_binary((unsigned char*)plain_binary,
- base64text);
- data_handler = axiom_data_handler_create(env, text_str, NULL);
- axiom_data_handler_set_binary_data(data_handler, env, plain_binary, plain_binary_len);
- axiom_data_handler_write_to(data_handler, env);
- ret_node = build_om_programatically(env, text_str);
- }
+ else /* attachment has come by value, as non-optimized binary */
+ {
+ axiom_text_t *bin_text = (axiom_text_t *)
+ axiom_node_get_data_element(binary_node, env);
+ int plain_binary_len = 0;
+ axis2_byte_t *plain_binary = NULL;
+ axiom_data_handler_t *data_handler = NULL;
+
+ axis2_char_t *base64text = (axis2_char_t *)axiom_text_get_value(bin_text, env);
+ printf("base64text = %s\n", base64text);
+ plain_binary_len = axutil_base64_decode_len(base64text);
+ plain_binary = AXIS2_MALLOC(env->
+ allocator, sizeof(unsigned char) * plain_binary_len);
+ axutil_base64_decode_binary((unsigned char*)plain_binary,
+ base64text);
+ data_handler = axiom_data_handler_create(env, text_str, NULL);
+ axiom_data_handler_set_binary_data(data_handler, env, plain_binary, plain_binary_len);
+ axiom_data_handler_write_to(data_handler, env);
+ ret_node = build_om_programatically(env, text_str);
+ }
+ /* }*/
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org