RE: Axis c++ calculator compiling error, Admin Client
I would check out the Axis1 code from subversion. The 1.6beta that is available for download on the site is VERY old and out-dated. Subversion is pretty stable and has many updates. The code differences between subversion the 1.6beta on the site are pretty extensive. -Ryan -Original Message- From: Martina08 [mailto:[EMAIL PROTECTED] Sent: Saturday, August 16, 2008 3:51 AM To: axis-c-user@ws.apache.org Subject: RE: Axis c++ calculator compiling error, Admin Client Hi, thank you for the answer first!! I think you use Axis2, but i work the calculator example with axis1.6 c++, see: http://ws.apache.org/axis/cpp/clientuser-guide.html (i hope its a forum not only for axis2 user..! ) I think the example is a little bit different... The generation of the Stub-Code with the wsdl is successfull, but i cant compile. There is the undefined reference to calculator::calculator() error i describe first. is there anybody uses axis1.x too, who can help me? Although thank you very much Ravi K. ;-)!!! Ravi Krishnaswamy wrote: I don't know if we're talking about the same sample (under samples/server/Calculator): I had to make changes in both the client and server implementations of the Calculator sample. I develop in win32. Here are the main changes I made: For the Client: - I recreated the stubs from wsdl2c using the wsdl in samples/server/Calculator.wsdl - I reimplemented the 'test_calculator.c' file to set the parameters on the request object based on the Actual names of the parameters in the wsdl (they were out of sync): stub = axis2_stub_create_Calculator(env, client_home, endpoint_uri); /* create the struct */ add_req = adb_add_create(env); adb_add_set_param_1(add_req, env, val1); == adb_add_set_param_2(add_req, env, val2); == /* invoke the web service method */ add_res = axis2_stub_op_Calculator_add(stub, env, add_req); if (!add_res) { printf(Error: response NULL\n); return -1; } /* return the output params using databinding */ ret_val = adb_addResponse_get_result(add_res, env); printf(finally: add (%d %d ) = %d\n, val1, val2, ret_val); return 0 - I added the build target axis2_client_calculator into the makefile in build\win32\makefile (just use another client example) For the Server, I found the code was out of sync as well from the wsdl. The following are the main changes I made: - Code diff is below. Essentially 2 changes, - 1. the object model in calc.c was deeper than the wsdl indicated, so I eliminated Several of the lines to match the actual SOAP object: 2. the response object was different from what was expected based on the wsdl and the client code. *** calc.c Tue Aug 05 16:31:14 2008 --- calc.c.bak Thu Jul 10 17:54:18 2008 *** *** 34,54 axis2_char_t *param2_str = NULL; long int param2 = 0; if (!node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE); printf(Calculator client request ERROR: input parameter NULL\n); return NULL; } ! param1_node = axiom_node_get_first_child(node, env); if (!param1_node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE); printf(Calculator service ERROR: invalid XML in request\n); return NULL; } param1_text_node = axiom_node_get_first_child(param1_node, env); if (!param1_text_node) --- 34,73 axis2_char_t *param2_str = NULL; long int param2 = 0; if (!node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE); printf(Calculator client request ERROR: input parameter NULL\n); return NULL; } ! complex_node = axiom_node_get_first_child(node, env); ! if (!complex_node) ! { ! AXIS2_ERROR_SET(env-error, ! AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, ! AXIS2_FAILURE); ! printf(Calculator service ERROR: invalid XML in request\n); ! return NULL; ! } ! seq_node = axiom_node_get_first_child(complex_node, env); ! if (!seq_node) ! { ! AXIS2_ERROR_SET(env-error, ! AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, ! AXIS2_FAILURE); ! printf(Calculator service ERROR: invalid XML in request\n); ! return NULL; ! } ! ! param1_node = axiom_node_get_first_child(seq_node, env); if (!param1_node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE); printf(Calculator service ERROR: invalid XML in request\n); return NULL
RE: Axis c++ calculator compiling error, Admin Client
Hi, thank you for the answer first!! I think you use Axis2, but i work the calculator example with axis1.6 c++, see: http://ws.apache.org/axis/cpp/clientuser-guide.html (i hope its a forum not only for axis2 user..! ) I think the example is a little bit different... The generation of the Stub-Code with the wsdl is successfull, but i cant compile. There is the undefined reference to calculator::calculator() error i describe first. is there anybody uses axis1.x too, who can help me? Although thank you very much Ravi K. ;-)!!! Ravi Krishnaswamy wrote: I don't know if we're talking about the same sample (under samples/server/Calculator): I had to make changes in both the client and server implementations of the Calculator sample. I develop in win32. Here are the main changes I made: For the Client: - I recreated the stubs from wsdl2c using the wsdl in samples/server/Calculator.wsdl - I reimplemented the 'test_calculator.c' file to set the parameters on the request object based on the Actual names of the parameters in the wsdl (they were out of sync): stub = axis2_stub_create_Calculator(env, client_home, endpoint_uri); /* create the struct */ add_req = adb_add_create(env); adb_add_set_param_1(add_req, env, val1); == adb_add_set_param_2(add_req, env, val2); == /* invoke the web service method */ add_res = axis2_stub_op_Calculator_add(stub, env, add_req); if (!add_res) { printf(Error: response NULL\n); return -1; } /* return the output params using databinding */ ret_val = adb_addResponse_get_result(add_res, env); printf(finally: add (%d %d ) = %d\n, val1, val2, ret_val); return 0 - I added the build target axis2_client_calculator into the makefile in build\win32\makefile (just use another client example) For the Server, I found the code was out of sync as well from the wsdl. The following are the main changes I made: - Code diff is below. Essentially 2 changes, - 1. the object model in calc.c was deeper than the wsdl indicated, so I eliminated Several of the lines to match the actual SOAP object: 2. the response object was different from what was expected based on the wsdl and the client code. *** calc.c Tue Aug 05 16:31:14 2008 --- calc.c.bak Thu Jul 10 17:54:18 2008 *** *** 34,54 axis2_char_t *param2_str = NULL; long int param2 = 0; if (!node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE); printf(Calculator client request ERROR: input parameter NULL\n); return NULL; } ! param1_node = axiom_node_get_first_child(node, env); if (!param1_node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE); printf(Calculator service ERROR: invalid XML in request\n); return NULL; } param1_text_node = axiom_node_get_first_child(param1_node, env); if (!param1_text_node) --- 34,73 axis2_char_t *param2_str = NULL; long int param2 = 0; if (!node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE); printf(Calculator client request ERROR: input parameter NULL\n); return NULL; } ! complex_node = axiom_node_get_first_child(node, env); ! if (!complex_node) ! { ! AXIS2_ERROR_SET(env-error, ! AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, ! AXIS2_FAILURE); ! printf(Calculator service ERROR: invalid XML in request\n); ! return NULL; ! } ! seq_node = axiom_node_get_first_child(complex_node, env); ! if (!seq_node) ! { ! AXIS2_ERROR_SET(env-error, ! AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, ! AXIS2_FAILURE); ! printf(Calculator service ERROR: invalid XML in request\n); ! return NULL; ! } ! ! param1_node = axiom_node_get_first_child(seq_node, env); if (!param1_node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE); printf(Calculator service ERROR: invalid XML in request\n); return NULL; } param1_text_node = axiom_node_get_first_child(param1_node, env); if (!param1_text_node) *** *** 113,146 return NULL; } if (param1_str param2_str) { long int result = 0; axis2_char_t result_str[255]; axiom_element_t *ele1 = NULL; axiom_node_t
RE: Axis c++ calculator compiling error, Admin Client
I don't know if we're talking about the same sample (under samples/server/Calculator): I had to make changes in both the client and server implementations of the Calculator sample. I develop in win32. Here are the main changes I made: For the Client: - I recreated the stubs from wsdl2c using the wsdl in samples/server/Calculator.wsdl - I reimplemented the 'test_calculator.c' file to set the parameters on the request object based on the Actual names of the parameters in the wsdl (they were out of sync): stub = axis2_stub_create_Calculator(env, client_home, endpoint_uri); /* create the struct */ add_req = adb_add_create(env); adb_add_set_param_1(add_req, env, val1); == adb_add_set_param_2(add_req, env, val2); == /* invoke the web service method */ add_res = axis2_stub_op_Calculator_add(stub, env, add_req); if (!add_res) { printf(Error: response NULL\n); return -1; } /* return the output params using databinding */ ret_val = adb_addResponse_get_result(add_res, env); printf(finally: add (%d %d ) = %d\n, val1, val2, ret_val); return 0 - I added the build target axis2_client_calculator into the makefile in build\win32\makefile (just use another client example) For the Server, I found the code was out of sync as well from the wsdl. The following are the main changes I made: - Code diff is below. Essentially 2 changes, - 1. the object model in calc.c was deeper than the wsdl indicated, so I eliminated Several of the lines to match the actual SOAP object: 2. the response object was different from what was expected based on the wsdl and the client code. *** calc.c Tue Aug 05 16:31:14 2008 --- calc.c.bak Thu Jul 10 17:54:18 2008 *** *** 34,54 axis2_char_t *param2_str = NULL; long int param2 = 0; if (!node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE); printf(Calculator client request ERROR: input parameter NULL\n); return NULL; } ! param1_node = axiom_node_get_first_child(node, env); if (!param1_node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE); printf(Calculator service ERROR: invalid XML in request\n); return NULL; } param1_text_node = axiom_node_get_first_child(param1_node, env); if (!param1_text_node) --- 34,73 axis2_char_t *param2_str = NULL; long int param2 = 0; if (!node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE); printf(Calculator client request ERROR: input parameter NULL\n); return NULL; } ! complex_node = axiom_node_get_first_child(node, env); ! if (!complex_node) ! { ! AXIS2_ERROR_SET(env-error, ! AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, ! AXIS2_FAILURE); ! printf(Calculator service ERROR: invalid XML in request\n); ! return NULL; ! } ! seq_node = axiom_node_get_first_child(complex_node, env); ! if (!seq_node) ! { ! AXIS2_ERROR_SET(env-error, ! AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, ! AXIS2_FAILURE); ! printf(Calculator service ERROR: invalid XML in request\n); ! return NULL; ! } ! ! param1_node = axiom_node_get_first_child(seq_node, env); if (!param1_node) { AXIS2_ERROR_SET(env-error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE); printf(Calculator service ERROR: invalid XML in request\n); return NULL; } param1_text_node = axiom_node_get_first_child(param1_node, env); if (!param1_text_node) *** *** 113,146 return NULL; } if (param1_str param2_str) { long int result = 0; axis2_char_t result_str[255]; axiom_element_t *ele1 = NULL; axiom_node_t *node1 = NULL, ! *node2 = NULL, *node3 = NULL; axiom_namespace_t *ns1 = NULL; axiom_text_t *text1 = NULL; param1 = strtol(param1_str, NULL, 10); param2 = strtol(param2_str, NULL, 10); result = param1 + param2; sprintf(result_str, %ld, result); ns1 = axiom_namespace_create(env, ! http://ws.apache.org/axis2/services/Calculator/types;, ns1); ! ele1 = axiom_element_create(env, NULL, addResponse, ns1, node1); ! ele1 = axiom_element_create(env, node1, result, NULL, node2); ! text1 = axiom_text_create(env, node2, result_str, node3);