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 2007/03/23 03:40:23 UTC
svn commit: r521560 - in /webservices/axis2/trunk/c:
include/axis2_svc_client.h modules/core/clientapi/svc_client.c
samples/client/google/google_client.c
Author: samisa
Date: Thu Mar 22 19:40:22 2007
New Revision: 521560
URL: http://svn.apache.org/viewvc?view=rev&rev=521560
Log:
Added SOAP fault checking and last response SOAP envelope APIs - AXIS2C-156
Modified:
webservices/axis2/trunk/c/include/axis2_svc_client.h
webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
webservices/axis2/trunk/c/samples/client/google/google_client.c
Modified: webservices/axis2/trunk/c/include/axis2_svc_client.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_svc_client.h?view=diff&rev=521560&r1=521559&r2=521560
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_svc_client.h (original)
+++ webservices/axis2/trunk/c/include/axis2_svc_client.h Thu Mar 22 19:40:22 2007
@@ -469,7 +469,26 @@
const axis2_char_t *endpoint_name,
const axis2_char_t *client_home);
+ /**
+ * Gets the last respose SOAP envelope.
+ * @param svc_client pointer to service_client struct
+ * @param env env pointer to environemt struct
+ * @return pointer to SOAP envelope that was returned as a result
+ * when send_receieve was called last time
+ */
+ AXIS2_EXTERN axiom_soap_envelope_t *AXIS2_CALL
+ axis2_svc_client_get_last_response_soap_envelope(const axis2_svc_client_t *svc_client,
+ const axis2_env_t *env);
+ /**
+ * Gets the boolean value indicating if the last respose had a SOAP fault.
+ * @param svc_client pointer to service_client struct
+ * @param env env pointer to environemt struct
+ * @return AXIS2_TRUE if there was a fault, else AXIS2_FALSE
+ */
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_svc_client_get_last_response_has_fault(const axis2_svc_client_t *svc_client,
+ const axis2_env_t *env);
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c?view=diff&rev=521560&r1=521559&r2=521560
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Thu Mar 22 19:40:22 2007
@@ -56,6 +56,10 @@
axis2_op_client_t *op_client;
+ axiom_soap_envelope_t *last_response_soap_envelope;
+
+ axis2_bool_t last_response_has_fault;
+
};
static axis2_svc_t *
@@ -244,6 +248,8 @@
svc_client->callback_recv = NULL;
svc_client->listener_manager = NULL;
svc_client->op_client = NULL;
+ svc_client->last_response_soap_envelope = NULL;
+ svc_client->last_response_has_fault = AXIS2_FALSE;
/** initialize private data to NULL, create options */
if (!axis2_svc_client_init_data(env, svc_client))
@@ -595,6 +601,9 @@
AXIS2_ENV_CHECK(env, NULL);
+ svc_client->last_response_soap_envelope = NULL;
+ svc_client->last_response_has_fault = AXIS2_FALSE;
+
op = AXIS2_SVC_GET_OP_WITH_QNAME(svc_client->svc, env, op_qname);
if (op)
{
@@ -626,9 +635,9 @@
callback = axis2_callback_create(env);
if (!callback)
- {
+ {
return NULL;
- }
+ }
/* call two channel non blocking invoke to do the work and wait on the callback */
axis2_svc_client_send_receive_non_blocking_with_op_qname(
@@ -651,12 +660,15 @@
if (res_msg_ctx)
{
soap_envelope = axis2_msg_ctx_get_soap_envelope(res_msg_ctx, env);
+ svc_client->last_response_soap_envelope = soap_envelope;
if (soap_envelope)
{
soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
if (soap_body)
{
+ svc_client->last_response_has_fault =
+ axiom_soap_body_has_fault(soap_body, env);
soap_node = axiom_soap_body_get_base_node(soap_body, env);
if (soap_node)
{
@@ -720,11 +732,11 @@
svc_client->op_client, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
if (res_msg_ctx)
- {
+ {
soap_envelope = axis2_msg_ctx_get_soap_envelope(res_msg_ctx, env);
- }
+ }
else
- {
+ {
AXIS2_OP_CLIENT_ADD_MSG_CTX(svc_client->op_client, env,
res_msg_ctx); /* set in msg_ctx to be NULL to reset */
}
@@ -739,6 +751,8 @@
{
return NULL;
}
+ svc_client->last_response_soap_envelope = soap_envelope;
+
soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
if (!soap_body)
@@ -746,6 +760,9 @@
return NULL;
}
+ svc_client->last_response_has_fault =
+ axiom_soap_body_has_fault(soap_body, env);
+
if (AXIOM_SOAP11 == axiom_soap_envelope_get_soap_version(soap_envelope, env))
{
axiom_soap_body_convert_fault_to_soap11(soap_body, env);
@@ -1240,4 +1257,17 @@
return svc_client->op_client;
}
+AXIS2_EXTERN axiom_soap_envelope_t *AXIS2_CALL
+axis2_svc_client_get_last_response_soap_envelope(const axis2_svc_client_t *svc_client,
+ const axis2_env_t *env)
+{
+ return svc_client->last_response_soap_envelope;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_svc_client_get_last_response_has_fault(const axis2_svc_client_t *svc_client,
+ const axis2_env_t *env)
+{
+ return svc_client->last_response_has_fault;
+}
Modified: webservices/axis2/trunk/c/samples/client/google/google_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/google/google_client.c?view=diff&rev=521560&r1=521559&r2=521560
==============================================================================
--- webservices/axis2/trunk/c/samples/client/google/google_client.c (original)
+++ webservices/axis2/trunk/c/samples/client/google/google_client.c Thu Mar 22 19:40:22 2007
@@ -107,6 +107,18 @@
/* Send request */
ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
+ if (axis2_svc_client_get_last_response_has_fault(svc_client, env))
+ printf ("\nResponse has a SOAP fault\n");
+
+ if (axis2_svc_client_get_last_response_soap_envelope(svc_client, env))
+ {
+ printf("\n Returned SOAP envelope: %s\n",
+ AXIOM_NODE_TO_STRING(axiom_soap_envelope_get_base_node(
+ axis2_svc_client_get_last_response_soap_envelope(svc_client, env),
+ env),
+ env));
+ }
+
if (ret_node)
{
if (AXIOM_NODE_GET_NODE_TYPE(ret_node, env) == AXIOM_ELEMENT)
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org