Hello all,

Below, I get the following results on the SERVER side:

Socket connection successful: slave socket = 4

CURRENTLY PROCESSING A:      650.5560000000  B:      200.3330000000
CURRENT   RESULT :           850.8890000000


Below is some code I get the following results for the CLIENT side

--------------------------------------------------------------
FIRST           650.555556

SECOND          200.333333

SUM (NO SOAP)   850.888889         

SUM 1 (WITH SOAP)       850.889000  <--- WRONG ANSWR

SUM 2 (WITH SOAP)       850.889000  <--- WRONG ANSWR

--------------------------------------------------------------

with the code below.

When running with the client, gsoap automatically rounds the numbers off. What 
is the problem?


------------------------ CLIENT CODE BELOW -----------------------

#include "stdsoap2.h"
#include "HPT.nsmap"
#include "soapH.h"

const char *endpoint = NULL;

int main(int argc, char **argv)
{
   char out_buffer[200];
   char tHost[40]           = "http://192.168.1.69";;
   int  tport               = 8050;
   struct soap soap;
   char local[100];
   memset(local, 0 , sizeof local);
   sprintf(local,"%s:%d",tHost,tport);
   double first         = 650.555555555;
   double second        = 200.333333333;
   soap.connect_timeout = 10;
   soap_init(&soap );

   double result;
   endpoint = local;

printf("\nFIRST  \t\t%f\n", 650.555555555);
printf("\nSECOND  \t%f\n",  200.333333333);
printf("\nSUM (NO SOAP) \t%f\n", (650.555555555 + 200.333333333));

if (soap_call_HPT__add(&soap, endpoint, NULL, 650.555555555, 200.333333333, 
&result) != SOAP_OK) { printf("\nerror took place\n"); return -898; }

printf("\nSUM 1 (WITH SOAP) \t%f\n", result);

if (soap_call_HPT__add(&soap, endpoint, NULL, first, second, &result) != 
SOAP_OK) { printf("\nerror took place\n"); return -898; }

printf("\nSUM 2 (WITH SOAP) \t%f\n", result);

soap_destroy(&soap);
soap_end(&soap);
soap_done(&soap);
return 0;
}


------------------------ SERVER CODE BELOW -----------------------

int HPT__add(struct soap *soap, xsd__double a, xsd__double b, xsd__double 
*result)
{
  *result = a + b;

  printf("\n\nCURRENTLY PROCESSING A: %19.10f  B: %19.10f \n\n", 
         a, b);
  printf("\n\nCURRENT   RESULT : %19.10f \n\n", *result);

  return SOAP_OK;
}


 



Reply via email to