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 2006/01/24 05:37:44 UTC
svn commit: r371809 - in /webservices/axis2/trunk/c: include/
modules/core/context/ modules/core/engine/ modules/core/receivers/
modules/core/transport/http/server/
Author: samisa
Date: Mon Jan 23 20:37:27 2006
New Revision: 371809
URL: http://svn.apache.org/viewcvs?rev=371809&view=rev
Log:
More fixes to get the simple axis server working. Added the ctx_handler, equivalant of Instance Dispatcher
Added:
webservices/axis2/trunk/c/modules/core/engine/ctx_handler.c
Modified:
webservices/axis2/trunk/c/include/axis2_handler.h
webservices/axis2/trunk/c/modules/core/context/conf_ctx.c
webservices/axis2/trunk/c/modules/core/context/msg_ctx.c
webservices/axis2/trunk/c/modules/core/engine/Makefile.am
webservices/axis2/trunk/c/modules/core/engine/conf.c
webservices/axis2/trunk/c/modules/core/engine/disp_checker.c
webservices/axis2/trunk/c/modules/core/engine/engine.c
webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c
webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c
webservices/axis2/trunk/c/modules/core/transport/http/server/Makefile.am
Modified: webservices/axis2/trunk/c/include/axis2_handler.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_handler.h?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_handler.h (original)
+++ webservices/axis2/trunk/c/include/axis2_handler.h Mon Jan 23 20:37:27 2006
@@ -133,6 +133,7 @@
* creates handler struct
*/
AXIS2_DECLARE(axis2_handler_t*) axis2_handler_create(axis2_env_t **env);
+AXIS2_DECLARE(axis2_handler_t*) axis2_ctx_handler_create(axis2_env_t **env, axis2_qname_t *qname);
#define AXIS2_HANDLER_FREE(handler, env) ((handler)->ops->free(handler, env))
#define AXIS2_HANDLER_INIT(handler, env, handler_desc) ((handler)->ops->init(handler, env, handler_desc))
Modified: webservices/axis2/trunk/c/modules/core/context/conf_ctx.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/conf_ctx.c?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/conf_ctx.c (original)
+++ webservices/axis2/trunk/c/modules/core/context/conf_ctx.c Mon Jan 23 20:37:27 2006
@@ -518,8 +518,9 @@
/** TODO generate ID and set it*/
/*
svc_grp_ctx_id = UUIDGenerator.getUUID();
- msg_ctx.setServiceGroupContextId(svc_grp_ctx_id);
*/
+ svc_grp_ctx_id = "uuid_svc_grp";
+ AXIS2_MSG_CTX_SET_SVC_GRP_CTX_ID(msg_ctx, env, svc_grp_ctx_id);
}
if (!svc_grp_ctx)
@@ -550,3 +551,4 @@
AXIS2_MSG_CTX_SET_SVC_GRP_CTX(msg_ctx, env, svc_grp_ctx);
return svc_grp_ctx;
}
+
Modified: webservices/axis2/trunk/c/modules/core/context/msg_ctx.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/msg_ctx.c?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/modules/core/context/msg_ctx.c Mon Jan 23 20:37:27 2006
@@ -1788,8 +1788,16 @@
if (svc)
{
+ axis2_svc_grp_t *svc_grp = NULL;
AXIS2_INTF_TO_IMPL(msg_ctx)->svc = svc;
AXIS2_INTF_TO_IMPL(msg_ctx)->svc_qname = AXIS2_SVC_GET_QNAME(svc, env);
+
+ svc_grp = AXIS2_SVC_GET_PARENT(svc, env);
+ if (svc_grp)
+ {
+ AXIS2_INTF_TO_IMPL(msg_ctx)->svc_grp = svc_grp;
+ AXIS2_INTF_TO_IMPL(msg_ctx)->svc_grp_id = AXIS2_SVC_GRP_GET_NAME(svc_grp, env);
+ }
}
return AXIS2_SUCCESS;
Modified: webservices/axis2/trunk/c/modules/core/engine/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/Makefile.am?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/engine/Makefile.am Mon Jan 23 20:37:27 2006
@@ -11,7 +11,8 @@
disp.c \
soap_action_disp.c \
soap_body_disp.c \
- engine.c
+ ctx_handler.c \
+ engine.c
libaxis2_engine_la_LIBADD =
INCLUDES = -I$(top_builddir)/include \
Modified: webservices/axis2/trunk/c/modules/core/engine/conf.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/conf.c?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/conf.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/conf.c Mon Jan 23 20:37:27 2006
@@ -1605,18 +1605,13 @@
}
disp_checker = axis2_disp_checker_create(env, NULL);
-
- /* TODO uncomment this when instant dispatcher is available */
- /*
- InstanceDispatcher instanceDispatcher = new InstanceDispatcher();
- instanceDispatcher.getHandlerDesc().setParent(this);
- */
-
handler = AXIS2_DISP_CHECKER_GET_BASE(disp_checker, env);
AXIS2_PHASE_ADD_HANDLER_AT(post_dispatch, env, 0, handler);
handler = NULL;
+
+ handler = axis2_ctx_handler_create(env, NULL);
+ AXIS2_PHASE_ADD_HANDLER_AT(post_dispatch, env, 1, handler);
- /*postDispatch.addHandler(instanceDispatcher,1); */
status = AXIS2_ARRAY_LIST_ADD(config_impl->
in_phases_upto_and_including_post_dispatch, env, post_dispatch);
if(AXIS2_FAILURE == status)
Added: webservices/axis2/trunk/c/modules/core/engine/ctx_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/ctx_handler.c?rev=371809&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/ctx_handler.c (added)
+++ webservices/axis2/trunk/c/modules/core/engine/ctx_handler.c Mon Jan 23 20:37:27 2006
@@ -0,0 +1,152 @@
+/*
+ * 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_handler_desc.h>
+#include <axis2_qname.h>
+#include <axis2_svc.h>
+
+/**
+ * By the time the control comes to this handler, the dispatching must have happened
+ * so that the message context contains the AxisServiceGroup, AxisService and
+ * AxisOperation.
+ * This will then try to find the Contexts of ServiceGroup, Service and the Operation.
+ */
+
+axis2_status_t AXIS2_CALL axis2_ctx_handler_invoke(struct axis2_handler *handler,
+ axis2_env_t **env,
+ struct axis2_msg_ctx *msg_ctx);
+
+axis2_handler_t* AXIS2_CALL axis2_ctx_handler_create(axis2_env_t **env, axis2_qname_t *qname)
+{
+ axis2_handler_t *handler = NULL;
+ axis2_handler_desc_t *handler_desc = NULL;
+ axis2_qname_t *handler_qname = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ if (qname)
+ {
+ handler_qname = AXIS2_QNAME_CLONE(qname, env);
+ if (!(handler_qname))
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ }
+ else
+ {
+ /* create default qname */
+ handler_qname = axis2_qname_create(env, "context_handler",
+ "http://axis.ws.apache.org",
+ NULL);
+ if (!handler_qname)
+ {
+ return NULL;
+ }
+ }
+
+ handler = axis2_handler_create(env);
+ if (!handler)
+ {
+ return NULL;
+ }
+
+ /* handler desc of base handler */
+ handler_desc = axis2_handler_desc_create_with_qname(env, handler_qname);
+ if (!handler_desc)
+ {
+ AXIS2_HANDLER_FREE(handler, env);
+ return NULL;
+ }
+
+ AXIS2_HANDLER_INIT(handler, env, handler_desc);
+
+ /* set the base struct's invoke op */
+ if (handler->ops)
+ handler->ops->invoke = axis2_ctx_handler_invoke;
+
+ return handler;
+}
+
+
+axis2_status_t AXIS2_CALL axis2_ctx_handler_invoke(struct axis2_handler *handler,
+ axis2_env_t **env,
+ struct axis2_msg_ctx *msg_ctx)
+{
+ axis2_op_t *op = NULL;
+ axis2_svc_ctx_t *svc_ctx = NULL;
+ axis2_op_ctx_t *op_ctx = NULL;
+ axis2_svc_grp_ctx_t *svc_grp_ctx = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(handler, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+
+ op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env);
+ svc_ctx = AXIS2_MSG_CTX_GET_SVC_CTX(msg_ctx, env);
+
+ if (op_ctx && svc_ctx)
+ {
+ svc_grp_ctx = AXIS2_SVC_CTX_GET_PARENT(svc_ctx, env);
+ if (svc_grp_ctx)
+ {
+ AXIS2_MSG_CTX_SET_SVC_GRP_CTX_ID(msg_ctx, env, AXIS2_SVC_GRP_CTX_GET_ID(svc_grp_ctx, env));
+ }
+ return AXIS2_SUCCESS;
+ }
+
+ op = AXIS2_MSG_CTX_GET_OP(msg_ctx, env);
+
+ /* 1. look up opCtxt using mc.addressingHeaders.relatesTo[0] */
+ op_ctx = AXIS2_OP_FIND_FOR_EXISTING_OP_CTX(op, env, msg_ctx);
+
+ if (op_ctx)
+ {
+ AXIS2_OP_REGISTER_OP_CTX(op, env, msg_ctx, op_ctx);
+ svc_ctx = AXIS2_OP_CTX_GET_PARENT(op_ctx, env);
+ if (svc_ctx)
+ {
+ svc_grp_ctx = AXIS2_SVC_CTX_GET_PARENT(svc_ctx, env);
+ AXIS2_MSG_CTX_SET_SVC_CTX(msg_ctx, env, svc_ctx);
+ AXIS2_MSG_CTX_SET_SVC_GRP_CTX(msg_ctx, env, svc_grp_ctx);
+ AXIS2_MSG_CTX_SET_SVC_GRP_CTX_ID(msg_ctx, env, AXIS2_SVC_GRP_CTX_GET_ID(svc_grp_ctx, env));
+ }
+ return AXIS2_SUCCESS;
+ }
+ else /* 2. if no op_ctx, create new op_ctx */
+ {
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ op_ctx = axis2_op_ctx_create(env, op, NULL);
+ if (!op_ctx)
+ {
+ return AXIS2_FAILURE;
+ }
+
+ AXIS2_MSG_CTX_SET_OP_CTX(msg_ctx, env, op_ctx);
+
+ AXIS2_OP_REGISTER_OP_CTX(op, env, msg_ctx, op_ctx);
+
+ conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+ if (conf_ctx)
+ {
+ svc_grp_ctx = AXIS2_CONF_CTX_FILL_CTXS(conf_ctx, env, msg_ctx);
+ if (svc_grp_ctx)
+ return AXIS2_SUCCESS;
+ }
+
+ }
+
+ return AXIS2_FAILURE;
+}
Modified: webservices/axis2/trunk/c/modules/core/engine/disp_checker.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/disp_checker.c?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/disp_checker.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/disp_checker.c Mon Jan 23 20:37:27 2006
@@ -246,8 +246,6 @@
else
AXIS2_LOG(env, "NULL ", AXIS2_LOG_INFO);
- AXIS2_LOG(env, "\n", AXIS2_LOG_INFO);
-
return AXIS2_FAILURE;
}
@@ -262,10 +260,8 @@
else
AXIS2_LOG(env, "NULL ", AXIS2_LOG_INFO);
- AXIS2_LOG(env, "\n", AXIS2_LOG_INFO);
AXIS2_LOG(env, " and WSA Action = ", AXIS2_LOG_INFO);
AXIS2_LOG(env, AXIS2_MSG_CTX_GET_WSA_ACTION(msg_ctx, env), AXIS2_LOG_INFO);
- AXIS2_LOG(env, "\n", AXIS2_LOG_INFO);
return AXIS2_FAILURE;
}
Modified: webservices/axis2/trunk/c/modules/core/engine/engine.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/engine.c?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/engine.c Mon Jan 23 20:37:27 2006
@@ -619,15 +619,15 @@
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))
+ if (!AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env))
{
return AXIS2_FAILURE;
}
- if (AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env))
+ if (!AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env))
{
return AXIS2_FAILURE;
}
- if (AXIS2_MSG_CTX_GET_SVC_CTX(msg_ctx, env))
+ if (!AXIS2_MSG_CTX_GET_SVC_CTX(msg_ctx, env))
{
return AXIS2_FAILURE;
}
Modified: webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c Mon Jan 23 20:37:27 2006
@@ -170,7 +170,7 @@
AXIS2_LOG(env, url_tokens[1], AXIS2_LOG_INFO);
AXIS2_LOG(env, "\n", AXIS2_LOG_INFO);
op_qname = axis2_qname_create(env, url_tokens[1], NULL, NULL);
- op = AXIS2_SVC_GET_OP_WITH_QNAME(svc, env, op_qname);
+ op = AXIS2_SVC_GET_OP_WITH_NAME(svc, env, AXIS2_QNAME_GET_LOCALPART(op_qname, env));
AXIS2_QNAME_FREE(op_qname, env);
return op;
}
Modified: webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c (original)
+++ webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c Mon Jan 23 20:37:27 2006
@@ -209,7 +209,8 @@
}
scope_param = AXIS2_SVC_GET_PARAM(svc, env, AXIS2_SCOPE);
svc_qname = AXIS2_SVC_GET_QNAME(svc, env);
- param_value = AXIS2_PARAM_GET_VALUE(scope_param, env);
+ if (scope_param)
+ param_value = AXIS2_PARAM_GET_VALUE(scope_param, env);
/* TODO
* This part is left until session_ctx is implemented or this will before
* totally removed???
Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/Makefile.am?rev=371809&r1=371808&r2=371809&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/Makefile.am Mon Jan 23 20:37:27 2006
@@ -4,7 +4,7 @@
AM_CPPFLAGS = $(CPPFLAGS) -g -pthread
axis2_http_server_SOURCES = http_server_main.c
-axis2_http_server_LDADD = $(LDFLAGS) -laxis2_util -laxis2_http_transport -laxis2_context -laxis2_addr -laxis2_om -laxis2_engine -laxis2_description -laxis2_soap -laxis2_wsdl -laxis2_phaseresolver -laxis2_deployment -laxis2_libxml2 -laxis2_http_sender -laxis2_http_receiver -lxml2\
+axis2_http_server_LDADD = $(LDFLAGS) -laxis2_util -laxis2_http_transport -laxis2_context -laxis2_addr -laxis2_om -laxis2_engine -laxis2_description -laxis2_soap -laxis2_wsdl -laxis2_phaseresolver -laxis2_core_util -laxis2_deployment -laxis2_libxml2 -laxis2_http_sender -laxis2_http_receiver -lxml2\
-L$(top_builddir)/modules/util/.libs\
-L$(top_builddir)/modules/wsdl/.libs\
-L$(top_builddir)/modules/core/description/.libs\
@@ -13,6 +13,7 @@
-L$(top_builddir)/modules/core/addr/.libs\
-L$(top_builddir)/modules/core/engine/.libs\
-L$(top_builddir)/modules/core/phaseresolver/.libs\
+-L$(top_builddir)/modules/core/util/.libs\
-L$(top_builddir)/modules/core/transport/http/.libs\
-L$(top_builddir)/modules/core/transport/http/sender/.libs\
-L$(top_builddir)/modules/core/transport/http/receiver/.libs\