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 da...@apache.org on 2006/01/30 11:07:37 UTC
svn commit: r373484 - in /webservices/axis2/trunk/c/test/client/echo:
Makefile.am axis2_echo_stub.c axis2_echo_stub.h echo_client.c echo_stub.c
echo_stub.h
Author: damitha
Date: Mon Jan 30 02:07:22 2006
New Revision: 373484
URL: http://svn.apache.org/viewcvs?rev=373484&view=rev
Log:
stub client test
Added:
webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.c
- copied, changed from r372794, webservices/axis2/trunk/c/test/client/echo/echo_stub.c
webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.h
- copied, changed from r372789, webservices/axis2/trunk/c/test/client/echo/echo_stub.h
Removed:
webservices/axis2/trunk/c/test/client/echo/echo_stub.c
webservices/axis2/trunk/c/test/client/echo/echo_stub.h
Modified:
webservices/axis2/trunk/c/test/client/echo/Makefile.am
webservices/axis2/trunk/c/test/client/echo/echo_client.c
Modified: webservices/axis2/trunk/c/test/client/echo/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/client/echo/Makefile.am?rev=373484&r1=373483&r2=373484&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/client/echo/Makefile.am (original)
+++ webservices/axis2/trunk/c/test/client/echo/Makefile.am Mon Jan 30 02:07:22 2006
@@ -1,5 +1,5 @@
bin_PROGRAMS = echo
-echo_SOURCES = echo_stub.c \
+echo_SOURCES = axis2_echo_stub.c \
echo_client.c
echo_LDADD = -L$(AXIS2C_HOME)/lib \
@@ -13,6 +13,7 @@
-laxis2_engine \
-laxis2_parser \
-laxis2_addr \
+ -laxis2_unix \
-laxis2_receivers \
-laxis2_core_util \
-laxis2_clientapi \
Copied: webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.c (from r372794, webservices/axis2/trunk/c/test/client/echo/echo_stub.c)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.c?p2=webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.c&p1=webservices/axis2/trunk/c/test/client/echo/echo_stub.c&r1=372794&r2=373484&rev=373484&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/client/echo/echo_stub.c (original)
+++ webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.c Mon Jan 30 02:07:22 2006
@@ -14,21 +14,11 @@
* limitations under the License.
*/
-#include "echo_stub.h"
+#include "axis2_echo_stub.h"
#include <axis2_om_node.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_call.h>
-/************************* Function prototypes ********************************/
-axis2_status_t AXIS2_CALL
-axis2_echo_stub_invoke_blocking(axis2_stub_t *echo_stub,
- axis2_env_t **env,
- axis2_msg_ctx_t *msg_ctx);
-
-axis2_status_t AXIS2_CALL
-axis2_echo_stub_echo(axis2_stub_t *echo_stub,
- axis2_env_t **env,
- axis2_om_node_t *node);
-
-/************************** End of function prototypes ************************/
axis2_stub_t *AXIS2_CALL
axis2_echo_stub_create_with_endpoint_ref(axis2_env_t **env,
@@ -45,8 +35,6 @@
return NULL;
}
- stub->ops->invoke_blocking = axis2_echo_stub_invoke_blocking;
-
return stub;
}
@@ -65,26 +53,24 @@
return NULL;
}
- stub->ops->invoke_blocking = axis2_echo_stub_invoke_blocking;
-
+
return stub;
}
/***************************Function implementation****************************/
-axis2_status_t AXIS2_CALL
-axis2_echo_stub_invoke_blocking(axis2_stub_t *echo_stub,
- axis2_env_t **env,
- axis2_msg_ctx_t *msg_ctx)
-{
- return 0;
-}
-
-axis2_status_t AXIS2_CALL
-axis2_echo_stub_echo(axis2_stub_t *echo_stub,
+axis2_om_node_t *AXIS2_CALL
+axis2_echo_stub_echo(axis2_stub_t *stub,
axis2_env_t **env,
axis2_om_node_t *node)
{
- return 0;
-}
+ axis2_call_t *call = NULL;
+ axis2_om_node_t *ret_node = 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, "echo", node);
+
+ return ret_node;
+}
Copied: webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.h (from r372789, webservices/axis2/trunk/c/test/client/echo/echo_stub.h)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.h?p2=webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.h&p1=webservices/axis2/trunk/c/test/client/echo/echo_stub.h&r1=372789&r2=373484&rev=373484&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/client/echo/echo_stub.h (original)
+++ webservices/axis2/trunk/c/test/client/echo/axis2_echo_stub.h Mon Jan 30 02:07:22 2006
@@ -19,7 +19,7 @@
/**
* @file axis2_echo_stub.h
- * @brief echo stub interface
+ * @brief axis2 echo stub interface
*/
#include <axis2.h>
@@ -29,11 +29,17 @@
#include <axis2_allocator.h>
#include <axis2_stub.h>
#include <axis2_endpoint_ref.h>
+#include <axis2_om_node.h>
#ifdef __cplusplus
extern "C"
{
#endif
+
+AXIS2_DECLARE(axis2_om_node_t *)
+axis2_echo_stub_echo(axis2_stub_t *stub,
+ axis2_env_t **env,
+ axis2_om_node_t *node);
/**
* Creates axis2_stub struct
Modified: webservices/axis2/trunk/c/test/client/echo/echo_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/client/echo/echo_client.c?rev=373484&r1=373483&r2=373484&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/client/echo/echo_client.c (original)
+++ webservices/axis2/trunk/c/test/client/echo/echo_client.c Mon Jan 30 02:07:22 2006
@@ -1,6 +1,117 @@
-#include "echo_stub.h"
+#include "axis2_echo_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_default.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.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>
+
+axis2_soap_envelope_t *
+build_soap_programatically(axis2_env_t **env);
int main(void)
{
- return 0;
+ axis2_stub_t *stub = NULL;
+ axis2_soap_envelope_t *envelope = NULL;
+ 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_endpoint_ref_t *epr = NULL;
+ axis2_char_t *address = NULL;
+
+ allocator = axis2_allocator_init (NULL);
+ error = axis2_error_create(allocator);
+ log = axis2_log_create(allocator, NULL);
+ env = axis2_env_create_with_error_log(allocator, error, log);
+ env->log->level = AXIS2_LOG_INFO;
+
+ envelope = build_soap_programatically(&env);
+ node = AXIS2_SOAP_ENVELOPE_GET_BASE_NODE(envelope, &env);
+ address = "http://localhost:9090/echo";
+ epr = axis2_endpoint_ref_create(&env, address);
+ stub = axis2_echo_stub_create_with_endpoint_ref(&env, epr);
+ AXIS2_STUB_SET_TRANSPORT_INFO(stub, &env, AXIS2_TRANSPORT_HTTP,
+ AXIS2_TRANSPORT_HTTP, AXIS2_FALSE);
+ /* create node and invoke echo */
+ status = axis2_echo_stub_echo(stub, &env, node);
+ if(AXIS2_SUCCESS != status)
+ {
+ printf("echo stub invoke failed!\n");
+ }
+ else
+ {
+ printf("echo stub invoke successful!\n");
+ }
+ AXIS2_SOAP_ENVELOPE_FREE(envelope, &env);
+ return status;
+}
+
+axis2_soap_envelope_t *
+build_soap_programatically(axis2_env_t **env)
+{
+ axis2_soap_envelope_t *soap_envelope = NULL;
+ axis2_soap_body_t *soap_body = NULL;
+ axis2_om_node_t *envelope_base_node = NULL;
+ axis2_om_element_t *envelope_om_ele = NULL;
+ axis2_om_node_t *echo_om_node = NULL;
+ axis2_om_element_t* echo_om_ele = NULL;
+ axis2_om_node_t* text_om_node = NULL;
+ axis2_om_element_t * text_om_ele = NULL;
+
+
+ axis2_om_node_t *body_om_node = NULL;
+ axis2_om_namespace_t *env_ns = NULL;
+ axis2_xml_writer_t *xml_writer = NULL;
+ axis2_om_output_t *om_output = NULL;
+ axis2_char_t *buffer = NULL;
+ axis2_om_namespace_t *wsa_ns = NULL;
+
+ env_ns = axis2_om_namespace_create(env, "http://www.w3.org/2003/05/soap-envelope", "soapenv");
+ soap_envelope = axis2_soap_envelope_create(env, env_ns);
+
+
+ wsa_ns = axis2_om_namespace_create(env, "http://schemas.xmlsoap.org/ws/2004/08/addressing", "wsa");
+
+ envelope_base_node = AXIS2_SOAP_ENVELOPE_GET_BASE_NODE(soap_envelope, env);
+ envelope_om_ele = (axis2_om_element_t*)AXIS2_OM_NODE_GET_DATA_ELEMENT(envelope_base_node, env);
+ AXIS2_OM_ELEMENT_DECLARE_NAMESPACE(envelope_om_ele, env, envelope_base_node,
+ wsa_ns);
+
+ soap_body = axis2_soap_body_create_with_parent(env, soap_envelope);
+
+ body_om_node = AXIS2_SOAP_BODY_GET_BASE_NODE(soap_body, env);
+
+ echo_om_ele = axis2_om_element_create(env, body_om_node, "echoString", NULL, &echo_om_node);
+
+ text_om_ele = axis2_om_element_create(env, echo_om_node, "text", NULL, &text_om_node);
+
+ AXIS2_OM_ELEMENT_SET_TEXT(text_om_ele, env, "echo5", text_om_node);
+
+
+ xml_writer = axis2_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE, AXIS2_FALSE);
+ om_output = axis2_om_output_create( env, xml_writer);
+
+ AXIS2_SOAP_ENVELOPE_SERIALIZE(soap_envelope, env, om_output, AXIS2_FALSE);
+ buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);
+ printf("%s \n", buffer);
+
+ return soap_envelope;
}