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/28 04:48:10 UTC
svn commit: r359375 - in /webservices/axis2/trunk/c: include/axis2_error.h
include/axis2_soap_envelope.h modules/core/context/src/Makefile.am
modules/core/context/src/msg_ctx.c modules/xml/soap/src/soap_envelope.c
Author: samisa
Date: Tue Dec 27 19:47:59 2005
New Revision: 359375
URL: http://svn.apache.org/viewcvs?rev=359375&view=rev
Log:
Added SOAP envelope logic in message context
Modified:
webservices/axis2/trunk/c/include/axis2_error.h
webservices/axis2/trunk/c/include/axis2_soap_envelope.h
webservices/axis2/trunk/c/modules/core/context/src/Makefile.am
webservices/axis2/trunk/c/modules/core/context/src/msg_ctx.c
webservices/axis2/trunk/c/modules/xml/soap/src/soap_envelope.c
Modified: webservices/axis2/trunk/c/include/axis2_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_error.h?rev=359375&r1=359374&r2=359375&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_error.h (original)
+++ webservices/axis2/trunk/c/include/axis2_error.h Tue Dec 27 19:47:59 2005
@@ -312,7 +312,9 @@
AXIS2_ERROR_INVALID_VALUE_FOUND_IN_MUST_UNDERSTAND,
/** only one SOAP fault allowed in SOAP body */
- AXIS2_ERROR_ONLY_ONE_SOAP_FAULT_ALLOWED_IN_BODY
+ AXIS2_ERROR_ONLY_ONE_SOAP_FAULT_ALLOWED_IN_BODY,
+ /** Invalid SOAP envelope state */
+ AXIS2_ERROR_INVALID_SOAP_ENVELOPE_STATE
};
/** @} */
Modified: webservices/axis2/trunk/c/include/axis2_soap_envelope.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap_envelope.h?rev=359375&r1=359374&r2=359375&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_envelope.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_envelope.h Tue Dec 27 19:47:59 2005
@@ -107,6 +107,8 @@
axis2_env_t **env, struct axis2_soap_body *body);
axis2_status_t (AXIS2_CALL *set_header)(axis2_soap_envelope_t *envelope,
axis2_env_t **env, struct axis2_soap_header *header);
+ axis2_om_namespace_t* (AXIS2_CALL *get_namespace)(axis2_soap_envelope_t *envelope,
+ axis2_env_t **env);
};
@@ -140,6 +142,7 @@
#define AXIS2_SOAP_ENVELOPE_SET_SOAP_VERSION(envelope, env, soap_version) ((envelope)->ops->set_soap_version(envelope, env, soap_version))
#define AXIS2_SOAP_ENVELOPE_SET_BODY(envelope, env, body) ((envelope)->ops->set_body(envelope, env, body))
#define AXIS2_SOAP_ENVELOPE_SET_HEADER(envelope, env, header) ((envelope)->ops->set_header(envelope, env, header))
+#define AXIS2_SOAP_ENVELOPE_GET_NAMESPACE(envelope, env) ((envelope)->ops->get_namespace(envelope, env))
/** @} */
Modified: webservices/axis2/trunk/c/modules/core/context/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/src/Makefile.am?rev=359375&r1=359374&r2=359375&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/context/src/Makefile.am Tue Dec 27 19:47:59 2005
@@ -9,7 +9,7 @@
libaxis2_context_la_LIBADD =
INCLUDES = -I${CUTEST_HOME}/include \
- -I$(top_builddir)/modules/xml/guththila/src \
+ -I$(top_builddir)/modules/xml/parser \
-I$(top_builddir)/include \
-I$(top_builddir)/modules/util/src \
-I$(top_builddir)/modules/wsdl/src \
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=359375&r1=359374&r2=359375&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 Tue Dec 27 19:47:59 2005
@@ -22,6 +22,8 @@
#include <axis2_conf.h>
#include <axis2_transport_in_desc.h>
#include <axis2_transport_out_desc.h>
+#include <axis2_soap_envelope.h>
+#include <axis2_soap.h>
typedef struct axis2_msg_ctx_impl axis2_msg_ctx_impl_t;
@@ -63,7 +65,7 @@
axis2_transport_out_desc_t *transport_out_desc;
/** SOAP envelope */
- struct axis2_soap_envelope *soap_envelope;
+ axis2_soap_envelope_t *soap_envelope;
/** response written? */
axis2_bool_t response_written;
/** in fault flow? */
@@ -139,7 +141,7 @@
axis2_bool_t AXIS2_CALL
axis2_msg_ctx_get_in_fault_flow(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env);
-struct axis2_soap_envelope* AXIS2_CALL
+axis2_soap_envelope_t* AXIS2_CALL
axis2_msg_ctx_get_soap_envelope(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env);
axis2_char_t* AXIS2_CALL
@@ -179,7 +181,7 @@
axis2_status_t AXIS2_CALL
axis2_msg_ctx_set_envelope(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env,
- struct axis2_soap_envelope *soap_envelope);
+ axis2_soap_envelope_t *soap_envelope);
axis2_status_t AXIS2_CALL
axis2_msg_ctx_set_message_id(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env,
@@ -756,7 +758,7 @@
return AXIS2_INTF_TO_IMPL(msg_ctx)->in_fault_flow;
}
-struct axis2_soap_envelope *AXIS2_CALL axis2_msg_ctx_get_soap_envelope(struct axis2_msg_ctx *msg_ctx,
+axis2_soap_envelope_t* AXIS2_CALL axis2_msg_ctx_get_soap_envelope(struct axis2_msg_ctx *msg_ctx,
axis2_env_t **env)
{
AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, NULL);
@@ -899,31 +901,37 @@
}
axis2_status_t AXIS2_CALL axis2_msg_ctx_set_envelope(struct axis2_msg_ctx *msg_ctx,
- axis2_env_t **env, struct axis2_soap_envelope *soap_envelope)
+ axis2_env_t **env, axis2_soap_envelope_t *soap_envelope)
{
AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, AXIS2_FAILURE);
if (soap_envelope)
{
+ axis2_om_namespace_t *ns = NULL;
+ axis2_char_t *soap_ns = NULL;
+
AXIS2_INTF_TO_IMPL(msg_ctx)->soap_envelope = soap_envelope ;
- /*
- axis2_char_t *soapNamespaceURI = soap_envelopegetNamespace()getName();
- if (SOAP12Constants
- .SOAP_ENVELOPE_NAMESPACE_URI
- .equals(soapNamespaceURI))
+ ns = AXIS2_SOAP_ENVELOPE_GET_NAMESPACE(soap_envelope, env);
+ if (ns)
{
- is_soap_11 = AXIS2_FALSE;
- }
- else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
- soapNamespaceURI))
- {
- is_soap_11 = AXIS2_TRUE;
- }
- else
- {
- // set error
+ soap_ns = AXIS2_OM_NAMESPACE_GET_URI(ns, env);
+ if (soap_ns)
+ {
+ if (AXIS2_STRCASECMP(soap_ns, AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI) == 0)
+ AXIS2_INTF_TO_IMPL(msg_ctx)->is_soap_11 = AXIS2_FALSE;
+ else if (AXIS2_STRCASECMP(soap_ns, AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI) == 0)
+ AXIS2_INTF_TO_IMPL(msg_ctx)->is_soap_11 = AXIS2_TRUE;
+ else
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_SOAP_VERSION, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+ }
}
- */
+
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_SOAP_ENVELOPE_STATE, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
}
return AXIS2_SUCCESS;
Modified: webservices/axis2/trunk/c/modules/xml/soap/src/soap_envelope.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/src/soap_envelope.c?rev=359375&r1=359374&r2=359375&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/src/soap_envelope.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/src/soap_envelope.c Tue Dec 27 19:47:59 2005
@@ -71,6 +71,8 @@
axis2_env_t **env, axis2_soap_body_t *body);
axis2_status_t AXIS2_CALL axis2_soap_envelope_set_header(axis2_soap_envelope_t *envelope,
axis2_env_t **env, axis2_soap_header_t *header);
+axis2_om_namespace_t* AXIS2_CALL axis2_soap_envelope_get_namespace(axis2_soap_envelope_t *envelope,
+ axis2_env_t **env);
/*************** function implementations *************************************/
@@ -120,6 +122,7 @@
envelope_impl->soap_envelope.ops->get_base = axis2_soap_envelope_get_base;
envelope_impl->soap_envelope.ops->get_soap_version = axis2_soap_envelope_get_soap_version;
envelope_impl->soap_envelope.ops->set_soap_version = axis2_soap_envelope_set_soap_version;
+ envelope_impl->soap_envelope.ops->get_namespace = axis2_soap_envelope_get_namespace;
return &(envelope_impl->soap_envelope);
}
@@ -328,4 +331,26 @@
/* TODO set an error here as there can be only one header */
}
return AXIS2_SUCCESS;
+}
+
+axis2_om_namespace_t* AXIS2_CALL axis2_soap_envelope_get_namespace(axis2_soap_envelope_t *envelope,
+ axis2_env_t **env)
+{
+ axis2_soap_envelope_impl_t *envelope_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(envelope, env, NULL);
+ envelope_impl = AXIS2_INTF_TO_IMPL(envelope);
+
+ if (envelope_impl->base)
+ {
+ axis2_om_element_t *ele = NULL;
+ if (AXIS2_OM_NODE_GET_NODE_TYPE(envelope_impl->base, env) == AXIS2_OM_ELEMENT)
+ {
+ ele = (axis2_om_element_t*)AXIS2_OM_NODE_GET_DATA_ELEMENT(envelope_impl->base, env);
+ if (ele)
+ {
+ return AXIS2_OM_ELEMENT_GET_NAMESPACE(ele, env);
+ }
+ }
+ }
+ return NULL;
}