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 na...@apache.org on 2006/01/03 10:28:41 UTC
svn commit: r365588 - in /webservices/axis2/trunk/c:
include/axis2_soap_envelope.h include/axis2_soap_message.h
modules/xml/soap/soap_envelope.c modules/xml/soap/soap_message.c
Author: nandika
Date: Tue Jan 3 01:28:25 2006
New Revision: 365588
URL: http://svn.apache.org/viewcvs?rev=365588&view=rev
Log:
soap_message added
Added:
webservices/axis2/trunk/c/modules/xml/soap/soap_message.c
Modified:
webservices/axis2/trunk/c/include/axis2_soap_envelope.h
webservices/axis2/trunk/c/include/axis2_soap_message.h
webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c
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=365588&r1=365587&r2=365588&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_envelope.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_envelope.h Tue Jan 3 01:28:25 2006
@@ -151,6 +151,9 @@
*/
AXIS2_DECLARE(axis2_soap_envelope_t*)
axis2_soap_envelope_create(axis2_env_t **env, axis2_om_namespace_t *ns);
+
+AXIS2_DECLARE(axis2_soap_envelope_t*)
+axis2_soap_envelope_create_null(axis2_env_t **env);
/******************** Macros **************************************************/
Modified: webservices/axis2/trunk/c/include/axis2_soap_message.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap_message.h?rev=365588&r1=365587&r2=365588&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_message.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_message.h Tue Jan 3 01:28:25 2006
@@ -24,6 +24,7 @@
*/
#include <axis2_env.h>
#include <axis2_soap_envelope.h>
+#include <axis2_om_document.h>
#ifdef __cplusplus
extern "C"
@@ -65,6 +66,11 @@
(axis2_soap_message_t *message,
axis2_env_t **env,
axis2_soap_envelope_t *envelope);
+
+ axis2_status_t (AXIS2_CALL *serialize)(axis2_soap_message_t *message,
+ axis2_env_t **env);
+
+
};
/**
@@ -82,8 +88,9 @@
* creates a soap message struct
* @param env Environment. MUST NOT be NULL
*/
- AXIS2_DECLARE(axis2_soap_message_t *)
- axis2_soap_message_create (axis2_env_t **env);
+AXIS2_DECLARE(axis2_soap_message_t *)
+axis2_soap_message_create(axis2_env_t **env,
+ axis2_om_document_t *om_document);
/******************** Macros **************************************************/
@@ -96,8 +103,10 @@
((message)->ops->get_envelope(message, env))
#define AXIS2_SOAP_MESSAGE_SET_SOAP_ENVELOPE(message, env, envelope) \
- ((message)->ops->get_envelope(message, env, envelope))
+ ((message)->ops->set_envelope(message, env, envelope))
+#define AXIS2_SOAP_MESSAGE_SERIALIZE(message, env) \
+ ((message)->ops->serialize(message, env))
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c?rev=365588&r1=365587&r2=365588&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c Tue Jan 3 01:28:25 2006
@@ -102,7 +102,49 @@
/*************** function implementations *************************************/
-axis2_soap_envelope_t* AXIS2_CALL
+AXIS2_DECLARE(axis2_soap_envelope_t*)
+axis2_soap_envelope_create_null(axis2_env_t **env)
+{
+ axis2_soap_envelope_impl_t *envelope_impl = NULL;
+ axis2_om_element_t *ele = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+ envelope_impl = (axis2_soap_envelope_impl_t*)AXIS2_MALLOC(
+ (*env)->allocator,
+ sizeof(axis2_soap_envelope_impl_t));
+ if(!envelope_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ envelope_impl->soap_envelope.ops = NULL;
+ envelope_impl->om_ele_node = NULL;
+ envelope_impl->soap_version = AXIS2_SOAP12;
+ envelope_impl->header = NULL;
+ envelope_impl->body = NULL;
+
+ envelope_impl->soap_envelope.ops = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_soap_envelope_ops_t) );
+ if (!envelope_impl->soap_envelope.ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ axis2_soap_envelope_free(&(envelope_impl->soap_envelope), env);
+ return NULL;
+ }
+
+ envelope_impl->soap_envelope.ops->get_header = axis2_soap_envelope_get_header;
+ envelope_impl->soap_envelope.ops->add_header = axis2_soap_envelope_add_header;
+ envelope_impl->soap_envelope.ops->get_body = axis2_soap_envelope_get_body;
+ envelope_impl->soap_envelope.ops->serialize = axis2_soap_envelope_serialize;
+ envelope_impl->soap_envelope.ops->free = axis2_soap_envelope_free;
+ envelope_impl->soap_envelope.ops->get_base_node = axis2_soap_envelope_get_base_node;
+ 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);
+}
+
+
+AXIS2_DECLARE(axis2_soap_envelope_t*)
axis2_soap_envelope_create(axis2_env_t **env, axis2_om_namespace_t *ns)
{
axis2_soap_envelope_impl_t *envelope_impl = NULL;
@@ -239,17 +281,57 @@
axis2_env_t **env)
{
axis2_soap_envelope_impl_t *envelope_impl = NULL;
+ axis2_qname_t *header_qn = NULL;
+ axis2_om_node_t *header_node = NULL;
+ axis2_om_element_t *header_ele = NULL;
+ axis2_om_element_t *envelope_ele = NULL;
+
+
AXIS2_FUNC_PARAM_CHECK(envelope, env, NULL);
envelope_impl = AXIS2_INTF_TO_IMPL(envelope);
- /* TODO axis2_soap_header_t *header =
- (SOAPHeader)getFirstChildWithName(
- new QName(SOAPConstants.HEADER_LOCAL_NAME));
- if (builder == null && header == null) {
- header = factory.createSOAPHeader(this);
- addChild(header);
+ if(envelope_impl->header)
+ {
+ return envelope_impl->header;
+ }
+ else
+ {
+ envelope_impl->header = axis2_soap_header_create(env);
+ envelope_ele = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(
+ envelope_impl->om_ele_node, env);
+ header_qn = axis2_qname_create(env, AXIS2_SOAP_HEADER_LOCAL_NAME, NULL, NULL);
+ if(!header_qn)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ header_ele = AXIS2_OM_ELEMENT_GET_FIRST_CHILD_WITH_QNAME(envelope_ele,
+ env, header_qn, envelope_impl->om_ele_node, &header_node);
+
+ AXIS2_SOAP_HEADER_SET_BASE_NODE(envelope_impl->header, env, header_node);
+ if(envelope_impl->soap_version == AXIS2_SOAP11)
+ {
+ AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP11);
+ }
+ else if(envelope_impl->soap_version == AXIS2_SOAP12)
+ {
+ AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP11);
+ }
+ if(envelope_impl->header)
+ return envelope_impl->header;
+ }
+ if(!(envelope_impl->header))
+ {
+ envelope_impl->header = axis2_soap_header_create_with_parent(env, envelope);
+ if(envelope_impl->soap_version == AXIS2_SOAP12)
+ {
+ AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP12);
+ }
+ else if(envelope_impl->soap_version == AXIS2_SOAP11)
+ {
+ AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP12);
+ }
}
- */
return envelope_impl->header;
}
Added: webservices/axis2/trunk/c/modules/xml/soap/soap_message.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_message.c?rev=365588&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_message.c (added)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_message.c Tue Jan 3 01:28:25 2006
@@ -0,0 +1,166 @@
+/*
+ * 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_soap_message.h>
+ #include <axis2_om_document.h>
+
+/*************************** impl struct **************************************/
+
+typedef struct axis2_soap_message_impl_t
+{
+ axis2_soap_message_t soap_message;
+
+ axis2_om_document_t *om_doc;
+
+ axis2_soap_envelope_t *soap_envelope;
+
+}axis2_soap_message_impl_t;
+
+/*************************** Macro ********************************************/
+
+#define AXIS2_INTF_TO_IMPL(message) ((axis2_soap_message_impl_t*)message)
+
+/******************************************************************************/
+
+axis2_status_t AXIS2_CALL
+axis2_soap_message_free(axis2_soap_message_t *message,
+ axis2_env_t **env);
+
+axis2_soap_envelope_t* AXIS2_CALL
+axis2_soap_message_get_soap_envelope(axis2_soap_message_t *message,
+ axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL
+axis2_soap_message_set_soap_envelope(axis2_soap_message_t *message,
+ axis2_env_t **env,
+ axis2_soap_envelope_t *envelope);
+
+axis2_status_t AXIS2_CALL
+axis2_soap_message_serialize(axis2_soap_message_t *message,
+ axis2_env_t **env);
+
+/************************** function implementations **************************/
+
+AXIS2_DECLARE(axis2_soap_message_t*)
+axis2_soap_message_create(axis2_env_t **env,
+ axis2_om_document_t *om_doc)
+{
+ axis2_soap_message_impl_t *soap_message_impl = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, om_doc, NULL);
+
+ soap_message_impl = (axis2_soap_message_impl_t *)AXIS2_MALLOC((*env)->allocator,
+ sizeof(axis2_soap_message_impl_t));
+ if(!soap_message_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ soap_message_impl->soap_message.ops = NULL;
+ soap_message_impl->om_doc = NULL;
+ soap_message_impl->soap_envelope = NULL;
+
+ soap_message_impl->soap_message.ops = (axis2_soap_message_ops_t*)AXIS2_MALLOC((*env)->allocator,
+ sizeof(axis2_soap_message_ops_t));
+
+ if(!(soap_message_impl->soap_message.ops))
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_FREE((*env)->allocator, soap_message_impl);
+ soap_message_impl = NULL;
+ return NULL;
+ }
+
+ soap_message_impl->om_doc = om_doc;
+
+ soap_message_impl->soap_message.ops->free_fn =
+ axis2_soap_message_free;
+ soap_message_impl->soap_message.ops->serialize =
+ axis2_soap_message_serialize;
+
+ soap_message_impl->soap_message.ops->get_soap_envelope =
+ axis2_soap_message_get_soap_envelope;
+
+
+ return &(soap_message_impl->soap_message);
+}
+
+axis2_status_t AXIS2_CALL
+axis2_soap_message_free(axis2_soap_message_t *message,
+ axis2_env_t **env)
+{
+ axis2_soap_message_impl_t *soap_message_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(message, env, AXIS2_FAILURE);
+ soap_message_impl = AXIS2_INTF_TO_IMPL(message);
+ if(soap_message_impl->om_doc)
+ {
+ AXIS2_OM_DOCUMENT_FREE(soap_message_impl->om_doc, env);
+ soap_message_impl->om_doc = NULL;
+ }
+ if(soap_message_impl->soap_envelope)
+ {
+ AXIS2_SOAP_ENVELOPE_FREE(soap_message_impl->soap_envelope, env);
+ soap_message_impl->soap_envelope = NULL;
+ }
+ if(soap_message_impl->soap_message.ops)
+ {
+ AXIS2_FREE((*env)->allocator, soap_message_impl->soap_message.ops);
+ soap_message_impl->soap_message.ops = NULL;
+ }
+ AXIS2_FREE((*env)->allocator, soap_message_impl);
+ soap_message_impl = NULL;
+ return AXIS2_SUCCESS;
+}
+
+axis2_soap_envelope_t* AXIS2_CALL
+axis2_soap_message_get_soap_envelope(axis2_soap_message_t *message,
+ axis2_env_t **env)
+{
+ axis2_soap_message_impl_t* soap_message_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(message, env, NULL);
+ soap_message_impl = AXIS2_INTF_TO_IMPL(message);
+ if(soap_message_impl->soap_envelope)
+ {
+ return soap_message_impl->soap_envelope;
+ }
+ else
+ {
+ soap_message_impl->soap_envelope = axis2_soap_envelope_create_null(env);
+
+ return soap_message_impl->soap_envelope;
+ }
+}
+
+axis2_status_t AXIS2_CALL
+axis2_soap_message_set_soap_envelope(axis2_soap_message_t *message,
+ axis2_env_t **env,
+ axis2_soap_envelope_t *soap_envelope)
+{
+ axis2_soap_message_impl_t *soap_message_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(message, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, soap_envelope, AXIS2_FAILURE);
+ soap_message_impl->soap_envelope = soap_envelope;
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_soap_message_serialize(axis2_soap_message_t *message,
+ axis2_env_t **env)
+{
+
+}
+
\ No newline at end of file