Search code examples
c++web-servicesservicewsdlambiguity

Is it possible to consume a web service in a c++ service application


I am trying to consume a web service in my c++ service application using the WSDL importer. I can import the web service but as soon as I want to use some of the webmethods by including service.h in my file I get the following error:

Unit1.cpp(64): E2015 Ambiguity between 'Soap::Wsdlbind::TService' and 'Vcl::Svcmgr::TService'

I imported this web service to a VCL forms application and that worked perfectly.

I am using RAD Studio XE2. How do I fix this?


Solution

  • That simply means that you have a name clash in your code, i.e. you have somewhere something like

    //Header names should be different, just for the sake of the example
    #include Soap/Wsdlbin/TService.h
    #include Vcl/Svcmgr/TService.h
    <some namespace using directives>
    ...
    
    TService service;
    

    And the compiler cannot determine which TService it is. You have to qualify TService so that the compiler know which to use, i.e.:

    Soap::Wsdlbind::TService service;
    //or
    Vcl::Svcmgr::TService service;