cSOAP 1.0.3 release candidate 1

Ferhat Ayaz <[email protected]> Wed, 3 Nov 2004 02:39:26 +0100
Newsgroups gmane.comp.windows.devel.soap.general
Organization Homeoffice
Message-ID <1099445966.12343.8.camel@debian>
Hello,
 I'm pleasured to annonce cSOAP 1.0.3 first release candidate.

cSOAP is a simple client/server library written in C to implement SOAP
applications.

Homepage: http://csoap.sourceforge.net
Click to visit the official homepage.

-------------------------------------------------------------
Simple client example
-------------------------------------------------------------

#include <libcsoap/soap-client.h>


static const char *url = "http://localhost:10000/csoapserver";
static const char *urn = "urn:examples";
static const char *method = "sayHello";


int main(int argc, char *argv[])
{
  SoapCtx *ctx, *ctx2;
  herror_t err;

  /* 1. Initialize cSOAP client */
  soap_client_init_args(argc, argv);

  /* 2. Create a SoapCtx object */
  soap_ctx_new_with_method(urn, method, &ctx);

  /* 3. Fill the envelope */
  soap_env_add_item(ctx->env, "xsd:string", "name", "Jonny B. Good");

  /* 4. Invoke  */
  soap_client_invoke(ctx, &ctx2, url, "");
  if (err != H_OK) {

    log_error4("[%d] %s(): %s ",
        herror_code(err),
        herror_func(err),
        herror_message(err));

    herror_release(err);
    soap_ctx_free(ctx);
    return 1;
  }

  /* 5. Process returned SoapCtx object  */
  soap_xml_doc_print(ctx2->env->root->doc);


  /* 6. Clean up cSOAP client  */
  soap_ctx_free(ctx2);
  soap_ctx_free(ctx);

  soap_client_destroy();

  return 0;
}

-------------------------------------------------------------
Simple server example
-------------------------------------------------------------

herror_t say_hello(SoapCtx *req, SoapCtx* res)
{
  printf("Returning empty envelope\n");
  soap_env_new_with_response(req->env, &res->env);
  return H_OK;
}


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

  herror_t err;
  SoapRouter *router;

  /* 1. Init cSOAP server */
  soap_server_init_args(argc, argv);

  /* 2. Create and register a router */
  router = soap_router_new();
  soap_server_register_router(router, url);

  /* 3. Register you service (C function) */
  soap_router_register_service(router, say_hello, method, urn);

  /* 4. Enter server loop */
  soap_server_run();

  /* 5. Clean up cSOAP server */
  soap_server_destroy();

  return 0;
}

--
Ferhat Ayaz <[email protected]>
Homeoffice