You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/13 07:12:41 UTC
svn commit: r356485 - in /webservices/axis2/trunk/c: include/axis2_engine.h
include/axis2_msg_ctx.h include/axis2_msg_recv.h
modules/core/context/src/msg_ctx.c modules/core/engine/src/Makefile.am
modules/core/engine/src/engine.c
Author: samisa
Date: Mon Dec 12 22:12:20 2005
New Revision: 356485
URL: http://svn.apache.org/viewcvs?rev=356485&view=rev
Log:
Added the initial compiling version of engine. There are many TODOs to be resolved wehn SOAP is available
Added:
webservices/axis2/trunk/c/include/axis2_engine.h
webservices/axis2/trunk/c/modules/core/engine/src/engine.c
Modified:
webservices/axis2/trunk/c/include/axis2_msg_ctx.h
webservices/axis2/trunk/c/include/axis2_msg_recv.h
webservices/axis2/trunk/c/modules/core/context/src/msg_ctx.c
webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am
Added: webservices/axis2/trunk/c/include/axis2_engine.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_engine.h?rev=356485&view=auto
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_engine.h (added)
+++ webservices/axis2/trunk/c/include/axis2_engine.h Mon Dec 12 22:12:20 2005
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_ENGINE_H
+#define AXIS2_ENGINE_H
+
+
+/**
+ * @file axis2_engine.h
+ * @brief axis2 Message Context interface
+ */
+
+#include <axis2_defines.h>
+#include <axis2_array_list.h>
+#include <axis2_env.h>
+#include <axis2_conf_ctx.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @defgroup axis2_engine Message Context
+ * @ingroup axis2_core_context
+ * @{
+ */
+
+typedef struct axis2_engine_ops axis2_engine_ops_t;
+typedef struct axis2_engine axis2_engine_t;
+
+struct axis2_soap_fault;
+
+
+/**
+ * @brief Message Context operations struct
+ * Encapsulator struct for operations of axis2_engine
+ */
+struct axis2_engine_ops
+{
+ /**
+ * This methods represents the outflow of the Axis, this could be either at the server side or the client side.
+ * Here the <code>ExecutionChain</code> is created using the Phases. The Handlers at the each Phases is ordered in
+ * deployment time by the deployment module
+ *
+ * @param msgContext
+ * @throws AxisFault
+ * @see MessageContext
+ * @see Phase
+ * @see Handler
+ */
+ axis2_status_t (AXIS2_CALL *send)(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+ /**
+ * This methods represents the inflow of the Axis, this could be either at the server side or the client side.
+ * Here the <code>ExecutionChain</code> is created using the Phases. The Handlers at the each Phases is ordered in
+ * deployment time by the deployment module
+ *
+ * @throws AxisFault
+ * @see MessageContext
+ * @see Phase
+ * @see Handler
+ */
+ axis2_status_t (AXIS2_CALL *receive)(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+ /**
+ * Sends the SOAP Fault to another SOAP node.
+ *
+ * @param msg_ctx
+ * @throws AxisFault
+ */
+ axis2_status_t (AXIS2_CALL *send_fault)(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+ /**
+ * This is invoked when a SOAP Fault is received from a Other SOAP Node
+ * Receives a SOAP fault from another SOAP node.
+ *
+ * @param msg_ctx
+ * @throws AxisFault
+ */
+ axis2_status_t (AXIS2_CALL *receive_fault)(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+ /**
+ * This method is called to handle any error that occurs at inflow or outflow. But if the
+ * method is called twice, it implies that sending the error handling has failed, in which case
+ * the method logs the error and exists.
+ *
+ * @param processingContext
+ * @param e
+ * @throws AxisFault
+ */
+ axis2_msg_ctx_t* (AXIS2_CALL *create_fault_msg_ctx)(struct axis2_engine *engine, axis2_env_t **env,
+ axis2_msg_ctx_t *processing_context);
+ /**
+ * Information to create the SOAPFault can be extracted from different places.
+ * 1. Those info may have been put in to the message context by some handler. When someone
+ * is putting like that, he must make sure the SOAPElements he is putting must be from the
+ * correct SOAP Version.
+ * 2. SOAPProcessingException is flexible enough to carry information about the fault. For example
+ * it has an attribute to store the fault code. The fault reason can be extracted from the
+ * message of the exception. I opted to put the stacktrace under the detail element.
+ * eg : <Detail>
+ * <Exception> stack trace goes here </Exception>
+ * <Detail>
+ * <p/>
+ * If those information can not be extracted from any of the above places, I default the soap
+ * fault values to following.
+ * <Fault>
+ * <Code>
+ * <Value>env:Receiver</Value>
+ * </Code>
+ * <Reason>
+ * <Text>unknown</Text>
+ * </Reason>
+ * <Role/>
+ * <Node/>
+ * <Detail/>
+ * </Fault>
+ * <p/>
+ * -- EC
+ *
+ * @param context
+ * @param fault
+ * @param e
+ */
+ axis2_status_t (AXIS2_CALL *extract_fault_info_from_msg_ctx)(
+ struct axis2_engine *engine, axis2_env_t **env,
+ axis2_msg_ctx_t *msg_ctx,
+ struct axis2_soap_fault *fault);
+ axis2_status_t (AXIS2_CALL *verify_ctx_built)(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+ axis2_status_t (AXIS2_CALL *invoke_phases)(struct axis2_engine *engine, axis2_env_t **env, axis2_array_list_t *phases, axis2_msg_ctx_t *msg_ctx);
+ axis2_status_t (AXIS2_CALL *resume_invocation_phases)(struct axis2_engine *engine, axis2_env_t **env, axis2_array_list_t *phases, axis2_msg_ctx_t *msg_ctx);
+ axis2_char_t* (AXIS2_CALL *get_sender_fault_code)(struct axis2_engine *engine, axis2_env_t **env, axis2_char_t *soap_namespace);
+ axis2_char_t* (AXIS2_CALL *get_receiver_fault_code)(struct axis2_engine *engine, axis2_env_t **env, axis2_char_t *soap_namespace);
+ axis2_status_t (AXIS2_CALL *free)(struct axis2_engine *engine,
+ axis2_env_t **env);
+};
+
+/**
+ * @brief Message Context struct
+ * Axis2 Message Context
+ */
+struct axis2_engine
+{
+ axis2_engine_ops_t *ops;
+};
+
+AXIS2_DECLARE(axis2_engine_t*) axis2_engine_create(axis2_env_t **env, axis2_conf_ctx_t *conf_ctx);
+
+/************************** Start of function macros **************************/
+
+#define AXIS2_ENGINE_SEND(engine, env, msg_ctx) ((engine)->ops->send(engine, env, msg_ctx))
+#define AXIS2_ENGINE_RECEIVE(engine, env, msg_ctx) ((engine)->ops->receive(engine, env, msg_ctx))
+#define AXIS2_ENGINE_SEND_FAULT(engine, env, msg_ctx) ((engine)->ops->send_fault(engine, env, msg_ctx))
+#define AXIS2_ENGINE_RECEIVE_FAULT(engine, env, msg_ctx) ((engine)->ops->receive_fault(engine, env, msg_ctx))
+#define AXIS2_ENGINE_CREATE_FAULT_MSG_CTX(engine, env, msg_ctx) ((engine)->ops->create_fault_msg_ctx(engine, env, msg_ctx))
+#define AXIS2_ENGINE_EXTRACT_FAULT_INFO_FROM_MSG_CTX(engine, env, msg_ctx, fault) ((engine)->ops->extract_fault_info_from_msg_ctx(engine, env, msg_ctx, fault))
+#define AXIS2_ENGINE_VERIFY_CTX_BUILT(engine, env, msg_ctx) ((engine)->ops->verify_ctx_built(engine, env, msg_ctx))
+#define AXIS2_ENGINE_INVOKE_PHASES(engine, env, phases, msg_ctx) ((engine)->ops->invoke_phases(engine, env, phases, msg_ctx))
+#define AXIS2_ENGINE_RESUME_INVOCATION_PHASES(engine, env, phases, msg_ctx) ((engine)->ops->resume_invocation_phases(engine, env, phases, msg_ctx))
+#define AXIS2_ENGINE_GET_SENDER_FAULT_CODE(engine, env, soap_namespace) ((engine)->ops->get_sender_fault_code(engine, env, soap_namespace))
+#define AXIS2_ENGINE_GET_RECEIVER_FAULT_CODE(engine, env, soap_namespace) ((engine)->ops->get_receiver_fault_code(engine, env, soap_namespace))
+#define AXIS2_ENGINE_FREE(engine, env) ((engine)->ops->free(engine, env))
+
+/************************** End of function macros ****************************/
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AXIS2_ENGINE_H */
Modified: webservices/axis2/trunk/c/include/axis2_msg_ctx.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_msg_ctx.h?rev=356485&r1=356484&r2=356485&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_msg_ctx.h (original)
+++ webservices/axis2/trunk/c/include/axis2_msg_ctx.h Mon Dec 12 22:12:20 2005
@@ -105,9 +105,8 @@
/**
* @return
*/
- /*axis2_endpoint_ref_t *(AXIS2_CALL *get_fault_to)(struct axis2_msg_ctx *msg_ctx,
+ axis2_endpoint_ref_t *(AXIS2_CALL *get_fault_to)(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env);
- */
/**
* @return
@@ -180,9 +179,8 @@
/**
* @param reference
*/
- /*axis2_status_t (AXIS2_CALL *set_fault_to)(struct axis2_msg_ctx *msg_ctx,
+ axis2_status_t (AXIS2_CALL *set_fault_to)(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env, axis2_endpoint_ref_t *reference);
- */
/**
* @param reference
@@ -608,9 +606,7 @@
#define AXIS2_MSG_CTX_FREE(msg_ctx, env) ((msg_ctx)->ops->free(msg_ctx, env))
#define AXIS2_MSG_CTX_INIT(msg_ctx, env, engine_config) ((msg_ctx)->ops->init(msg_ctx, env, engine_config))
-/*
#define AXIS2_MSG_CTX_GET_FAULT_TO(msg_ctx, env) ((msg_ctx)->ops->get_fault_to(msg_ctx, env))
-*/
/*
#define AXIS2_MSG_CTX_GET_FROM(msg_ctx, env) ((msg_ctx)->ops->get_from(msg_ctx, env))
*/
@@ -628,9 +624,7 @@
#define AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env) ((msg_ctx)->ops->get_server_side(msg_ctx, env))
#define AXIS2_MSG_CTX_GET_SESSION_CTX(msg_ctx, env) ((msg_ctx)->ops->get_session_ctx(msg_ctx, env))
#define AXIS2_MSG_CTX_GET_TO(msg_ctx, env) ((msg_ctx)->ops->get_to(msg_ctx, env))
-/*
#define AXIS2_MSG_CTX_SET_FAULT_TO(msg_ctx, env, reference) ((msg_ctx)->ops->set_fault_to(msg_ctx, env, reference))
-*/
/*
#define AXIS2_MSG_CTX_SET_FROM(msg_ctx, env, reference) ((msg_ctx)->ops->set_from(msg_ctx, env, reference))
*/
Modified: webservices/axis2/trunk/c/include/axis2_msg_recv.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_msg_recv.h?rev=356485&r1=356484&r2=356485&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_msg_recv.h (original)
+++ webservices/axis2/trunk/c/include/axis2_msg_recv.h Mon Dec 12 22:12:20 2005
@@ -35,7 +35,7 @@
* @{
*/
-struct axis2_msg_ctx_s;
+struct axis2_msg_ctx;
typedef struct axis2_msg_recv axis2_msg_recv_t;
typedef struct axis2_msg_recv_ops axis2_msg_recv_ops_t;
@@ -54,7 +54,7 @@
axis2_status_t (AXIS2_CALL *receive) (axis2_msg_recv_t *msg_recv,
axis2_env_t **env,
- struct axis2_msg_ctx_s *msg_ctx);
+ struct axis2_msg_ctx *msg_ctx);
};
/**
Modified: webservices/axis2/trunk/c/modules/core/context/src/msg_ctx.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/src/msg_ctx.c?rev=356485&r1=356484&r2=356485&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/src/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/modules/core/context/src/msg_ctx.c Mon Dec 12 22:12:20 2005
@@ -130,10 +130,9 @@
axis2_msg_ctx_init(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env,
struct axis2_engine_config *engine_config);
-/*axis2_endpoint_ref_t *AXIS2_CALL
+axis2_endpoint_ref_t *AXIS2_CALL
axis2_msg_ctx_get_fault_to(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env);
-*/
/*axis2_endpoint_ref_t *AXIS2_CALL
axis2_msg_ctx_get_from(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env);
@@ -171,11 +170,10 @@
axis2_msg_ctx_get_to(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env);
-/*axis2_status_t AXIS2_CALL
+axis2_status_t AXIS2_CALL
axis2_msg_ctx_set_fault_to(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env,
axis2_endpoint_ref_t *reference);
-*/
/*
axis2_status_t AXIS2_CALL
axis2_msg_ctx_set_from(struct axis2_msg_ctx *msg_ctx,
@@ -523,8 +521,8 @@
msg_ctx_impl->msg_ctx.ops->set_parent = axis2_msg_ctx_set_parent;
msg_ctx_impl->msg_ctx.ops->free = axis2_msg_ctx_free;
msg_ctx_impl->msg_ctx.ops->init = axis2_msg_ctx_init;
-/*
msg_ctx_impl->msg_ctx.ops->get_fault_to = axis2_msg_ctx_get_fault_to;
+/*
msg_ctx_impl->msg_ctx.ops->get_from = axis2_msg_ctx_get_from;
*/
msg_ctx_impl->msg_ctx.ops->get_in_fault_flow = axis2_msg_ctx_get_in_fault_flow;
@@ -542,9 +540,7 @@
msg_ctx_impl->msg_ctx.ops->get_server_side = axis2_msg_ctx_get_server_side;
msg_ctx_impl->msg_ctx.ops->get_session_ctx = axis2_msg_ctx_get_session_ctx;
msg_ctx_impl->msg_ctx.ops->get_to = axis2_msg_ctx_get_to;
-/*
msg_ctx_impl->msg_ctx.ops->set_fault_to = axis2_msg_ctx_set_fault_to;
-*/
/*
msg_ctx_impl->msg_ctx.ops->set_from = axis2_msg_ctx_set_from;
*/
@@ -772,11 +768,23 @@
/**
* @return
*/
-/*axis2_endpoint_ref_t *AXIS2_CALL axis2_msg_ctx_get_fault_to(struct axis2_msg_ctx *msg_ctx,
- axis2_env_t **env) {
- return msg_info_headersgetFaultTo();
+axis2_endpoint_ref_t *AXIS2_CALL axis2_msg_ctx_get_fault_to(struct axis2_msg_ctx *msg_ctx,
+ axis2_env_t **env)
+{
+ axis2_msg_ctx_impl_t *msg_ctx_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, NULL);
+
+ msg_ctx_impl = AXIS2_INTF_TO_IMPL(msg_ctx);
+
+ if (msg_ctx_impl->msg_info_headers)
+ {
+ return AXIS2_MSG_INFO_HEADERS_GET_FAULT_TO(msg_ctx_impl->msg_info_headers, env);
+ }
+
+ return NULL;
}
-*/
+
/**
* @return
@@ -922,11 +930,22 @@
/**
* @param reference
*/
-/*axis2_status_t AXIS2_CALL axis2_msg_ctx_set_fault_to(struct axis2_msg_ctx *msg_ctx,
- axis2_env_t **env, axis2_endpoint_ref_t *reference) {
- msg_info_headers.setFaultTo(reference);
+axis2_status_t AXIS2_CALL axis2_msg_ctx_set_fault_to(struct axis2_msg_ctx *msg_ctx,
+ axis2_env_t **env, axis2_endpoint_ref_t *reference)
+{
+ axis2_msg_ctx_impl_t *msg_ctx_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, AXIS2_FALIURE);
+
+ msg_ctx_impl = AXIS2_INTF_TO_IMPL(msg_ctx);
+
+ if (msg_ctx_impl->msg_info_headers)
+ {
+ return AXIS2_MSG_INFO_HEADERS_SET_TO(msg_ctx_impl->msg_info_headers, env, reference);
+ }
+
+ return AXIS2_SUCCESS;
}
-*/
/**
* @param reference
Modified: webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am?rev=356485&r1=356484&r2=356485&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am Mon Dec 12 22:12:20 2005
@@ -11,7 +11,8 @@
req_uri_disp.c \
disp.c \
soap_action_disp.c \
- soap_body_disp.c
+ soap_body_disp.c \
+ engine.c
libaxis2_engine_la_LIBADD = $(LDFLAGS)
INCLUDES = -I${CUTEST_HOME}/include \
Added: webservices/axis2/trunk/c/modules/core/engine/src/engine.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/engine.c?rev=356485&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/engine.c (added)
+++ webservices/axis2/trunk/c/modules/core/engine/src/engine.c Mon Dec 12 22:12:20 2005
@@ -0,0 +1,706 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <axis2_engine.h>
+#include <axis2.h>
+#include <axis2_hash.h>
+
+/**
+ * There is only one engine for the Server and the Client. the send() and receive()
+ * Methods are the basic operations the Sync, Async messageing are build on top.
+ */
+
+
+typedef struct axis2_engine_impl
+{
+ /** context base struct */
+ axis2_engine_t engine;
+ /** configuration context */
+ axis2_conf_ctx_t *conf_ctx;
+} axis2_engine_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(engine) ((axis2_engine_impl_t *)engine)
+
+axis2_status_t AXIS2_CALL axis2_engine_send(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+axis2_status_t AXIS2_CALL axis2_engine_receive(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+axis2_status_t AXIS2_CALL axis2_engine_send_fault(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+axis2_status_t AXIS2_CALL axis2_engine_receive_fault(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+axis2_msg_ctx_t* AXIS2_CALL axis2_engine_create_fault_msg_ctx(struct axis2_engine *engine, axis2_env_t **env,
+ axis2_msg_ctx_t *processing_context);
+axis2_status_t AXIS2_CALL axis2_engine_extract_fault_info_from_msg_ctx(
+ struct axis2_engine *engine, axis2_env_t **env,
+ axis2_msg_ctx_t *msg_ctx,
+ struct axis2_soap_fault *fault);
+axis2_status_t AXIS2_CALL axis2_engine_verify_ctx_built(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+axis2_status_t AXIS2_CALL axis2_engine_invoke_phases(struct axis2_engine *engine, axis2_env_t **env, axis2_array_list_t *phases, axis2_msg_ctx_t *msg_ctx);
+axis2_status_t AXIS2_CALL axis2_engine_resume_invocation_phases(struct axis2_engine *engine, axis2_env_t **env, axis2_array_list_t *phases, axis2_msg_ctx_t *msg_ctx);
+axis2_char_t* AXIS2_CALL axis2_engine_get_sender_fault_code(struct axis2_engine *engine, axis2_env_t **env, axis2_char_t *soap_namespace);
+axis2_char_t* AXIS2_CALL axis2_engine_get_receiver_fault_code(struct axis2_engine *engine, axis2_env_t **env, axis2_char_t *soap_namespace);
+axis2_status_t AXIS2_CALL axis2_engine_free(struct axis2_engine *engine,
+ axis2_env_t **env);
+
+
+axis2_engine_t* AXIS2_CALL axis2_engine_create(axis2_env_t **env, axis2_conf_ctx_t *conf_ctx)
+{
+ axis2_engine_impl_t *engine_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ engine_impl = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_engine_impl_t) );
+ if (!engine_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ engine_impl->engine.ops = NULL;
+ engine_impl->conf_ctx = NULL;
+
+ if (conf_ctx)
+ {
+ engine_impl->conf_ctx = conf_ctx;
+ }
+
+ /* initialize operations */
+ engine_impl->engine.ops = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_engine_ops_t) );
+ if (!engine_impl->engine.ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ axis2_engine_free(&(engine_impl->engine), env);
+ return NULL;
+ }
+
+ engine_impl->engine.ops->send = axis2_engine_send;
+ engine_impl->engine.ops->receive = axis2_engine_receive;
+ engine_impl->engine.ops->send_fault = axis2_engine_send_fault;
+ engine_impl->engine.ops->receive_fault = axis2_engine_receive_fault;
+ engine_impl->engine.ops->create_fault_msg_ctx = axis2_engine_create_fault_msg_ctx;
+ engine_impl->engine.ops->extract_fault_info_from_msg_ctx = axis2_engine_extract_fault_info_from_msg_ctx;
+ engine_impl->engine.ops->verify_ctx_built = axis2_engine_verify_ctx_built;
+ engine_impl->engine.ops->invoke_phases = axis2_engine_invoke_phases;
+ engine_impl->engine.ops->resume_invocation_phases = axis2_engine_resume_invocation_phases;
+ engine_impl->engine.ops->get_sender_fault_code = axis2_engine_get_sender_fault_code;
+ engine_impl->engine.ops->get_receiver_fault_code = axis2_engine_get_receiver_fault_code;
+ engine_impl->engine.ops->free = axis2_engine_free;
+
+ AXIS2_LOG(env, "Axis2 Engine Started");
+
+ return &(engine_impl->engine);
+}
+
+axis2_status_t AXIS2_CALL axis2_engine_free(struct axis2_engine *engine,
+ axis2_env_t **env)
+{
+ axis2_engine_impl_t *engine_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+
+ engine_impl = AXIS2_INTF_TO_IMPL(engine);
+
+ if (engine_impl->engine.ops)
+ {
+ AXIS2_FREE((*env)->allocator, engine_impl->engine.ops);
+ engine_impl->engine.ops = NULL;
+ }
+
+ AXIS2_FREE((*env)->allocator, engine_impl);
+ engine_impl = NULL;
+
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * This methods represents the outflow of the Axis, this could be either at the server side or the client side.
+ * Here the <code>ExecutionChain</code> is created using the Phases. The Handlers at the each Phases is ordered in
+ * deployment time by the deployment module
+ *
+ * @param msgContext
+ * @throws AxisFault
+ * @see MessageContext
+ * @see Phase
+ * @see Handler
+ */
+axis2_status_t AXIS2_CALL axis2_engine_send(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_engine_impl_t *engine_impl = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ axis2_operation_ctx_t *operation_ctx = NULL;
+ axis2_array_list_t *phases = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ engine_impl = AXIS2_INTF_TO_IMPL(engine);
+
+ status = axis2_engine_verify_ctx_built(engine, env, msg_ctx);
+ if (status != AXIS2_SUCCESS)
+ return status;
+
+ /* find and invoke the phases */
+ operation_ctx = AXIS2_MSG_CTX_GET_OPERATION_CTX(msg_ctx, env);
+ if (operation_ctx)
+ {
+ axis2_operation_t *op = AXIS2_OPERATION_CTX_GET_OPERATION(operation_ctx, env);
+ if (op)
+ {
+ phases = AXIS2_OPERATION_GET_PHASES_OUTFLOW(op, env);
+ }
+ }
+
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_engine_config_t *engine_config = NULL;
+ /*axis2_array_list_t *global_out_phase = NULL;*/
+
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ /* the message has paused, so rerun them from the position they stoped. The Handler
+ //who paused the Message will be the first one to run
+ //resume fixed, global precalulated phases
+ */
+ status = axis2_engine_resume_invocation_phases(engine, env, phases, msg_ctx);
+ if (status != AXIS2_SUCCESS)
+ {
+ return status;
+ }
+
+ conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+ if (conf_ctx)
+ {
+ engine_config = AXIS2_CONF_CTX_GET_ENGINE_CONFIG(conf_ctx, env);
+ if (engine_config)
+ {
+ /*TODO global_out_phase = AXIS2_ENGINE_CONFIG_GET_GLOBAL_OUT_PASES(engine_config, env);
+ axis2_engine_invoke_phases(engine, env, global_out_phase, msg_ctx); */
+ }
+ }
+ }
+ else
+ {
+ axis2_engine_invoke_phases(engine, env, phases, msg_ctx);
+
+ conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+ if (conf_ctx)
+ {
+ engine_config = AXIS2_CONF_CTX_GET_ENGINE_CONFIG(conf_ctx, env);
+ if (engine_config)
+ {
+ /*global_out_phase = AXIS2_ENGINE_CONFIG_GET_GLOBAL_OUT_PHASES(engine_config, env);
+ axis2_engine_invoke_phases(engine, env, global_out_phase, msg_ctx);*/
+ }
+ }
+ }
+
+ if (!(AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env)))
+ {
+ /* write the message to the wire */
+ /*TODO axis2_transport_out_desc_t *transport_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx, env);
+ axis2_tranport_sender_t *transport_sender = AXIS2_TRANSPORT_OUT_DESC_GET_SENDER(transport_out, env);
+ AXIS2_TRANSPORT_SENDER_INVOKE(transport_sender, env, msg_ctx);*/
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * This methods represents the inflow of the Axis, this could be either at the server side or the client side.
+ * Here the <code>ExecutionChain</code> is created using the Phases. The Handlers at the each Phases is ordered in
+ * deployment time by the deployment module
+ *
+ * @throws AxisFault
+ * @see MessageContext
+ * @see Phase
+ * @see Handler
+ */
+axis2_status_t AXIS2_CALL axis2_engine_receive(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_engine_impl_t *engine_impl = NULL;
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_engine_config_t *engine_config = NULL;
+ axis2_operation_ctx_t *operation_ctx = NULL;
+ axis2_operation_t *operation = NULL;
+ axis2_array_list_t *pre_calculated_phases = NULL;
+ axis2_array_list_t *operation_specific_phases = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ engine_impl = AXIS2_INTF_TO_IMPL(engine);
+
+ conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+
+ engine_config = AXIS2_CONF_CTX_GET_ENGINE_CONFIG(conf_ctx, env);
+
+ pre_calculated_phases = AXIS2_ENGINE_CONFIG_GET_IN_PHASES_UPTO_AND_INCLUDING_POST_DISPATCH(engine_config, env);
+
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ /* the message has paused, so re-run them from the position they stoped. The Handler
+ who paused the Message will be the first one to run
+ resume fixed, global precalulated phases */
+ axis2_engine_resume_invocation_phases(engine, env, pre_calculated_phases, msg_ctx);
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ return AXIS2_SUCCESS;
+ }
+
+ axis2_engine_verify_ctx_built(engine, env, msg_ctx);
+ /* resume operation specific phases */
+ operation_ctx = AXIS2_MSG_CTX_GET_OPERATION_CTX(msg_ctx, env);
+ if (operation_ctx)
+ {
+ operation = AXIS2_OPERATION_CTX_GET_OPERATION(operation_ctx, env);
+ operation_specific_phases = AXIS2_OPERATION_GET_REMAINING_PHASES_INFLOW(operation, env);
+ axis2_engine_resume_invocation_phases(engine, env, operation_specific_phases, msg_ctx);
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ return AXIS2_SUCCESS;
+ }
+ }
+ }
+ else
+ {
+ axis2_engine_invoke_phases(engine, env, pre_calculated_phases, msg_ctx);
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ return AXIS2_SUCCESS;
+ }
+
+ axis2_engine_verify_ctx_built(engine, env, msg_ctx); /* TODO : Chinthaka remove me. I'm redundant */
+ operation_ctx = AXIS2_MSG_CTX_GET_OPERATION_CTX(msg_ctx, env);
+ if (operation_ctx)
+ {
+ operation = AXIS2_OPERATION_CTX_GET_OPERATION(operation_ctx, env);
+ operation_specific_phases = AXIS2_OPERATION_GET_REMAINING_PHASES_INFLOW(operation, env);
+ axis2_engine_invoke_phases(engine, env, operation_specific_phases, msg_ctx);
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ return AXIS2_SUCCESS;
+ }
+ }
+ }
+
+ if ( (AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env)) && !(AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env)))
+ {
+ /* invoke the Message Receivers */
+ axis2_msg_recv_t *receiver = AXIS2_OPERATION_GET_MSG_RECEIVER(operation, env);
+ AXIS2_MSG_RECV_RECEIVE(receiver, env, msg_ctx);
+ }
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Sends the SOAP Fault to another SOAP node.
+ *
+ * @param msg_ctx
+ * @throws AxisFault
+ */
+axis2_status_t AXIS2_CALL axis2_engine_send_fault(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_operation_ctx_t *operation_ctx = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ operation_ctx = AXIS2_MSG_CTX_GET_OPERATION_CTX(msg_ctx, env);
+
+ /* find and execute the Fault Out Flow Handlers */
+ if (operation_ctx)
+ {
+ axis2_operation_t *operation = AXIS2_OPERATION_CTX_GET_OPERATION(operation_ctx, env);
+ axis2_array_list_t *phases = AXIS2_OPERATION_GET_PHASES_OUTFLOW(operation, env);
+
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ axis2_engine_resume_invocation_phases(engine, env, phases, msg_ctx);
+ }
+ else
+ {
+ axis2_engine_invoke_phases(engine, env, phases, msg_ctx);
+ }
+ }
+ /* it is possible that operation context is NULL as the error occered before the
+ dispatcher. We do not run Handlers in that case */
+
+ if (!(AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env)))
+ {
+ /* actually send the SOAP Fault*/
+ /* TODO axis2_transport_out_desc_t *transport_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx, env);
+ axis2_tranport_sender_t *transport_sender = AXIS2_TRANSPORT_OUT_DESC_GET_SENDER(transport_out, env);
+ AXIS2_TRANSPORT_SENDER_INVOKE(transport_sender, env, msg_ctx);*/
+ }
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * This is invoked when a SOAP Fault is received from a Other SOAP Node
+ * Receives a SOAP fault from another SOAP node.
+ *
+ * @param msg_ctx
+ * @throws AxisFault
+ */
+axis2_status_t AXIS2_CALL axis2_engine_receive_fault(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_operation_ctx_t *operation_ctx = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ operation_ctx = AXIS2_MSG_CTX_GET_OPERATION_CTX(msg_ctx, env);
+
+ if (!operation_ctx)
+ {
+ /* if we do not have an operation context that means this may be an incoming
+ dual channel response. So try to dispatch the service */
+ axis2_conf_ctx_t *conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+ if (conf_ctx)
+ {
+ axis2_engine_config_t *engine_config = AXIS2_CONF_CTX_GET_ENGINE_CONFIG(conf_ctx, env);
+ if (engine_config)
+ {
+ axis2_array_list_t *phases = AXIS2_ENGINE_CONFIG_GET_IN_PHASES_UPTO_AND_INCLUDING_POST_DISPATCH(engine_config, env);
+ if (phases)
+ {
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ axis2_engine_resume_invocation_phases(engine, env, phases, msg_ctx);
+ }
+ else
+ {
+ axis2_engine_invoke_phases(engine, env, phases, msg_ctx);
+ }
+ axis2_engine_verify_ctx_built(engine, env, msg_ctx);
+ }
+ }
+ }
+ }
+
+ operation_ctx = AXIS2_MSG_CTX_GET_OPERATION_CTX(msg_ctx, env);
+ /* find and execute the fault in flow handlers */
+ if (operation_ctx)
+ {
+ axis2_operation_t *operation = AXIS2_OPERATION_CTX_GET_OPERATION(operation_ctx, env);
+ axis2_array_list_t *phases = AXIS2_OPERATION_GET_PHASES_IN_FAULT_FLOW(operation, env);
+ if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
+ {
+ axis2_engine_resume_invocation_phases(engine, env, phases, msg_ctx);
+ }
+ else
+ {
+ axis2_engine_invoke_phases(engine, env, phases, msg_ctx);
+ }
+ }
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * This method is called to handle any error that occurs at inflow or outflow. But if the
+ * method is called twice, it implies that sending the error handling has failed, in which case
+ * the method logs the error and exists.
+ *
+ * @param processingContext
+ * @param e
+ * @throws AxisFault
+ */
+axis2_msg_ctx_t* AXIS2_CALL axis2_engine_create_fault_msg_ctx(struct axis2_engine *engine, axis2_env_t **env,
+ axis2_msg_ctx_t *processing_context)
+{
+ axis2_msg_ctx_t *fault_ctx = NULL;
+ axis2_engine_impl_t *engine_impl = NULL;
+ axis2_endpoint_ref_t *fault_to = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, processing_context, AXIS2_FAILURE);
+
+ engine_impl = AXIS2_INTF_TO_IMPL(engine);
+
+ if (AXIS2_MSG_CTX_GET_PROCESS_FAULT(processing_context, env))
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_STATE_PROCESSING_FAULT_ALREADY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ fault_ctx = axis2_msg_ctx_create(env, engine_impl->conf_ctx,
+ AXIS2_MSG_CTX_GET_TRANSPORT_IN_DESC(processing_context, env),
+ AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(processing_context, env),
+ AXIS2_MSG_CTX_GET_SESSION_CTX(processing_context, env));
+
+ AXIS2_MSG_CTX_SET_PROCESS_FAULT(fault_ctx, env, AXIS2_TRUE);
+
+ fault_to = AXIS2_MSG_CTX_GET_FAULT_TO(processing_context, env);
+ if (fault_to)
+ {
+ AXIS2_MSG_CTX_SET_FAULT_TO(fault_ctx, env, fault_to);
+ }
+ else
+ {
+ /** TODO void *writer = AXIS2_MSG_CTX_GET_PROPERTY(processing_context, env, AXIS2_TRANSPORT_OUT, AXIS2_TRUE);
+ if (writer)
+ {
+ AXIS2_MSG_CTX_SET_PROPERTY(fault_ctx, env, AXIS2_TRANSPORT_OUT, writer);
+ }
+ else
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NOWHERE_TO_SEND_FAULT, AXIS2_FAILURE);
+ return NULL;
+ }*/
+ }
+
+ AXIS2_MSG_CTX_SET_OPERATION_CTX(fault_ctx, env, AXIS2_MSG_CTX_GET_OPERATION_CTX(processing_context, env));
+ AXIS2_MSG_CTX_SET_PROCESS_FAULT(fault_ctx, env, AXIS2_TRUE);
+ AXIS2_MSG_CTX_SET_SERVER_SIDE(fault_ctx, env, AXIS2_TRUE);
+ /*AXIS2_MSG_CTX_SET_PROPERTY(fault_ctx, env, AXIS2_HTTP_OUT_TRANSPORT_INFO,
+ AXIS2_MSG_CTX_GET_PROPERTY(processing_context, env, AXIS2_HTTP_OUT_TRANSPORT_INFO, AXIS2_TRUE) );*/
+
+ /** TODO
+ axis2_soap_envelope_t *envelope = NULL;
+ if (AXIS2_MSG_CTX_GET_IS_SOAP_11(processing_context, env))
+ {
+ envelope = axis2_create_default_fault_soap_envilope(env, AXIS2_SOAP_11);
+
+ }
+ else
+ {
+ envelope = axis2_create_default_fault_soap_envilope(env, AXIS2_SOAP_12);
+ }
+
+ if (envelope)
+ {
+ axis2_soap_body_t *body = AXIS2_SOAP_ENVELOPE_GET_BODY(envelope, env);
+ if (body)
+ {
+ axis2_soap_fault_t *fault = AXIS2_SOAP_BODY_GET_FAULT(body, env);
+
+ }
+ extract_fault_info_from_msg_ctx( engine, env,
+ processing_context,fault);
+ }
+ else
+ {
+ return NULL;
+ }
+
+ AXIS2_MSG_CTX_SET_ENVELOPE(fault_ctx, env, envelope);
+ AXIS2_MSG_CTX_SET_PROPERTY(fault_ctx, env, AXIS2_HTTP_OUT_TRANSPORT_INFO,
+ AXIS2_MSG_CTX_GET_PROPERTY(processing_context, env, AXIS2_HTTP_OUT_TRANSPORT_INFO, AXIS2_TRUE) );*/
+ return fault_ctx;
+}
+
+/**
+ * Information to create the SOAPFault can be extracted from different places.
+ * 1. Those information may have been put in to the message context by some handler. When someone
+ * is putting like that, he must make sure the SOAPElements he is putting must be from the
+ * correct SOAP Version.
+ * 2. SOAPProcessingException is flexible enough to carry information about the fault. For example
+ * it has an attribute to store the fault code. The fault reason can be extracted from the
+ * message of the exception. I opted to put the stacktrace under the detail element.
+ * eg : <Detail>
+ * <Exception> stack trace goes here </Exception>
+ * <Detail>
+ * <p/>
+ * If those information can not be extracted from any of the above places, I default the soap
+ * fault values to following.
+ * <Fault>
+ * <Code>
+ * <Value>env:Receiver</Value>
+ * </Code>
+ * <Reason>
+ * <Text>unknown</Text>
+ * </Reason>
+ * <Role/>
+ * <Node/>
+ * <Detail/>
+ * </Fault>
+ * <p/>
+ * -- EC
+ *
+ * @param context
+ * @param fault
+ * @param e
+ */
+axis2_status_t AXIS2_CALL axis2_engine_extract_fault_info_from_msg_ctx(
+ struct axis2_engine *engine, axis2_env_t **env,
+ axis2_msg_ctx_t *msg_ctx,
+ struct axis2_soap_fault *fault)
+{
+ /*axis2_char_t *soap_namespace_uri = NULL;*/
+
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, fault, AXIS2_FAILURE);
+
+ /* get the current SOAP version */
+ /*if (AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
+ {
+ soap_namespace_uri = AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI;
+ }
+ else
+ {
+ soap_namespace_uri = AXI2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+ }
+
+ void *fault_code = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, AXIS2_SOAP12_SOAP_FAULT_CODE_LOCAL_NAME);
+ axis2_char_t *soap_fault_code = "";
+ if (fault_code)
+ {
+ AXIS2_SOAP_FAULT_SET_CODE(fault, env, fault_code);
+ }*/
+
+ /* defaulting to fault code Sender, if no message is available */
+ /*soap_fault_code = get_sender_fault_code(soap_namespace_uri);
+ fault.getCode().getValue().setText(soap_fault_code);
+
+ void *fault_Reason = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, AXIS2_SOAP12_SOAP_FAULT_REASON_LOCAL_NAME);
+ axis2_char_t * message = "";
+ if (fault_Reason)
+ {
+ AXIS2_SOAP_FAULT_SET_REASON(fault, env, fault_Reason);
+ }
+*/
+ /* defaulting to reason, unknown, if no reason is available */
+ /* message = "unknown";
+ fault.getReason().getSOAPText().setText(message);
+
+ void *fault_role = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, AXIS2_SOAP12_SOAP_FAULT_ROLE_LOCAL_NAME);
+ if (fault_role)
+ {
+ fault.getRole().setText((axis2_char_t *) fault_role);
+ }
+ else
+ {
+ get the role of this server and assign it here
+ fault.getRole().setText("http://myAxisServer/role/default");
+ }
+
+ void *fault_node = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, AXIS2_SOAP12_SOAP_FAULT_NODE_LOCAL_NAME);
+ if (fault_node)
+ {
+ fault.getNode().setText((axis2_char_t *) fault_node);
+ }
+ else
+ {
+ get the node of this server and assign it here
+ fault.getNode().setText("http://myAxisServer/role/default");
+ }
+
+ void *fault_detail = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, AXIS2_SOAP12_SOAP_FAULT_DETAIL_LOCAL_NAME);
+ if (fault_detail)
+ {
+ AXIS2_SOAP_FAULT_SET_DETAIL(fault, env, fault_detail);
+ }
+ */
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL axis2_engine_verify_ctx_built(struct axis2_engine *engine, axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ if (AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env))
+ {
+ return AXIS2_FAILURE;
+ }
+ if (AXIS2_MSG_CTX_GET_OPERATION_CTX(msg_ctx, env))
+ {
+ return AXIS2_FAILURE;
+ }
+ if (AXIS2_MSG_CTX_GET_SVC_CTX(msg_ctx, env))
+ {
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL axis2_engine_invoke_phases(struct axis2_engine *engine, axis2_env_t **env, axis2_array_list_t *phases, axis2_msg_ctx_t *msg_ctx)
+{
+ int i = 0;
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, phases, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ int count = AXIS2_ARRAY_LIST_SIZE(phases, env);
+ for (i = 0; (i < count && !(AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))); i++)
+ {
+ axis2_phase_t *phase = (axis2_phase_t *) AXIS2_ARRAY_LIST_GET(phases, env, i);
+ AXIS2_PHASE_INVOKE(phase, env, msg_ctx);
+ }
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL axis2_engine_resume_invocation_phases(struct axis2_engine *engine, axis2_env_t **env, axis2_array_list_t *phases, axis2_msg_ctx_t *msg_ctx)
+{
+ int i = 0;
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, phases, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ AXIS2_MSG_CTX_SET_PAUSED(msg_ctx, env, AXIS2_FALSE);
+
+ int count = AXIS2_ARRAY_LIST_SIZE(phases, env);
+ axis2_bool_t found_match = AXIS2_FALSE;
+
+ for (i = 0; i < count && !(AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env)); i++)
+ {
+ axis2_phase_t *phase = (axis2_phase_t *) AXIS2_ARRAY_LIST_GET(phases, env, i);
+ axis2_char_t* phase_name = AXIS2_PHASE_GET_NAME(phase, env);
+ axis2_char_t* paused_phase_name = AXIS2_MSG_CTX_GET_PAUSED_PHASE_NAME(msg_ctx, env);
+ if (phase_name && paused_phase_name)
+ {
+ if (AXIS2_STRCMP(phase_name, paused_phase_name) == 0)
+ {
+ found_match = AXIS2_TRUE;
+ AXIS2_PHASE_INVOKE_START_FROM_HANDLER(phase, env, AXIS2_MSG_CTX_GET_PAUSED_HANDLER_NAME(msg_ctx, env), msg_ctx);
+ }
+ }
+ else
+ {
+ if (found_match)
+ {
+ AXIS2_PHASE_INVOKE(phase, env, msg_ctx);
+ }
+
+ }
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_char_t* AXIS2_CALL axis2_engine_get_sender_fault_code(struct axis2_engine *engine, axis2_env_t **env, axis2_char_t *soap_namespace)
+{
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, soap_namespace, AXIS2_FAILURE);
+
+ /*if (AXIS2_STRCMP(AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI, soap_namespace))
+ return AXIS2_SOAP12_FAULT_CODE_SENDER;
+ else
+ return AXIS2_SOAP11_FAULT_CODE_SENDER;
+ */
+ return NULL;
+}
+
+axis2_char_t* AXIS2_CALL axis2_engine_get_receiver_fault_code(struct axis2_engine *engine, axis2_env_t **env, axis2_char_t *soap_namespace)
+{
+ AXIS2_FUNC_PARAM_CHECK(engine, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, soap_namespace, AXIS2_FAILURE);
+
+ /*if (AXIS2_STRCMP(AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI, soap_namespace))
+ return AXIS2_SOAP12_FAULT_CODE_RECEIVER;
+ else
+ return AXIS2_SOAP11_FAULT_CODE_RECEIVER;*/
+ return NULL;
+}