Unpacking the result

2004-06-22
2013-04-22
  • Darryl Luff
    Darryl Luff
    2004-06-22

    Hi csoap looks nice and simple. The only thing I cant find is functions to unpack the result without resorting to libxml. If a call returns a single string, is there a function to retrieve it directly from the returned SoapEnv?

     
    • Marcelo
      Marcelo
      2006-03-11

      Hi, a method could be:
      ...
      err = soap_client_invoke(ctx, &ctx2, url, "");
      xmlNodePtr function, xptr;
        xmlChar *prop;
        function = soap_env_get_method(ctx2->env);
        xptr = soap_xml_get_children(function);
        if (!soap_xml_get_next(xptr)) xptr = soap_xml_get_children(xptr);
        printf("\nReceived elements:\n");
        while(xptr) {
              prop = xmlGetProp(xptr, (const xmlChar *)"type");
              printf("[%s]-[%s]-[%s]\n", xptr->name, soap_xml_get_text(xptr), (prop?(const char *)prop:""));
              if (!soap_xml_get_next(xptr)) {
                      xptr = soap_xml_get_children(xptr);
              } else {
                      xptr = soap_xml_get_next(xptr);
              }

        }

        soap_ctx_free(ctx2);
      ...
      ------------ 0 -----------
      You need link with libs: csoap , xml2 and nanohttp