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 sa...@apache.org on 2006/05/16 10:29:56 UTC
svn commit: r406873 - in /webservices/axis2/trunk/c: include/axis2_stub.h
modules/core/clientapi/stub.c samples/client/math/axis2_math_stub.c
samples/client/math/axis2_math_stub.h samples/client/math/math_client.c
Author: samisa
Date: Tue May 16 01:29:54 2006
New Revision: 406873
URL: http://svn.apache.org/viewcvs?rev=406873&view=rev
Log:
Adding patches by Dimuthu to drop call from stub and include service client
Modified:
webservices/axis2/trunk/c/include/axis2_stub.h
webservices/axis2/trunk/c/modules/core/clientapi/stub.c
webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.c
webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.h
webservices/axis2/trunk/c/samples/client/math/math_client.c
Modified: webservices/axis2/trunk/c/include/axis2_stub.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_stub.h?rev=406873&r1=406872&r2=406873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_stub.h (original)
+++ webservices/axis2/trunk/c/include/axis2_stub.h Tue May 16 01:29:54 2006
@@ -18,7 +18,8 @@
#define AXIS2_STUB_H
#include <axis2_endpoint_ref.h>
-#include <axis2_call.h>
+#include <axis2_svc_client.h>
+#include <axis2_options.h>
#include <axis2_xml_reader.h>
#include <axis2_property.h>
@@ -38,13 +39,13 @@
* @ingroup axis2_core_clientapi
* @{
*/
-
-typedef struct axis2_stub_ops axis2_stub_ops_t;
-typedef struct axis2_stub axis2_stub_t;
#define AXIS2_SOAP_11 0
#define AXIS2_SOAP_12 1
+typedef struct axis2_stub_ops axis2_stub_ops_t;
+typedef struct axis2_stub axis2_stub_t;
+
AXIS2_DECLARE_DATA struct axis2_stub_ops
{
axis2_status_t (AXIS2_CALL *
@@ -64,44 +65,14 @@
/**
*
- * @param sender_transport
- * @param listener_transport
* @param use_separate_transport
*/
axis2_status_t (AXIS2_CALL *
- set_transport_info)(axis2_stub_t *stub,
+ set_use_seperate_listener)(axis2_stub_t *stub,
axis2_env_t **env,
- axis2_char_t *sender_transport,
- axis2_char_t *listener_transport,
axis2_bool_t use_separate_listener);
/**
- *
- * @param key
- * @param value
- */
- axis2_status_t (AXIS2_CALL *
- put)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_char_t *key,
- axis2_property_t *value);
-
- /**
- *
- * @param key
- * @return the object
- */
- axis2_property_t *(AXIS2_CALL *
- get)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_char_t *key);
-
- axis2_status_t (AXIS2_CALL *
- engage_module)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_char_t *module_name);
-
- /**
* Set the soap version
* @param soap_version
*/
@@ -110,49 +81,25 @@
axis2_env_t **env,
int soap_version);
+
axis2_char_t *(AXIS2_CALL *
get_svc_ctx_id)(axis2_stub_t *stub,
axis2_env_t **env);
- axis2_om_node_t *(AXIS2_CALL *
- get_element_from_reader)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_xml_reader_t *reader);
-
-
axis2_status_t (AXIS2_CALL *
- set_value_doc)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_soap_envelope_t *envelope,
- axis2_om_node_t *value,
- axis2_bool_t is_header);
+ engage_module)(axis2_stub_t *stub,
+ axis2_env_t **env,
+ axis2_char_t *module_name);
- /**
- * Extract the correct element - A util method
- * @param env
- * @param type
- * @return the relevant element to be databound
- */
- axis2_om_node_t *(AXIS2_CALL *
- get_element)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_soap_envelope_t *envelope,
- axis2_char_t *type);
+ axis2_svc_client_t *(AXIS2_CALL *
+ get_svc_client)(axis2_stub_t *stub,
+ axis2_env_t **env);
- axis2_status_t (AXIS2_CALL *
- populate_properties)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_call_t *call);
-
- axis2_status_t (AXIS2_CALL *
- populate_modules)(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_call_t *call);
-
- axis2_call_t *(AXIS2_CALL *
- get_call_obj)(axis2_stub_t *stub,
+ axis2_options_t *(AXIS2_CALL *
+ get_options)(axis2_stub_t *stub,
axis2_env_t **env);
+
} ;
AXIS2_DECLARE_DATA struct axis2_stub
@@ -191,43 +138,23 @@
#define AXIS2_STUB_SET_ENDPOINT_URI(stub, env, endpoint_uri) \
((stub)->ops->set_endpoint_uri (stub, env, endpoint_uri))
-#define AXIS2_STUB_SET_TRANSPORT_INFO(stub, env, sender_transport, listener_transport, \
- use_separate_listener) \
- ((stub)->ops->set_transport_info (stub, env, sender_transport, \
- listener_transport, use_separate_listener))
-
-#define AXIS2_STUB_PUT(stub, env, key, value) \
- ((stub)->ops->put (stub, env, key, value))
-
-#define AXIS2_STUB_GET(stub, env, key) \
- ((stub)->ops->get (stub, env, key))
+#define AXIS2_STUB_SET_USE_SEPERATE_LISTENER(stub, env, use_separate_listener) \
+ ((stub)->ops->set_transport_info (stub, env, use_separate_listener))
#define AXIS2_STUB_ENGAGE_MODULE(stub, env, module_name) \
((stub)->ops->engage_module (stub, env, module_name))
#define AXIS2_STUB_SET_SOAP_VERSION(stub, env, soap_version) \
((stub)->ops->set_soap_version (stub, env, soap_version))
-
+
#define AXIS2_STUB_GET_SVC_CTX_ID(stub, env) \
((stub)->ops->get_svc_ctx_id (stub, env))
-#define AXIS2_STUB_GET_ELEMENT_FROM_READER(stub, env, reader) \
- ((stub)->ops->get_element_from_reader (stub, env, reader))
-
-#define AXIS2_STUB_SET_VALUE_DOC(stub, env, envelope, value, is_header) \
- ((stub)->ops->set_value_doc (stub, env, envelope, value, is_header))
-
-#define AXIS2_STUB_GET_ELEMENT(stub, env, envelope, type) \
- ((stub)->ops->get_element (stub, env, envelope, type))
-
-#define AXIS2_STUB_POPULATE_PROPERTIES(stub, env, call) \
- ((stub)->ops->populate_properties (stub, env, call))
-
-#define AXIS2_STUB_POPULATE_MODULES(stub, env, call) \
- ((stub)->ops->populate_modules (stub, env, call))
+#define AXIS2_STUB_GET_SVC_CLIENT(stub, env) \
+ ((stub)->ops->get_svc_client(stub, env))
-#define AXIS2_STUB_GET_CALL_OBJ(stub, env) \
- ((stub)->ops->get_call_obj (stub, env))
+#define AXIS2_STUB_GET_OPTIONS(stub, env) \
+ ((stub)->ops->get_options(stub, env))
/** @} */
Modified: webservices/axis2/trunk/c/modules/core/clientapi/stub.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/stub.c?rev=406873&r1=406872&r2=406873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/stub.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/stub.c Tue May 16 01:29:54 2006
@@ -15,44 +15,16 @@
*/
#include <axis2_stub.h>
-#include <axis2_http_transport.h>
-#include <axis2_wsdl_svc.h>
-#include <axis2_om_stax_builder.h>
-#include <axis2_soap_header.h>
-#include <axis2_soap_body.h>
-#include <axis2_uuid_gen.h>
/**
* @brief
*/
typedef struct axis2_stub_impl
{
- axis2_stub_t stub;
+ axis2_stub_t stub;
- axis2_call_t *call;
-
- axis2_conf_ctx_t *conf_ctx;
- axis2_svc_t *svc;
- axis2_svc_ctx_t *svc_ctx;
- axis2_endpoint_ref_t *to_epr;
- axis2_bool_t do_rest;
- axis2_char_t *sender_transport;
- axis2_char_t *listener_transport;
- axis2_bool_t use_separate_listener;
- /*Default SOAP version is 11 */
- int soap_version;
- axis2_hash_t *property_map;
- axis2_array_list_t *modules;
- /**
- * If _maintainSession is set to True all the calls will use the same
- * ServiceContext and the user can Share information through that
- * ServiceContext across operations.
- */
- axis2_bool_t maintain_session;
- axis2_char_t *current_session_id;
-
- /* keep track of locally created endpoint to free it*/
- axis2_endpoint_ref_t *endpoint_ref;
+ axis2_svc_client_t *svc_client;
+ axis2_options_t *options;
} axis2_stub_impl_t;
@@ -76,38 +48,13 @@
axis2_char_t *endpoint_uri);
/**
- *
- * @param sender_transport
- * @param listener_transport
* @param use_separate_transport
*/
-axis2_status_t AXIS2_CALL
-axis2_stub_set_transport_info(axis2_stub_t *stub,
+axis2_status_t AXIS2_CALL //set use_seperate_listener
+axis2_stub_set_use_seperate_listener(axis2_stub_t *stub,
axis2_env_t **env,
- axis2_char_t *sender_transport,
- axis2_char_t *listener_transport,
axis2_bool_t use_separate_listener);
-/**
- *
- * @param key
- * @param value
- */
-axis2_status_t AXIS2_CALL
-axis2_stub_put(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_char_t *key,
- axis2_property_t *value);
-
-/**
- *
- * @param key
- * @return the object
- */
-axis2_property_t *AXIS2_CALL
-axis2_stub_get(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_char_t *key);
axis2_status_t AXIS2_CALL
axis2_stub_engage_module(axis2_stub_t *stub,
@@ -123,51 +70,17 @@
axis2_env_t **env,
int soap_version);
+
axis2_char_t *AXIS2_CALL
axis2_stub_get_svc_ctx_id(axis2_stub_t *stub,
axis2_env_t **env);
-axis2_char_t *
-axis2_stub_get_id(axis2_stub_t *stub,
+axis2_svc_client_t *AXIS2_CALL
+axis2_stub_get_svc_client(axis2_stub_t *stub,
axis2_env_t **env);
-axis2_om_node_t *AXIS2_CALL
-axis2_stub_get_element_from_reader(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_xml_reader_t *reader);
-
-
-axis2_status_t AXIS2_CALL
-axis2_stub_set_value_doc(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_soap_envelope_t *envelope,
- axis2_om_node_t *value,
- axis2_bool_t is_header);
-
-/**
- * Extract the correct element - A util method
- * @param env
- * @param type
- * @return the relevant element to be databound
- */
-axis2_om_node_t *AXIS2_CALL
-axis2_stub_get_element(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_soap_envelope_t *envelope,
- axis2_char_t *type);
-
-axis2_status_t AXIS2_CALL
-axis2_stub_populate_properties(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_call_t *call);
-
-axis2_status_t AXIS2_CALL
-axis2_stub_populate_modules(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_call_t *call);
-
-axis2_call_t *AXIS2_CALL
-axis2_stub_get_call_obj(axis2_stub_t *stub,
+axis2_options_t *AXIS2_CALL
+axis2_stub_get_options(axis2_stub_t *stub,
axis2_env_t **env);
/************************** End of function prototypes ************************/
@@ -176,89 +89,42 @@
axis2_stub_create (axis2_env_t **env)
{
axis2_stub_impl_t *stub_impl = NULL;
-
- AXIS2_ENV_CHECK(env, NULL);
-
- stub_impl = (axis2_stub_impl_t *) AXIS2_MALLOC((*env)->
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ stub_impl = (axis2_stub_impl_t *) AXIS2_MALLOC((*env)->
allocator, sizeof(axis2_stub_impl_t));
-
- if(NULL == stub_impl)
+
+ if(NULL == stub_impl)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
-
- stub_impl->call = NULL;
- stub_impl->conf_ctx = NULL;
- stub_impl->svc = NULL;
- stub_impl->svc_ctx = NULL;
- stub_impl->to_epr = NULL;
- stub_impl->do_rest = AXIS2_FALSE;
- stub_impl->sender_transport = NULL;
- stub_impl->listener_transport = NULL;
- stub_impl->use_separate_listener = AXIS2_FALSE;
- /* Default SOAP version is 11 */
- stub_impl->soap_version = AXIS2_SOAP_11;
- stub_impl->property_map = NULL;
- stub_impl->modules = NULL;
- stub_impl->maintain_session = AXIS2_FALSE;
- stub_impl->current_session_id = NULL;
+ stub_impl->svc_client = NULL;
+ stub_impl->options = NULL;
+
stub_impl->stub.ops = NULL;
- stub_impl->endpoint_ref = NULL;
- stub_impl->sender_transport = AXIS2_STRDUP(AXIS2_TRANSPORT_HTTP, env);
- if(!stub_impl->sender_transport)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
- stub_impl->listener_transport = AXIS2_STRDUP(AXIS2_TRANSPORT_HTTP, env);
- if(!stub_impl->sender_transport)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
-
- stub_impl->property_map = axis2_hash_make(env);
- if(!stub_impl->property_map)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
-
- stub_impl->modules = axis2_array_list_create(env, 0);
- if(!stub_impl->modules)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
-
- stub_impl->stub.ops =
+ stub_impl->stub.ops =
AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_stub_ops_t));
- if(NULL == stub_impl->stub.ops)
+ if(NULL == stub_impl->stub.ops)
{
axis2_stub_free(&(stub_impl->stub), env);
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- stub_impl->stub.ops->free = axis2_stub_free;
+ stub_impl->stub.ops->free = axis2_stub_free;
stub_impl->stub.ops->set_endpoint_ref = axis2_stub_set_endpoint_ref;
stub_impl->stub.ops->set_endpoint_uri = axis2_stub_set_endpoint_uri;
- stub_impl->stub.ops->set_transport_info = axis2_stub_set_transport_info;
- stub_impl->stub.ops->put = axis2_stub_put;
- stub_impl->stub.ops->get = axis2_stub_get;
+ stub_impl->stub.ops->set_use_seperate_listener = axis2_stub_set_use_seperate_listener;
stub_impl->stub.ops->engage_module = axis2_stub_engage_module;
stub_impl->stub.ops->set_soap_version = axis2_stub_set_soap_version;
stub_impl->stub.ops->get_svc_ctx_id = axis2_stub_get_svc_ctx_id;
- stub_impl->stub.ops->get_element_from_reader =
- axis2_stub_get_element_from_reader;
- stub_impl->stub.ops->set_value_doc = axis2_stub_set_value_doc;
- stub_impl->stub.ops->get_element = axis2_stub_get_element;
- stub_impl->stub.ops->populate_properties = axis2_stub_populate_properties;
- stub_impl->stub.ops->populate_modules = axis2_stub_populate_modules;
- stub_impl->stub.ops->get_call_obj = axis2_stub_get_call_obj;
- return &(stub_impl->stub);
+ stub_impl->stub.ops->get_svc_client= axis2_stub_get_svc_client;
+ stub_impl->stub.ops->get_options= axis2_stub_get_options;
+
+ return &(stub_impl->stub);
}
AXIS2_DECLARE(axis2_stub_t *)
@@ -267,28 +133,40 @@
axis2_char_t *client_home)
{
axis2_stub_impl_t *stub_impl = NULL;
-
- AXIS2_ENV_CHECK(env, NULL);
+
+ AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK((*env)->error, endpoint_ref, NULL);
stub_impl = (axis2_stub_impl_t *) axis2_stub_create(env);
if(!stub_impl)
{
- axis2_stub_free(&(stub_impl->stub), env);
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- /* create call without passing svc_ctx_t struct */
- stub_impl->call = axis2_call_create(env, NULL,
- client_home);
+ /* create service_client*/
+ stub_impl->svc_client = axis2_svc_client_create(env , client_home );
- if(!stub_impl->call)
+ if(!stub_impl->svc_client )
{
axis2_stub_free(&(stub_impl->stub), env);
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- AXIS2_CALL_SET_TO(stub_impl->call, env, endpoint_ref);
+ /* create options */
+ stub_impl->options = axis2_options_create(env );
+ if (!stub_impl->options )
+ {
+ axis2_stub_free(&(stub_impl->stub), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+
+ }
+ /* Set service client options */
+ AXIS2_SVC_CLIENT_SET_OPTIONS( stub_impl->svc_client,
+ env,
+ stub_impl-> options);
+
+ AXIS2_OPTIONS_SET_TO( stub_impl->options, env, endpoint_ref);
return &(stub_impl->stub);
}
@@ -301,7 +179,7 @@
axis2_stub_impl_t *stub_impl = NULL;
axis2_endpoint_ref_t *endpoint_ref = NULL;
- AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK((*env)->error, endpoint_uri, NULL);
endpoint_ref = axis2_endpoint_ref_create(env, endpoint_uri);
@@ -311,15 +189,14 @@
}
stub_impl = (axis2_stub_impl_t *)
axis2_stub_create_with_endpoint_ref_and_client_home(env, endpoint_ref,
- client_home);
+ client_home);
if(!stub_impl)
{
axis2_stub_free(&(stub_impl->stub), env);
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- stub_impl->endpoint_ref = endpoint_ref;
return &(stub_impl->stub);
}
@@ -336,34 +213,16 @@
stub_impl = AXIS2_INTF_TO_IMPL(stub);
- if(stub->ops)
+ if(stub->ops)
{
AXIS2_FREE((*env)->allocator, stub->ops);
stub->ops = NULL;
}
- if(stub_impl->call)
+ if(stub_impl->svc_client )
{
- AXIS2_CALL_FREE(stub_impl->call, env);
- stub_impl->call = NULL;
- }
-
- if(stub_impl->property_map)
- {
- axis2_hash_free(stub_impl->property_map, env);
- stub_impl->property_map = NULL;
- }
-
- if (stub_impl->modules)
- {
- AXIS2_ARRAY_LIST_FREE(stub_impl->modules, env);
- stub_impl->modules = NULL;
- }
-
- if (stub_impl->endpoint_ref)
- {
- AXIS2_ENDPOINT_REF_FREE(stub_impl->endpoint_ref, env);
- stub_impl->endpoint_ref = NULL;
+ AXIS2_SVC_CLIENT_FREE (stub_impl->svc_client, env);
+ stub_impl->svc_client = NULL;
}
if(stub_impl)
@@ -372,7 +231,7 @@
stub_impl = NULL;
}
- return AXIS2_SUCCESS;
+ return AXIS2_SUCCESS;
}
axis2_status_t AXIS2_CALL
@@ -385,8 +244,9 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, endpoint_ref, AXIS2_FAILURE);
stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- return AXIS2_CALL_SET_TO(stub_impl->call, env, endpoint_ref);
+
+ AXIS2_OPTIONS_SET_TO ( stub_impl->options , env, endpoint_ref);
+ return AXIS2_SUCCESS;
}
axis2_status_t AXIS2_CALL
@@ -406,87 +266,29 @@
{
return AXIS2_FAILURE;
}
- return AXIS2_CALL_SET_TO(stub_impl->call, env, endpoint_ref);
+ AXIS2_OPTIONS_SET_TO ( stub_impl->options , env, endpoint_ref);
+
+ return AXIS2_SUCCESS;
}
/**
- *
- * @param sender_transport
- * @param listener_transport
* @param use_separate_transport
*/
axis2_status_t AXIS2_CALL
-axis2_stub_set_transport_info(axis2_stub_t *stub,
+axis2_stub_set_use_seperate_listener(axis2_stub_t *stub,
axis2_env_t **env,
- axis2_char_t *sender_transport,
- axis2_char_t *listener_transport,
axis2_bool_t use_separate_listener)
{
axis2_stub_impl_t *stub_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, sender_transport, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, listener_transport, AXIS2_FAILURE);
stub_impl = AXIS2_INTF_TO_IMPL(stub);
- if(stub_impl->sender_transport)
- {
- AXIS2_FREE((*env)->allocator, stub_impl->sender_transport);
- stub_impl->sender_transport = NULL;
- }
- stub_impl->sender_transport = sender_transport;
-
- if(stub_impl->listener_transport)
- {
- AXIS2_FREE((*env)->allocator, stub_impl->listener_transport);
- stub_impl->listener_transport = NULL;
- }
- stub_impl->listener_transport = listener_transport;
- stub_impl->use_separate_listener = use_separate_listener;
+ AXIS2_OPTIONS_SET_USE_SEPERATE_LISTENER ( stub_impl-> options, env,
+ use_separate_listener );
return AXIS2_SUCCESS;
}
-/**
- *
- * @param key
- * @param value
- */
-axis2_status_t AXIS2_CALL
-axis2_stub_put(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_char_t *key,
- axis2_property_t *value)
-{
- axis2_stub_impl_t *stub_impl = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, key, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, value, AXIS2_FAILURE);
- stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- axis2_hash_set(stub_impl->property_map, key, AXIS2_HASH_KEY_STRING, value);
- return AXIS2_SUCCESS;
-}
-
-/**
- *
- * @param key
- * @return the object
- */
-axis2_property_t *AXIS2_CALL
-axis2_stub_get(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_char_t *key)
-{
- axis2_stub_impl_t *stub_impl = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, key, AXIS2_FAILURE);
- stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- return axis2_hash_get(stub_impl->property_map, key, AXIS2_HASH_KEY_STRING);
-}
-
axis2_status_t AXIS2_CALL
axis2_stub_engage_module(axis2_stub_t *stub,
axis2_env_t **env,
@@ -497,8 +299,8 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FAILURE);
stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- return AXIS2_ARRAY_LIST_ADD(stub_impl->modules, env, module_name);
+
+ return AXIS2_SVC_CLIENT_ENGAGE_MODULE(stub_impl->svc_client, env, module_name);
}
/**
@@ -514,9 +316,13 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- stub_impl->soap_version = soap_version;
- return AXIS2_SUCCESS;
+
+ if ( !stub_impl-> options )
+ {
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_OPTIONS_SET_SOAP_VERSION( stub_impl-> options,
+ env, soap_version );
}
axis2_char_t *AXIS2_CALL
@@ -524,228 +330,30 @@
axis2_env_t **env)
{
axis2_stub_impl_t *stub_impl = NULL;
+ axis2_svc_ctx_t *svc_ctx = NULL;
axis2_char_t *svc_ctx_id = NULL;
AXIS2_ENV_CHECK(env, NULL);
stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- if(stub_impl->maintain_session)
- {
- svc_ctx_id = stub_impl->current_session_id;
- }
- else
- {
- svc_ctx_id = axis2_stub_get_id(stub, env);
- }
+
+ svc_ctx = AXIS2_SVC_CLIENT_GET_SERVICE_CONTEXT(stub_impl->svc_client,
+ env );
+ svc_ctx_id = AXIS2_SVC_CTX_GET_SVC_ID ( svc_ctx, env );
return svc_ctx_id;
}
-axis2_char_t *
-axis2_stub_get_id(axis2_stub_t *stub,
+axis2_svc_client_t *AXIS2_CALL
+axis2_stub_get_svc_client(axis2_stub_t *stub,
axis2_env_t **env)
{
AXIS2_ENV_CHECK(env, NULL);
-
- return axis2_uuid_gen(env);
-}
-
-axis2_om_node_t *AXIS2_CALL
-axis2_stub_get_element_from_reader(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_xml_reader_t *reader)
-{
- axis2_om_stax_builder_t *builder = NULL;
- axis2_om_document_t *document = NULL;
-
- AXIS2_ENV_CHECK(env, NULL);
- AXIS2_PARAM_CHECK((*env)->error, reader, NULL);
-
- /** create axis2_om_stax_builder by parsing pull_parser struct */
- builder = axis2_om_stax_builder_create (env, reader);
- if(!builder)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_CREATING_XML_STREAM_READER,
- AXIS2_FAILURE)
- return NULL;
- }
- document = AXIS2_OM_STAX_BUILDER_GET_DOCUMENT(builder, env);
- return AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(document, env);
-
-}
-
-axis2_status_t AXIS2_CALL
-axis2_stub_set_value_doc(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_soap_envelope_t *envelope,
- axis2_om_node_t *value,
- axis2_bool_t is_header)
-{
- axis2_status_t status = AXIS2_FAILURE;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, envelope, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, value, AXIS2_FAILURE);
- /*
- if(is_header)
- {
- axis2_soap_header_t *soap_header = NULL;
-
- soap_header = AXIS2_SOAP_ENVELOPE_GET_HEADER(envelope, env);
- if(!soap_header)
- {
- return AXIS2_FAILURE;
- }
- status = AXIS2_SOAP_HEADER_SET_BASE_NODE(soap_header, env, value);
- }
- else
- {
- axis2_soap_body_t *body = NULL;
-
- body = AXIS2_SOAP_ENVELOPE_GET_BODY(envelope, env);
- if(!body)
- {
- return AXIS2_FAILURE;
- }
- status = AXIS2_SOAP_BODY_SET_BASE_NODE(body, env, value);
- }
- */
- return status;
-}
-
-/**
- * Extract the correct element - A util method
- * @param env
- * @param type
- * @return the relevant element to be databound
- */
-axis2_om_node_t *AXIS2_CALL
-axis2_stub_get_element(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_soap_envelope_t *envelope,
- axis2_char_t *type)
-{
- axis2_soap_body_t *body = NULL;
- axis2_om_node_t *node = NULL;
-
- body = AXIS2_SOAP_ENVELOPE_GET_BODY(envelope, env);
- node = AXIS2_SOAP_BODY_GET_BASE_NODE(body, env);
- if(0 == AXIS2_STRCMP(AXIS2_STYLE_RPC, type))
- {
- /* todo this needs to be fixed */
- return AXIS2_OM_NODE_GET_FIRST_CHILD(node, env);
- }
- else if(0 == AXIS2_STRCMP(AXIS2_STYLE_DOC, type))
- {
- return node;
- }
- else
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_UNSUPPORTED_TYPE,
- AXIS2_FAILURE);
- return AXIS2_FAILURE;
- }
+ return AXIS2_INTF_TO_IMPL(stub)->svc_client;
}
-axis2_status_t AXIS2_CALL
-axis2_stub_populate_properties(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_call_t *call)
+axis2_options_t *AXIS2_CALL
+axis2_stub_get_options(axis2_stub_t *stub,
+ axis2_env_t **env)
{
- axis2_hash_index_t *index = NULL;
- axis2_stub_impl_t *stub_impl = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, call, AXIS2_FAILURE);
- stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- for(index = axis2_hash_first(stub_impl->property_map, env); index; index =
- axis2_hash_next(env, index))
- {
- const void *key = NULL;
- void *val = NULL;
- axis2_property_t *property = NULL;
-
- axis2_hash_this(index, &key, NULL, &val);
- property = (axis2_property_t *) val;
- AXIS2_CALL_SET(call, env, (void*)key, property);
-
- }
- return AXIS2_SUCCESS;
-}
-
-axis2_status_t AXIS2_CALL
-axis2_stub_populate_modules(axis2_stub_t *stub,
- axis2_env_t **env,
- axis2_call_t *call)
-{
- axis2_stub_impl_t *stub_impl = NULL;
- int i = 0;
- int size = 0;
- axis2_status_t status = AXIS2_FAILURE;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, call, AXIS2_FAILURE);
- stub_impl = AXIS2_INTF_TO_IMPL(stub);
-
- size = AXIS2_ARRAY_LIST_SIZE(stub_impl->modules, env);
- for (i = 0; i < size; i++)
- {
- axis2_qname_t *module_qname = NULL;
- axis2_char_t *module_name = NULL;
-
- module_name = (axis2_char_t *) AXIS2_ARRAY_LIST_GET(stub_impl->modules,
- env, i);
- module_qname = axis2_qname_create(env, module_name, NULL, NULL);
- /* TODO uncomment this when method is available
- status = AXIS2_CALL_ENGAGE_MODULE(stub_impl->call, env, modue_qname);
- */
- if(AXIS2_SUCCESS != status)
- {
- return status;
- }
- AXIS2_QNAME_FREE(module_qname, env);
- module_qname = NULL;
- }
- return status;
-}
-
-axis2_call_t *AXIS2_CALL
-axis2_stub_get_call_obj(axis2_stub_t *stub,
- axis2_env_t **env)
-{
- AXIS2_ENV_CHECK(env, NULL);
- return AXIS2_INTF_TO_IMPL(stub)->call;
-}
-
-
-/*
-public void _setSessionInfo(String key, Object value) throws java.lang.Exception {
- if (!_maintainSession) {
- //TODO Comeup with a Exception
- throw new java.lang.Exception(
- "Client is running the session OFF mode: Start session before saving to a session ");
- }
- _configurationContext.getServiceContext(_currentSessionId).setProperty(
- key, value);
-}
-
-
-public Object _getSessionInfo(String key) throws java.lang.Exception {
- if (!_maintainSession) {
- //TODO Comeup with a Exception
- throw new java.lang.Exception(
- "Client is running the session OFF mode: Start session before saving to a session ");
- }
- return _configurationContext.getServiceContext(_currentSessionId)
- .getProperty(key);
-}
-
-public void _startSession() {
- _maintainSession = true;
- _currentSessionId = getID();
-}
-
-public void _endSession() {
- _maintainSession = false;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(stub)->options;
}
-*/
Modified: webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.c?rev=406873&r1=406872&r2=406873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.c (original)
+++ webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.c Tue May 16 01:29:54 2006
@@ -15,9 +15,6 @@
*/
#include "axis2_math_stub.h"
-#include <axis2_om_node.h>
-#include <axis2_msg_ctx.h>
-#include <axis2_call.h>
axis2_stub_t *
@@ -27,18 +24,53 @@
{
axis2_stub_t *stub = NULL;
- AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_ENV_CHECK(env, NULL);
- stub = (axis2_stub_t *)
- axis2_stub_create_with_endpoint_ref_and_client_home(env, endpoint_ref,
+ stub = (axis2_stub_t *)
+ axis2_stub_create_with_endpoint_ref_and_client_home(env, endpoint_ref,
client_home);
- if(NULL == stub)
+ if(NULL == stub)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
-
- return stub;
+ axis2_populate_axis_service( stub, env);
+ return stub;
+}
+
+void axis2_populate_axis_service( axis2_stub_t* stub, axis2_env_t** env)
+{
+ axis2_svc_client_t* svc_client = NULL;
+ axis2_qname_t *svc_qname = NULL;
+ axis2_qname_t *op_qname = NULL;
+ axis2_svc_t* svc = NULL;
+ axis2_op_t* op = NULL;
+
+ /*Modifying the Service*/
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT (stub, env );
+ svc = AXIS2_SVC_CLIENT_GET_AXIS_SERVICE ( svc_client, env );
+
+ /*creating the operations*/
+
+ op_qname = axis2_qname_create(env,"add" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
+
+ op_qname = axis2_qname_create(env,"sub" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
+
+ op_qname = axis2_qname_create(env,"mul" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
+
+ op_qname = axis2_qname_create(env,"div" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
}
axis2_stub_t *
@@ -59,6 +91,7 @@
return NULL;
}
+ axis2_populate_axis_service( stub, env);
return stub;
}
@@ -70,13 +103,15 @@
axis2_env_t **env,
axis2_om_node_t *node)
{
- axis2_call_t *call = NULL;
+ axis2_svc_client_t *svc_client = NULL;
axis2_om_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- call = AXIS2_STUB_GET_CALL_OBJ(stub, env);
- ret_node = AXIS2_CALL_INVOKE_BLOCKING_WITH_OM(call, env, "add", node);
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "add" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
return ret_node;
}
@@ -86,13 +121,15 @@
axis2_env_t **env,
axis2_om_node_t *node)
{
- axis2_call_t *call = NULL;
+ axis2_svc_client_t *svc_client = NULL;
axis2_om_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- call = AXIS2_STUB_GET_CALL_OBJ(stub, env);
- ret_node = AXIS2_CALL_INVOKE_BLOCKING_WITH_OM(call, env, "sub", node);
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "sub" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
return ret_node;
}
@@ -102,13 +139,15 @@
axis2_env_t **env,
axis2_om_node_t *node)
{
- axis2_call_t *call = NULL;
+ axis2_svc_client_t *svc_client = NULL;
axis2_om_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- call = AXIS2_STUB_GET_CALL_OBJ(stub, env);
- ret_node = AXIS2_CALL_INVOKE_BLOCKING_WITH_OM(call, env, "mul", node);
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "mul" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
return ret_node;
}
@@ -118,13 +157,15 @@
axis2_env_t **env,
axis2_om_node_t *node)
{
- axis2_call_t *call = NULL;
+ axis2_svc_client_t *svc_client = NULL;
axis2_om_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- call = AXIS2_STUB_GET_CALL_OBJ(stub, env);
- ret_node = AXIS2_CALL_INVOKE_BLOCKING_WITH_OM(call, env, "div", node);
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "div" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
return ret_node;
}
Modified: webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.h?rev=406873&r1=406872&r2=406873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.h (original)
+++ webservices/axis2/trunk/c/samples/client/math/axis2_math_stub.h Tue May 16 01:29:54 2006
@@ -22,14 +22,7 @@
* @brief axis2 math stub interface
*/
-#include <axis2_const.h>
-#include <axis2_error.h>
-#include <axis2_defines.h>
-#include <axis2_env.h>
-#include <axis2_allocator.h>
#include <axis2_stub.h>
-#include <axis2_endpoint_ref.h>
-#include <axis2_om_node.h>
#ifdef __cplusplus
extern "C"
@@ -55,6 +48,10 @@
axis2_math_stub_div(axis2_stub_t *stub,
axis2_env_t **env,
axis2_om_node_t *node);
+/**
+ * populate services
+ */
+void axis2_populate_axis_service( axis2_stub_t* stub, axis2_env_t** env);
/**
* Creates axis2_stub struct
Modified: webservices/axis2/trunk/c/samples/client/math/math_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/client/math/math_client.c?rev=406873&r1=406872&r2=406873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/client/math/math_client.c (original)
+++ webservices/axis2/trunk/c/samples/client/math/math_client.c Tue May 16 01:29:54 2006
@@ -15,28 +15,11 @@
*/
#include "axis2_math_stub.h"
-#include <axis2_om_stax_builder.h>
-#include <axis2_om_document.h>
-#include <axis2_om_node.h>
-#include <axis2_om_element.h>
-#include <axis2_om_text.h>
-#include <axis2_stream.h>
-#include <axis2_log_default.h>
-#include <axis2_error_default.h>
-#include <axis2_xml_reader.h>
#include <stdio.h>
-#include <axis2_xml_writer.h>
-#include <axis2_soap_builder.h>
-#include <axis2_soap_const.h>
-#include <axis2_soap_envelope.h>
-#include <axis2_soap_body.h>
-#include <axis2_soap_header.h>
-#include <axis2_soap_message.h>
-#include <axis2_soap_header_block.h>
-#include <axis2_soap_fault.h>
-#include <axis2_soap_fault_code.h>
-#include <axis2_soap_fault_role.h>
-#include <platforms/axis2_platform_auto_sense.h>
+#include <axis2_om.h>
+#include <axis2_util.h>
+#include <axis2_soap.h>
+#include <axis2_client.h>
axis2_om_node_t *
build_om_programatically(axis2_env_t **env, axis2_char_t *operation, axis2_char_t *param1, axis2_char_t *param2);
@@ -47,9 +30,6 @@
axis2_om_node_t *node = NULL;
axis2_status_t status = AXIS2_FAILURE;
axis2_env_t *env = NULL;
- axis2_error_t *error = NULL;
- axis2_log_t *log = NULL;
- axis2_allocator_t *allocator = NULL;
axis2_char_t *address = NULL;
axis2_char_t *client_home = NULL;
axis2_om_node_t *ret_node = NULL;
@@ -57,13 +37,8 @@
axis2_char_t *operation = "add";
axis2_char_t *param1 = "40";
axis2_char_t *param2 = "8";
-
- allocator = axis2_allocator_init (NULL);
- error = axis2_error_create(allocator);
- log = axis2_log_create(allocator, NULL, "math_client.log");
- env = axis2_env_create_with_error_log(allocator, error, log);
- env->log->level = AXIS2_LOG_LEVEL_INFO;
- axis2_error_init();
+
+ env = axis2_env_create_all( "math_blocking.log", AXIS2_LOG_LEVEL_TRACE);
client_home = AXIS2_GETENV("AXIS2C_HOME");
if (!client_home)
@@ -95,10 +70,7 @@
node = build_om_programatically(&env, operation, param1, param2);
stub =
- axis2_stub_create_with_endpoint_uri_and_client_home(&env, address,
- client_home);
- AXIS2_STUB_SET_TRANSPORT_INFO(stub, &env, AXIS2_TRANSPORT_HTTP,
- AXIS2_TRANSPORT_HTTP, AXIS2_FALSE);
+ axis2_math_stub_create_with_endpoint_uri_and_client_home(&env, address, client_home);
/* create node and invoke math */
ret_node = axis2_math_stub_add(stub, &env, node);
if(ret_node)