cSOAP Release 1.0.2 beta

"cSOAP Library" <[email protected]>
Newsgroups gmane.text.xml.distributed
Message-ID <[email protected]>
Hi folks,
 try the SOAP library written in C. You can also implement a SOAP
 server in C. Release 1.0.2 is also available for the win32 native platform.


Try it out!

 Homepage: http://csoap.sourceforge.net


 Example client using CSOAP
 ----------------------------------------------

 static const char *url =
  "http://csoap.sourceforge.net/cgi-bin/csoapserver";;
 static const char *urn = "urn:examples";
 static const char *method = "sayHello";

 int main(int argc, char *argv[])
 {
  SoapEnv *env, *res;
  env = soap_env_new_with_method(urn, method);

   soap_env_add_item(env, "xsd:string",
 	"name", "Jonny B. Good");
   res = soap_client_invoke(env, url , "");

   soap_xml_doc_print(res->root->doc);

   soap_env_free(res);
   soap_env_free(env);

 return 0;
 }


 Example server using CSOAP
 ----------------------------------------------

 /**
 	FUNCTION: say_hello()
 	DESCRIPTION: The SOAP Server service function.
 	URN: urn:examples
 	METHOD: sayHello
 */
 SoapEnv* say_hello(SoapEnv *request)
 {

  SoapEnv *env;
  xmlNodePtr method, node;
  char *name;

  env = soap_env_new_with_response(request);

  method = soap_env_get_method(request);
  node = soap_xml_get_children(method);

  while (node) {

    name = (char*)xmlNodeListGetString(node->doc,
 		node->xmlChildrenNode, 1);
    if (!name) continue;

    soap_env_add_itemf(env,"xsd:string", "echo", "Hello '%s'", name);

    xmlFree((xmlChar*)name);

    node = soap_xml_get_next(node);
  }

  return env;
 }

 /**
 	FUNCTION: main()
 	DESCRIPTION: Register and run soap server
 */
 int main(int argc, char *argv[])
 {

  SoapRouter *router;

   if (!soap_server_init_args(argc, argv)) {
    return 0;
  }

   router = soap_router_new();

   soap_router_register_service(router, say_hello, "sayHello",
     "urn: examples");
   soap_server_register_router(router, "/csoapserver");

   soap_server_run();

   soap_router_free(router);
   soap_server_destroy();

  return 0;
 }

-- 
Supergünstige DSL-Tarife + WLAN-Router für 0,- EUR*
Jetzt zu GMX wechseln und sparen http://www.gmx.net/de/go/dsl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.