0

Recently I have got a small C++ SOAP client project (ubuntu linux) to build using gSOAP. I am using 2 web service classes which I believe I have created correctly according to the documentation. However, I am having problems with my code

    #include "envH.h"
    #include "betfairBFGlobalServiceProxy.h"
    #include "betfairBFExchangeServiceProxy.h"
    //#include "betfair.nsmap"
    #include <iostream>
    #include <string>
    // Following included to prevent ligsoap++ complaining of undefined references
    // to 'namespaces'
    SOAP_NMAC struct Namespace namespaces[] =  {};

    using namespace std;
    using namespace betfair;


    int main() 
    {
      BFGlobalServiceProxy bf;

      BFExchangeServiceProxy betfair2;  /* CRASH!! */
      return 0;
    }

I want to make API calls to both web services but my program crashes at the point where the second service proxy object is created. I have used wsdl2h -gbetfair option and soapcpp2 -i -n options and created a new env.h file as requested in the documentation when creating multiple client services using C++ namespaces to avoid linker errors when linking to libgsoap++ . Can anyone see what I am doing wrong???

mathematician1975
  • 21,161
  • 6
  • 59
  • 101
  • 1
    We would love to help, but this is hard to read. Try making your question a bit more clear. – Shep Apr 20 '12 at 21:34
  • In a nutshell I have 2 client proxy classes created by gSOAP - when I instantiate one of each the program crashes at the point where I create the second one and I dont know why. – mathematician1975 Apr 20 '12 at 23:37

1 Answers1

0

I cannot reproduce the problem, so I'm not sure about my guess. The array namespaces is defined inside .nsmap files. Your code has a comment in the #include of .nsmap file and maybe gSOAP don't like if this array is empty. You really have to keep the #include "betfair.nsmap" commented out?

jramos
  • 128
  • 1
  • 6
  • Yes as I built it using namespaces and so the actual namespaces[] array that is referenced doesnt actually exist but is still referenced by the libgsoap++ library so I must declare something for linking to occur. From what I can see the gSOAP code simply doesnt like me having 2 instances of proxy classes in the same scope. I must have some initialisation problem with resources that I have not read in the documentation as it works fine with just one object. Unfortunately this is worthless as I need both web services in the same app. Maybe its openSSL that is causing the problem. I have given up – mathematician1975 May 10 '12 at 10:27