axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravi Krishnaswamy <ravi.krishnasw...@autodesk.com>
Subject RE: Axis c++ calculator compiling error, Admin Client
Date Fri, 15 Aug 2008 16:39:13 GMT
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);

          return node1;
      }

      AXIS2_ERROR_SET(env->error,
                      AXIS2_ERROR_SVC_SKEL_INVALID_OPERATION_PARAMETERS_IN_SOAP_REQUEST,
                      AXIS2_FAILURE);
      printf("Calculator service ERROR: invalid parameters\n");
      return NULL;
  }
--- 132,164 ----
          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;
          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://axis2/test/namespace1", "ns1");
!         ele1 = axiom_element_create(env, NULL, "result", ns1, &node1);
!         text1 = axiom_text_create(env, node1, result_str, &node2);

          return node1;
      }

      AXIS2_ERROR_SET(env->error,
                      AXIS2_ERROR_SVC_SKEL_INVALID_OPERATION_PARAMETERS_IN_SOAP_REQUEST,
                      AXIS2_FAILURE);
      printf("Calculator service ERROR: invalid parameters\n");
      return NULL;
  }





With that I got this sample to work.

I don't know if there's a newer version of the Sample - but that's what I had to do.


Ravi








-----Original Message-----
From: Martina08 [mailto:martin.willitzkat@gmx.de]
Sent: Friday, August 15, 2008 6:50 AM
To: axis-c-user@ws.apache.org
Subject: Axis c++ calculator compiling error, Admin Client


Hi all,
i have some problems with the Axis c++ calculator-example. I build my Client
with
g++ c.cpp -I$AXISCPP_HOME/include -I$AXISCPP_HOME/lib -ldl -laxiscpp_client
-o calculator  and
i get the error: "cannot find laxiscpp_client". I search in the mailing list
for this problem and change my command to:
g++ c.cpp -I$AXISCPP_HOME/include -I$AXISCPP_HOME/lib -ldl
-L<PathToTheLibrary>laxis_client.so -o calculator
Now i think it finds the library but i get the error "undefined reference to
'Calculator::Calculator()' "
I have search in the mailing list but all tipps don´t solve this problem.
I use Open Suse 10.3,compiler version 4.2.1 and try it with KDE/KDevelop
too, but it produces the same error.
I think i have set the LD_LIBRARY_PATH correctly. Maybe there is a conflict
with 32 and 64 bit processor.
Can anybody help me please?
After i can´t solve this problem i go on with the server guide. I run the
simle Axis Server with:
./simple_axis_server 8080 and then deploy the service with:
java org.apache.axis.client.AdminClient
-Lhttp://localhost:8080/axis/Services/AdminService deploy.wsdd
I get the message: "Porcessing file deploy.wsdd"
Was the deploying successful or not?
By checking the deploying configuration in the user server guide:Open a
browser and enter the link http://localhost/axis
I can´t open the link. Why it doesn´t work??
I hope there is somebody who can help me in some questions...
--
View this message in context: http://www.nabble.com/Axis-c%2B%2B-calculator-compiling-error%2C-Admin-Client-tp18998976p18998976.html
Sent from the Axis - C++ - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org

Mime
View raw message