0

I download gsoap_2.8.83 and ran into following soap error when executing the example from the online document.

SOAP 1.1 fault SOAP-ENV:Client[no subcode]
"Error 200: HTTP 200 OK"
Detail: [no detail]

The Code is exactly this:

//#include "gsoapWinInet.h"
#include "soapcalcProxy.h"
#include "calc.nsmap"
#include "stdafx.h"

/* the Web service endpoint URL */
const char server[] = "http://websrv.cs.fsu.edu/~engelen/calcserver.cgi";

int main(int argc, char **argv)
{
    if (argc < 4)
    {
        fprintf(stderr, "Usage: [add|sub|mul|div|pow] num num\n");
        exit(1);
    }
    calcProxy calc(server);
    //soap_register_plugin(calc.soap, wininet_plugin);
    calc.soap->recv_timeout = 60;

    double a, b, result;
    a = strtod(argv[2], NULL);
    b = strtod(argv[3], NULL);
    int ret = 0;
    switch (*argv[1])
    {
    case 'a':
        std::cout << a << " + " << b;
        ret = calc.add(a, b, result);       
        break;
    case 's':
        std::cout << a << " - " << b;
        ret = calc.sub(a, b, result);
        break;
    case 'm':
        std::cout << a << " * " << b;
        calc.mul(a, b, result);
        break;
    case 'd':
        std::cout << a << " / " << b;
        calc.div(a, b, result);
        break;
    case 'p':
        std::cout << a << " ^ " << b;
        calc.pow(a, b, result);
        break;
    default:
        fprintf(stderr, "Unknown command\n");
        exit(1);
    }
    if (calc.soap->error)
        calc.soap_stream_fault(std::cerr);
    else
        std::cout << " = " << result << std::endl;
    calc.destroy(); /* clean up */
    getchar();
    return 0;
}

Full VS2015 project can also be fetched here.

Build and run with command line arguments: main.exe add 1 2 Getting the error abovemetioned.

In order to debug the SOAP message, I added gsoap WinInet plugin (just uncommenting out those two lines in the code above), then the response turns to be good.

My question is why the code without wininet plugin is unsuccessful? Thanks.

tedyyu
  • 587
  • 6
  • 12
  • I think that in order to answer this question more information should be provided. Are you connecting through a firewall proxy? Have you tried this in DEBUG mode (which produces log files to audit to see what is wrong)? – Dr. Alex RE May 21 '19 at 15:37
  • @Alex, good catch, yes, I'm behind a company proxy. – tedyyu May 22 '19 at 02:39

0 Answers0