I need help.  I am very rusty on my unmanaged C++ but I am creating a plugin 
for a game that requires it.  I have used gSoap to create a proxy for a web 
service hosted by ASP.NET and am trying test it on my local host using a Win32 
Consol app and Visual Studio 2008.  My project builds and I can step through to 
the call to my service with this code:


#include "stdafx.h"
#include "SafetyService.nsmap"
#include "SafetyServiceProxy.h"


int _tmain(int argc, _TCHAR* argv[])
{
        static const char* const endpointAddress = 
"http://localhost:49115/Services/SafetyService.asmx";;

        time_t currentTime;
        SafetyServiceProxy serviceClient;
        _ns1__RegisterSession session;
        _ns1__RegisterSessionResponse sessionResponse;
        _ns1__RegisterIncident incident;
        _ns1__RegisterIncidentResponse incidentResponse;
        
        time(&currentTime);
        
        int typeId = 1;
        int lapCount = 10;
        std::string driver("Mike Hanson");
        std::string vehicle("Mazda MX-5");
        std::string track("Laguna Seca");

        session.typeId = typeId;
        session.driver = &track;
        session.lapCount = lapCount;
        session.vehicle = &vehicle;
        session.track = &track;
        session.startTime = currentTime;

        if(serviceClient.LogSession(&session, &sessionResponse) == SOAP_OK)
        {
                std::cout << sessionResponse.RegisterSessionResult << std::endl;
        }
        else
        {
                //soap_print_fault(serviceClient.soap, stderr);
        }

        //if(serviceClient.LogIncident(&incident, &incidentResponse) == SOAP_OK)
        //{
        //      //do something with return
        //}
        
        return 0;
}

When I run it the call to serviceClient.LogSession results in an error "RPC 
Server is unavailable" and VS breaks on the following line in stdsoap2.cpp

if (!(host = gethostbyname(addr)))

Using the visualizer addr contains "localhost"

I have spent days trying to get past this, any help would be greatly 
appreciated.

The service is working fine, I can browse to and I have written a C# console 
app that calls it fine, but as I said I need to do it from unmanaged C++

Regards
Mike Hanson

Reply via email to