- {0, 0, 0}
- };
- if ((charset_p = strstr(content_type, "; charset=")))
- {
- int i = 0;
- charset_p += 10;
- while (i < 20 && charset_p[i] &&
- !strchr("; \n\r", charset_p[i]))
- i++;
- charset = odr_malloc(assoc->encode, i+1);
- memcpy(charset, charset_p, i);
- charset[i] = '\0';
- yaz_log(LOG_LOG, "SOAP encoding %s", charset);
- }
- ret = z_soap_codec(assoc->decode, &soap_package,
- &hreq->content_buf, &hreq->content_len,
- soap_handlers);
-#if HAVE_XML2
- if (!ret && soap_package->which == Z_SOAP_generic &&
- soap_package->u.generic->no == 0)
- {
- /* SRW package */
- char *db = "Default";
- const char *p0 = hreq->path, *p1;
- Z_SRW_PDU *sr = soap_package->u.generic->p;
-
- if (*p0 == '/')
- p0++;
- p1 = strchr(p0, '?');
- if (!p1)
- p1 = p0 + strlen(p0);
- if (p1 != p0)
- {
- db = (char*) odr_malloc(assoc->decode, p1 - p0 + 1);
- memcpy (db, p0, p1 - p0);
- db[p1 - p0] = '\0';
- }
-
- if (sr->which == Z_SRW_searchRetrieve_request)
- {
- Z_SRW_PDU *res =
- yaz_srw_get(assoc->encode,
- Z_SRW_searchRetrieve_response);
-
- if (!sr->u.request->database)
- sr->u.request->database = db;
-
- srw_bend_search(assoc, req, sr->u.request,
- res->u.response);
-
- soap_package->u.generic->p = res;
- http_code = 200;
- }
- else if (sr->which == Z_SRW_explain_request)
- {
- Z_SRW_PDU *res =
- yaz_srw_get(assoc->encode, Z_SRW_explain_response);
-
- if (!sr->u.explain_request->database)
- sr->u.explain_request->database = db;
-
- srw_bend_explain(assoc, req, sr->u.explain_request,
- res->u.explain_response);
- if (!res->u.explain_response->record.recordData_buf)
- {
- z_soap_error(assoc->encode, soap_package,
- "SOAP-ENV:Client", "Explain Not Supported", 0);
- }
- else
- {
- soap_package->u.generic->p = res;
- http_code = 200;
- }
- }
- else
- {
- z_soap_error(assoc->encode, soap_package,
- "SOAP-ENV:Client", "Bad method", 0);
- }
- }
-#endif
- p = z_get_HTTP_Response(o, 200);
- hres = p->u.HTTP_Response;
- ret = z_soap_codec_enc(assoc->encode, &soap_package,
- &hres->content_buf, &hres->content_len,
- soap_handlers, charset);
- hres->code = http_code;
- if (!charset)
- z_HTTP_header_add(o, &hres->headers, "Content-Type", "text/xml");
- else
- {
- char ctype[60];
- strcpy(ctype, "text/xml; charset=");
- strcat(ctype, charset);
- z_HTTP_header_add(o, &hres->headers, "Content-Type", ctype);
- }
- }
- if (!p) /* still no response ? */
- p = z_get_HTTP_Response(o, 500);
+ {0, 0, 0}
+ };
+ char ctype[60];
+ int ret;
+ p = z_get_HTTP_Response(o, 200);
+ hres = p->u.HTTP_Response;
+ ret = z_soap_codec_enc_xsl(assoc->encode, &soap_package,
+ &hres->content_buf, &hres->content_len,
+ soap_handlers, charset, stylesheet);
+ hres->code = http_code;
+
+ strcpy(ctype, "text/xml");
+ if (charset)
+ {
+ strcat(ctype, "; charset=");
+ strcat(ctype, charset);
+ }
+ z_HTTP_header_add(o, &hres->headers, "Content-Type", ctype);
+ }
+ else
+ p = z_get_HTTP_Response(o, http_code);