Loading ...
Sorry, an error occurred while loading the content.

5331gsoap client and SOAP::Lite server example

Expand Messages
  • david_ster
    Apr 6, 2006
      Hi all!
      I would like to build a gsoap client communicating with a SOAP::Lite
      server. I managed to pass the parameter from the client to the
      server, but I'm not able to get the server exit code. This is the
      code:

      CLIENT
      ----------
      nt main(int argc, char **argv)
      { struct soap soap;
      double a, b, result,code=100;
      int a2, b2,result2;
      if (argc < 4)
      { fprintf(stderr, "Usage: [add|sub|mul|div|pow] num num\n");
      exit(0);
      }
      soap_init(&soap);
      a2 = strtod(argv[2], NULL);
      b2= strtod(argv[3], NULL);
      switch (*argv[1])
      { case 'a':
      code=soap_call_ns__add(&soap, server, "", a2, b2, &result2);
      printf("code = %g\n", code);
      break;

      default:
      fprintf(stderr, "Unknown command\n");
      exit(0);
      }
      if (soap.error)
      soap_print_fault(&soap, stderr);
      else
      printf("result = %g\n", result2);
      return 0;
      }


      SERVER:
      ----------
      #!perl -w

      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('calc')
      -> handle;

      package calc;



      sub ns__add(){

      $soap_result=$_[2] +$_[1];

      return $soap_result;
      }


      1;

      Any suggestion about the reason it does not work?
      Otherwise, any example of an application of this kind correctly
      working?
      Any help will be very appreciated!!