Title: C++ Client for RPC-based Java service

Hi every body,

I downloaded easysoap from http://sourceforge.net/projects/easysoap/ (it also needs an XML parser for C/C++ "expat" from http://sourceforge.net/projects/expat/ )

With it, i (about time!) made my first C++ client to a java service "Hellow World" sample. Deploying the interop service that comes with the SOAP distribution the C++ code below works fine!

I hope this help you!. I think it is an "easy" begining isn´t it? :-). Great job David!, we´re waiting for the next release!

Regards,

Eduardo Yánez.

****************************************************************

#include <SOAP.h>

#include <iostream.h>

// The ID of the Java SOAP service

static const char *ns = "http://soapinterop.org/";

int main(int argc, const char *argv[])

{

try

{

const char *endpoint;

if (argc > 1)

endpoint = argv[1];

else

// The URL of the Java Service here at my office :-)

endpoint = "http://xxx.xxx.xxx.xxx:8082/soap/servlet/rpcrouter";

SOAPProxy proxy(endpoint);

SOAPMethod echoIntegerMethod("echoInteger", ns);

int a = 10;

echoIntegerMethod.AddParameter("a") << a;

const SOAPResponse& addresp = proxy.Execute(echoIntegerMethod);

int n = 0;

addresp.GetReturnValue() >> n;

cout << "Returned value: " << n << endl;

return 0;

}

catch (SOAPException& ex)

{

printf("Caught SOAP exception: %s\n", ex.What().Str());

return 1;

}

}

Reply via email to