+ if (!ptr || ptr->type != XML_ELEMENT_NODE || !ptr->ns)
+ {
+ xmlFreeDoc(doc);
+ return z_soap_error(o, p, "SOAP-ENV:Client",
+ "No Envelope element", 0);
+ }
+ /* check for SRU root node match */
+ for (i = 0; handlers[i].ns; i++)
+ {
+ const char *hns = handlers[i].ns;
+ if (strchr(hns, ':'))
+ {
+ if (yaz_match_glob(hns, (const char *) ptr->ns->href))
+ break;
+ }
+ else
+ {
+ if (yaz_match_glob(hns, (const char *) ptr->name))
+ break;
+ }
+ }
+ if (handlers[i].ns)
+ {
+ void *handler_data = 0;
+ xmlNode p_top_tmp; /* pseudo parent node needed */
+
+ p_top_tmp.children = ptr;
+ ret = (*handlers[i].f)(o, &p_top_tmp, &handler_data,
+ handlers[i].client_data,
+ (const char *)ptr->ns->href);
+
+ if (ret || !handler_data)
+ z_soap_error(o, p, "SOAP-ENV:Client",
+ "SOAP Handler returned error", 0);
+ else
+ {
+ p->which = Z_SOAP_generic;
+ p->u.generic = (Z_SOAP_Generic *)
+ odr_malloc(o, sizeof(*p->u.generic));
+ p->u.generic->no = i;
+ p->u.generic->ns = handlers[i].ns;
+ p->u.generic->p = handler_data;
+ }
+ xmlFreeDoc(doc);
+ return ret;
+ }
+ /* OK: assume SOAP */
+ if (xmlStrcmp(ptr->name, BAD_CAST "Envelope"))