diff --git a/esp/CMakeLists.txt b/esp/CMakeLists.txt index c56ba6223e2..968aaa05e4e 100644 --- a/esp/CMakeLists.txt +++ b/esp/CMakeLists.txt @@ -30,6 +30,7 @@ HPCC_ADD_SUBDIRECTORY (test "PLATFORM") HPCC_ADD_SUBDIRECTORY (tools "CLIENTTOOLS") HPCC_ADD_SUBDIRECTORY (xslt) HPCC_ADD_SUBDIRECTORY (esdllib) +HPCC_ADD_SUBDIRECTORY (esdlscriptlib) HPCC_ADD_SUBDIRECTORY (applications) HPCC_ADD_SUBDIRECTORY (espcommon) if (LOGGING_SERVICE) diff --git a/esp/bindings/http/platform/httpbinding.cpp b/esp/bindings/http/platform/httpbinding.cpp index 82c2503881e..14de4699692 100644 --- a/esp/bindings/http/platform/httpbinding.cpp +++ b/esp/bindings/http/platform/httpbinding.cpp @@ -47,6 +47,7 @@ #include "workunit.hpp" #include "cumulativetimer.hpp" #include +#include "esdl_def_helper.hpp" #define FILE_UPLOAD "FileUploadAccess" #define DEFAULT_HTTP_PORT 80 @@ -95,7 +96,7 @@ static IXmlSchema* createXmlSchema(const char* schema) XmlSchemaCreator creator = (XmlSchemaCreator)GetSharedProcedure(xmllib, "createXmlSchemaFromString"); if (!creator) throw MakeStringException(-1,"load XmlSchema factory failed: createXmlSchemaFromString()"); - + return creator(schema); } @@ -114,6 +115,17 @@ static void setBndCfgServiceType(IPropertyTree* tree, const char* procName, IPro bndCfg->setProp("@serviceType", srvType); } + +static void generateEsdlNamespace(IEspContext &context, CHttpRequest* request, const char *serv, const char *method, StringBuffer &ns, double version) { + ns.append("urn:hpccsystems:ws:"); + if (serv && *serv) + ns.appendLower(strlen(serv), serv); + + if (method && *method) + ns.append(":").append(method); + ns.toLowerCase(); +} + class CEspCorsAllowedOrigin : public CInterfaceOf { StringBuffer hostPort; @@ -288,7 +300,7 @@ IEspCorsHelper *createEspCorsHelper(IPropertyTree *cors) EspHttpBinding::EspHttpBinding(IPropertyTree* tree, const char *bindname, const char *procname) { Owned proc_cfg = getProcessConfig(tree, procname); - m_viewConfig = proc_cfg ? proc_cfg->getPropBool("@httpConfigAccess") : false; + m_viewConfig = proc_cfg ? proc_cfg->getPropBool("@httpConfigAccess") : false; m_formOptions = proc_cfg ? proc_cfg->getPropBool("@formOptionsAccess") : false; m_includeSoapTest = true; m_includeJsonTest = true; @@ -346,7 +358,7 @@ EspHttpBinding::EspHttpBinding(IPropertyTree* tree, const char *bindname, const m_subservices.setown(createPTreeFromXMLFile(ssfile, ipt_caseInsensitive)); } } - + m_realm.set((realm) ? realm : "EspServices"); } } @@ -627,7 +639,7 @@ void EspHttpBinding::setUnrestrictedSSTypes() bool EspHttpBinding::isUnrestrictedSSType(sub_service ss) const { auto search = unrestrictedSSTypes.find(ss); - return (search != unrestrictedSSTypes.end()); + return (search != unrestrictedSSTypes.end()); } //Check whether the url is valid or not for redirect after authentication. @@ -1145,19 +1157,19 @@ int EspHttpBinding::onGet(CHttpRequest* request, CHttpResponse* response) LogLevel level = getEspLogLevel(&context); if (level >= LogNormal) DBGLOG("EspHttpBinding::onGet"); - + response->setVersion(HTTP_VERSION); response->addHeader("Expires", "0"); response->setStatus(HTTP_STATUS_OK); - + sub_service sstype = sub_serv_unknown; StringBuffer pathEx; StringBuffer serviceName; StringBuffer methodName; StringBuffer paramStr; - + request->getEspPathInfo(sstype, &pathEx, &serviceName, &methodName, false); // adjust version if necessary @@ -1382,7 +1394,7 @@ static void filterXmlBySchema(StringBuffer& in, StringBuffer& schema, const char if (type) filterXmlBySchema(tree,type,name,out); - else + else { const char* value = tree->queryProp(NULL); UWARNLOG("Unknown xml tag ignored: <%s>%s", name, value?value:"", name); @@ -1410,7 +1422,7 @@ void EspHttpBinding::getXMLMessageTag(IEspContext& ctx, bool isRequest, const ch void EspHttpBinding::getSoapMessage(StringBuffer& soapmsg, IEspContext& ctx, CHttpRequest* request, const char *serv, const char *method) { StringBuffer reqName(serv); - reqName.append("Request"); + reqName.append("Request"); Owned msg = new CRpcMessage(reqName.str()); msg->setContext(&ctx); @@ -1423,7 +1435,7 @@ void EspHttpBinding::getSoapMessage(StringBuffer& soapmsg, IEspContext& ctx, CHt getSchema(schema,ctx,request,serv,method,false); getXMLMessageTag(ctx, true, method, tag); filterXmlBySchema(req,schema,tag.str(),filtered); - + StringBuffer ns; soapmsg.appendf( "" @@ -1530,7 +1542,7 @@ static void filterXmlBySchema(StringBuffer& in, StringBuffer& schema, StringBuff if (type) filterXmlBySchema(tree,type,name,out,indent); - else + else { const char* value = tree->queryProp(NULL); DBGLOG("Unknown xml tag ignored: <%s>%s", name, value?value:"", name); @@ -1552,7 +1564,7 @@ void EspHttpBinding::getSoapMessage(StringBuffer& soapmsg, IEspContext& ctx, CHt getSchema(schema,ctx,request,serv,method,false); //DBGLOG("Schema: %s", schema.str()); filterXmlBySchema(req,schema,filtered,2); - + soapmsg.appendf( "\n" "transform(page); + xform->transform(page); response->setContent(page); response->setContentType("text/html; charset=UTF-8"); @@ -1755,24 +1767,24 @@ int EspHttpBinding::onGetIframe(IEspContext &context, CHttpRequest* request, CHt if(title.length() > 0) content.appendf("%s", title.str()); content.append(""); - + content.append(""); content.appendf("", title.str()); - - //content.appendf("", path, request->queryParamStr()); + + //content.appendf("", path, request->queryParamStr()); StringBuffer inner; request->getParameter("inner", inner); StringBuffer plainText; request->getParameter("PlainText", plainText); if (plainText.length() > 0) inner.appendf("&PlainText=%s", plainText.str()); - + ESPLOG(LogNormal,"Inner: %s", inner.str()); ESPLOG(LogNormal,"Param: %s", request->queryParamStr()); content.appendf("", inner.str()); content.append(""); content.append(""); - + response->setContent(content.length(), content.str()); response->setContentType("text/html"); response->send(); @@ -1823,7 +1835,7 @@ int EspHttpBinding::onGetVersion(IEspContext &context, CHttpRequest* request, CH StringBuffer srvQName; qualifyServiceName(context, service, NULL, srvQName, NULL); verxml.appendf("%s%.3f", srvQName.str(), m_wsdlVer); - + response->setContent(verxml.str()); response->setContentType(HTTP_TYPE_APPLICATION_XML_UTF8); response->setStatus(HTTP_STATUS_OK); @@ -1831,17 +1843,85 @@ int EspHttpBinding::onGetVersion(IEspContext &context, CHttpRequest* request, CH return 0; } +void getServiceSchema(const char *serviceQName, const char *methodQName, double version, const char *nstr, + const StringBuffer &xmlFilename, Owned ¶ms, EsdlXslTypeId EsdlXslType, + IProperties *opts, StringBuffer &schema) +{ + Owned esdlDef = createEsdlDefinition(nullptr, nullptr); + Owned defHelper = createEsdlDefinitionHelper(); + + std::string xmlFilePath(getCFD()); + xmlFilePath.append("esdl_files").append(PATHSEPSTR).append(xmlFilename.str()); + esdlDef->addDefinitionsFromFile(xmlFilePath.c_str()); + unsigned optFlags{DEPFLAG_COLLAPSE|DEPFLAG_ARRAYOF}; + Owned structs = esdlDef->getDependencies(serviceQName, methodQName, ";", version, opts, optFlags ); + + StringBuffer xlstFile(getCFD()); + xlstFile.append("xslt").append(PATHSEPSTR).append("esp_service_xml2xsd.xslt"); + + defHelper->loadTransform(xlstFile, params, EsdlXslType); + defHelper->toWSDL(*structs, schema, EsdlXslType, version, opts, nstr, optFlags); +} + + int EspHttpBinding::onGetXsd(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method) { - return getWsdlOrXsd(context,request,response,service,method,false); + return getServiceWsdlOrXsd(context, request, response, service, method, false); } int EspHttpBinding::onGetWsdl(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method) { - return getWsdlOrXsd(context,request,response,service,method,true); + return getServiceWsdlOrXsd(context, request, response, service, method, true); } -bool EspHttpBinding::getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequest* req, const char *service, const char *method, bool standalone) +int EspHttpBinding::getServiceWsdlOrXsd(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method, bool isWsdl) +{ + StringBuffer serviceQName; + StringBuffer methodQName; + + if (!qualifyServiceName(context, service, method, serviceQName, &methodQName)) + return onGetNotFound(context, request, response, service); + + Owned params; + params.set(createProperties()); + + double version = getVersion(context); + params->setProp("version", StringBuffer("'").appendf("%g", version).append("'")); + + StringBuffer nstr; + generateEsdlNamespace(context, request, serviceQName.str(), methodQName.str(), nstr, version); + params->setProp("tnsParam", StringBuffer("'").append(nstr).append("'").str()); + + if (isWsdl) + { + params->setProp( "create_wsdl", "true()" ); + StringBuffer location(m_wsdlAddress.str()); + if (request->queryParameters()->hasProp("wsdl_destination_path")) + location.append(request->queryParameters()->queryProp("wsdl_destination_path")); + else + location.append('/').append(serviceQName.str()).appendf("?ver_=%g", version); + params->setProp("location", StringBuffer("'").append(location).append("'").str()); + } + + StringBuffer xmlFilename; + if (!getXmlFilename(xmlFilename)) + { + throw MakeStringException(-1, "Unable to get service XML filename"); + } + + StringBuffer schema; + getServiceSchema(serviceQName.str(), methodQName.str(), version, nstr.str(), xmlFilename, + params, isWsdl ? EsdlXslToWsdl : EsdlXslToXsd, context.queryRequestParameters(), schema); + + response->setContent(schema.length(), schema.str()); + response->setContentType(HTTP_TYPE_APPLICATION_XML_UTF8); + response->setStatus(HTTP_STATUS_OK); + response->send(); + return 0; +} + + +bool EspHttpBinding::getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequest* req, const char *service, const char *method, bool standalone) { StringBuffer serviceQName; StringBuffer methodQName; @@ -1870,10 +1950,10 @@ bool EspHttpBinding::getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequ ForEach(*nsiter) { IPropertyTree &ns = nsiter->query(); - if (ns.hasProp("@import")) + if (ns.hasProp("@import")) schema.appendf("", ns.queryProp("@ns"), ns.queryProp("@location")); } - + schema.append( "" @@ -1895,7 +1975,7 @@ bool EspHttpBinding::getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequ if (ctx.queryOptions()&ESPCTX_WSDL_EXT) { - schema.append( + schema.append( "" "" "" @@ -1919,91 +1999,13 @@ bool EspHttpBinding::getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequ ); } - bool mda=(req->queryParameters()->getPropInt("mda")!=0); + bool mda = (req->queryParameters()->getPropInt("mda") != 0); getXsdDefinition(ctx, req, schema, sqName, mqName, mda); - schema.append("\n"); schema.append(""); - return true; } -int EspHttpBinding::getWsdlOrXsd(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method, bool isWsdl) -{ - bool mda=(request->queryParameters()->getPropInt("mda")!=0); - try - { - StringBuffer serviceQName; - StringBuffer methodQName; - - if (!qualifyServiceName(context, service, method, serviceQName, &methodQName)) - { - return onGetNotFound(context, request, response, service); - } - else - { - const char *sqName = serviceQName.str(); - const char *mqName = methodQName.str(); - StringBuffer ns; - generateNamespace(context, request, serviceQName.str(), methodQName.str(), ns); - - StringBuffer content(""); - if (context.queryRequestParameters()->hasProp("display")) - content.append(""); - else if (isWsdl && context.queryRequestParameters()->hasProp("wsdlviewer")) - content.append(""); - if (isWsdl) - { - content.appendf("", ns.str(), ns.str()); - content.append(""); - } - - getSchema(content,context,request,service,method,!isWsdl); - - if (isWsdl) - { - content.append(""); - - getWsdlMessages(context, request, content, sqName, mqName, mda); - getWsdlPorts(context, request, content, sqName, mqName, mda); - getWsdlBindings(context, request, content, sqName, mqName, mda); - - StringBuffer location(m_wsdlAddress.str()); - if (request->queryParameters()->hasProp("wsdl_destination_path")) - location.append(request->queryParameters()->queryProp("wsdl_destination_path")); - else - location.append('/').append(sqName).appendf("?ver_=%g", context.getClientVersion()); - - if (request->queryParameters()->hasProp("encode_results")) - { - const char *encval = request->queryParameters()->queryProp("encode_results"); - location.append("&").appendf("encode_=%s", (encval && *encval) ? encval : "1"); - } - - content.appendf("", sqName); - content.appendf("", sqName, sqName); - content.appendf("", location.str()); - content.append(""); - content.append(""); - content.append(""); - } - - response->setContent(content.length(), content.str()); - response->setContentType(HTTP_TYPE_APPLICATION_XML_UTF8); - response->setStatus(HTTP_STATUS_OK); - } - } - catch (IException *e) - { - return onGetException(context, request, response, *e); - } - - response->send(); - return 0; -} - static void genSampleXml(StringStack& parent, IXmlType* type, StringBuffer& out, const char* tag, const char* ns=NULL) { assertex(type!=NULL); @@ -2014,7 +2016,7 @@ static void genSampleXml(StringStack& parent, IXmlType* type, StringBuffer& out, { if (typeName && std::find(parent.begin(),parent.end(),typeName) != parent.end()) return; // recursive - + out.appendf("<%s", tag); if (ns) out.append(' ').append(ns); @@ -2028,9 +2030,9 @@ static void genSampleXml(StringStack& parent, IXmlType* type, StringBuffer& out, out.append('>'); if (typeName) parent.push_back(typeName); - + int flds = type->getFieldCount(); - + switch (type->getSubType()) { case SubType_Complex_SimpleContent: @@ -2045,7 +2047,7 @@ static void genSampleXml(StringStack& parent, IXmlType* type, StringBuffer& out, } if (typeName) - parent.pop_back(); + parent.pop_back(); out.appendf("",tag); } else if (type->isArray()) @@ -2063,7 +2065,7 @@ static void genSampleXml(StringStack& parent, IXmlType* type, StringBuffer& out, parent.push_back(typeName); genSampleXml(parent,itemType,item,itemName); if (typeName) - parent.pop_back(); + parent.pop_back(); // gen two items out.appendf("<%s>%s%s", tag,item.str(),item.str(),tag); @@ -2346,7 +2348,7 @@ int EspHttpBinding::onFinishUpload(IEspContext &ctx, CHttpRequest* request, CHtt int EspHttpBinding::getWsdlMessages(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda) { bool allMethods = (method==NULL || !*method); - + MethodInfoArray methods; getQualifiedNames(context, methods); int count=methods.ordinality(); @@ -2416,7 +2418,7 @@ int EspHttpBinding::getWsdlBindings(IEspContext &context, CHttpRequest *request, content.appendf("", serviceName.str(), serviceName.str()); content.append(""); - + bool allMethods = (method==NULL || !*method); MethodInfoArray methods; getQualifiedNames(context, methods); @@ -2436,7 +2438,7 @@ int EspHttpBinding::getWsdlBindings(IEspContext &context, CHttpRequest *request, content.append(""); content.append(""); content.append(""); - + content.append(""); if (!allMethods) // no need to continue break; @@ -2560,8 +2562,8 @@ int EspHttpBinding::onGetIndex(IEspContext &context, CHttpRequest* request, CHt list->appendContent(new CHtmlLink(method.m_label.str(), wsLink.str())); } } - - page.appendContent(new CHtmlText("
For a formal definition, please review the ")); + + page.appendContent(new CHtmlText("
For a formal definition, please review the ")); urlParams.append(urlParams.length()>0 ? "&wsdl" : "?wsdl"); wsLink.clear().appendf("%s", urlParams.str()); @@ -2601,7 +2603,7 @@ void EspHttpBinding::escapeSingleQuote(StringBuffer& src, StringBuffer& escaped) { if (*p == '\'') escaped.append("'"); - else + else escaped.append(*p); } } @@ -2653,7 +2655,7 @@ int EspHttpBinding::onGetXForm(IEspContext &context, CHttpRequest* request, CHtt if (!getUrlParams(context.queryRequestParameters(),params)) params.appendf("%cver_=%g",(params.length()>0) ? '&' : '?', context.getClientVersion()); xform->setStringParameter("queryParams", params.str()); - + StringBuffer tmp,escaped; getMethodHelp(context, serviceQName, methodQName, tmp); escapeSingleQuote(tmp,escaped); @@ -2693,7 +2695,7 @@ int EspHttpBinding::onGetXForm(IEspContext &context, CHttpRequest* request, CHtt break; } } - xform->transform(page); + xform->transform(page); response->setContentType("text/html"); response->setContent(page.str()); } @@ -2759,7 +2761,7 @@ int EspHttpBinding::onGetForm(IEspContext &context, CHttpRequest* request, CHttp "" "" "

"); - + page.appendf("> %s", methodQName.str()); page.append("

" "" @@ -2810,25 +2812,25 @@ int EspHttpBinding::onGetForm(IEspContext &context, CHttpRequest* request, CHttp response->setContent(page.str()); response->setContentType("text/html"); } - + response->send(); return 0; } - + int EspHttpBinding::formatHtmlResultSet(IEspContext &context, const char *serv, const char *method, const char *resultsXml, StringBuffer &html) { Owned ptree = createPTreeFromXMLString(resultsXml); - + Owned exceptions = ptree->getElements("//Exception"); ForEach(*exceptions.get()) { IPropertyTree &xcpt = exceptions->query(); - html.appendf("
Exception:
Reported by: %s
Message: %s
", + html.appendf("
Exception:
Reported by: %s
Message: %s
", xcpt.queryProp("Source"), xcpt.queryProp("Message")); } - + Owned datasets = ptree->getElements("//Dataset"); ForEach(*datasets.get()) { @@ -2842,14 +2844,14 @@ int EspHttpBinding::formatHtmlResultSet(IEspContext &context, const char *serv, if (row1) { html.append(" "); - + Owned columns = row1->getElements("*"); ForEach(*columns.get()) { const char *title = columns->query().queryName(); html.appendf("%s", (title!=NULL) ? title : " "); - } - + } + html.append(""); } @@ -2861,21 +2863,21 @@ int EspHttpBinding::formatHtmlResultSet(IEspContext &context, const char *serv, { IPropertyTree &row = datarows->query(); Owned columns = row.getElements("*"); - + html.appendf("%d", count++); ForEach(*columns.get()) { const char *value = columns->query().queryProp(NULL); html.appendf("%s", (value!=NULL) ? value : " "); - } - + } + html.append(""); } } - + html.append(""); } - + return 0; } @@ -2928,7 +2930,7 @@ int EspHttpBinding::formatResultsPage(IEspContext &context, const char *serv, co "" "" "

"); - + page.appendf("> %s Results", methodQName.str()); page.append("

" "" @@ -2967,7 +2969,7 @@ bool EspHttpBinding::setContentFromFile(IEspContext &context, CHttpResponse &res return false; } -void EspHttpBinding::onBeforeSendResponse(IEspContext& context, CHttpRequest* request, MemoryBuffer& content, +void EspHttpBinding::onBeforeSendResponse(IEspContext& context, CHttpRequest* request, MemoryBuffer& content, const char *serviceName, const char* methodName) { IProperties* params = request->queryParameters(); @@ -2977,7 +2979,7 @@ void EspHttpBinding::onBeforeSendResponse(IEspContext& context, CHttpRequest* re sortResponse(context, request, content, serviceName, methodName); } -void EspHttpBinding::validateResponse(IEspContext& context, CHttpRequest* request, MemoryBuffer& content, +void EspHttpBinding::validateResponse(IEspContext& context, CHttpRequest* request, MemoryBuffer& content, const char *service, const char* method) { StringBuffer serviceQName; @@ -2985,15 +2987,15 @@ void EspHttpBinding::validateResponse(IEspContext& context, CHttpRequest* reques if (!qualifyServiceName(context, service, method, serviceQName, &methodQName)) return; - + StringBuffer xml,xsd; - + // name space StringBuffer ns; generateNamespace(context, request, serviceQName.str(), methodQName.str(), ns); // XML - Owned tree; + Owned tree; try { tree.setown(createPTreeFromXMLString(content.length(), content.toByteArray())); // format it for better error message @@ -3001,14 +3003,14 @@ void EspHttpBinding::validateResponse(IEspContext& context, CHttpRequest* reques //Hack: add default name space to XML const char* end = strstr(xml, ""); if (end) end = strchr(end+2, '>'); if (!end) throw MakeStringException(-1,"Invalid response XML in processing instruction"); - } + } else { end = strchr(xml, '>'); @@ -3033,7 +3035,7 @@ void EspHttpBinding::validateResponse(IEspContext& context, CHttpRequest* reques // schema getSchema(xsd,context,request,serviceQName,methodQName,true); - + // validation if (getEspLogLevel()>LogMax) DBGLOG("[VALIDATE] xml: %s\nxsd: %s\nns: %s",xml.str(), xsd.str(), ns.str()); @@ -3068,7 +3070,7 @@ void EspHttpBinding::validateResponse(IEspContext& context, CHttpRequest* reques content.setBuffer(len, temp.detach(), true); } -void EspHttpBinding::sortResponse(IEspContext& context, CHttpRequest* request, MemoryBuffer& content, +void EspHttpBinding::sortResponse(IEspContext& context, CHttpRequest* request, MemoryBuffer& content, const char *serviceName, const char* methodName) { ESPLOG(LogNormal,"Sorting Response XML..."); @@ -3088,7 +3090,7 @@ void EspHttpBinding::sortResponse(IEspContext& context, CHttpRequest* request, M if (getEspLogLevel()>LogNormal) DBGLOG("XML sorted: %s", result.str()); unsigned len = result.length(); - content.setBuffer(len, result.detach(), true); + content.setBuffer(len, result.detach(), true); } catch (IException* e) { StringBuffer msg; IERRLOG("Unexpected error: parsing XML: %s", e->errorMessage(msg).str()); diff --git a/esp/bindings/http/platform/httpbinding.hpp b/esp/bindings/http/platform/httpbinding.hpp index 93821268e5b..e36ba07097f 100644 --- a/esp/bindings/http/platform/httpbinding.hpp +++ b/esp/bindings/http/platform/httpbinding.hpp @@ -111,6 +111,7 @@ interface IEspWsdlSections // virtual MethodInfoArray & queryQualifiedNames(IEspContext& ctx)=0; virtual int getQualifiedNames(IEspContext& ctx, MethodInfoArray & methods)=0; virtual int getXsdDefinition(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda)=0; + virtual int getXmlFilename(StringBuffer &filename)=0; virtual int getWsdlMessages(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda)=0; virtual int getWsdlPorts(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda)=0; virtual int getWsdlBindings(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda)=0; @@ -344,6 +345,7 @@ class esp_http_decl EspHttpBinding : // MethodInfoArray &queryQualifiedNames(IEspContext& ctx) { m_methods.popAll(); getQualifiedNames(ctx,m_methods); return m_methods;}; int getXsdDefinition(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda){return 0;}; + int getXmlFilename(StringBuffer &filename) {return 0;}; int getWsdlMessages(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda); int getWsdlPorts(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda); int getWsdlBindings(IEspContext &context, CHttpRequest *request, StringBuffer &content, const char *service, const char *method, bool mda); @@ -427,9 +429,21 @@ class esp_http_decl EspHttpBinding : static void escapeSingleQuote(StringBuffer& src, StringBuffer& escaped); + virtual bool getDefaultClientVersion(double &ver) {ver=0; return true;} + + double getVersion(IEspContext &context) + { + double version = context.getClientVersion(); + if (version == 0.0) + { + getDefaultClientVersion(version); + } + return version; + } + protected: virtual bool basicAuth(IEspContext* ctx); - int getWsdlOrXsd(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method, bool isWsdl); + int getServiceWsdlOrXsd(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method, bool isWsdl); virtual bool getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequest* req, const char *service, const char *method,bool standalone); virtual void appendSchemaNamespaces(IPropertyTree *namespaces, IEspContext &ctx, CHttpRequest* req, const char *service, const char *method){} void generateSampleXml(bool isRequest, IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *serv, const char *method); diff --git a/esp/esdllib/CMakeLists.txt b/esp/esdllib/CMakeLists.txt index 72dde89ae1e..e79da490aa3 100644 --- a/esp/esdllib/CMakeLists.txt +++ b/esp/esdllib/CMakeLists.txt @@ -27,6 +27,7 @@ include_directories ( ${HPCC_SOURCE_DIR}/system/include ${HPCC_SOURCE_DIR}/esp/esdllib ${HPCC_SOURCE_DIR}/esp/services/common + ${HPCC_SOURCE_DIR}/esp/esdlscriptlib ${HPCC_SOURCE_DIR}/system/jlib ${HPCC_SOURCE_DIR}/system/security/shared ${HPCC_SOURCE_DIR}/rtl/eclrtl @@ -43,23 +44,11 @@ set ( SRCS esdl_def.cpp esdl_def_helper.cpp esdl_transformer2.cpp - esdl_script.cpp params2xml.cpp - ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp; ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp/xpp/xpputils.cpp ${HPCC_SOURCE_DIR}/esp/services/common/wsexcept.cpp ) -if (USE_LIBXSLT) - list (APPEND SRCS - esdl_xpath_extensions_libxml.cpp - ) -else() - list (APPEND SRCS - esdl_xpath_extensions_unsupported.cpp - ) -endif() - HPCC_ADD_LIBRARY( esdllib SHARED ${SRCS} ${HEADERS} ) @@ -71,8 +60,7 @@ add_dependencies ( esdllib jlib espscm) target_link_libraries ( esdllib jlib xmllib - thorhelper - esphttp + dllserver ) IF (USE_LIBXSLT) diff --git a/esp/esdlscriptlib/CMakeLists.txt b/esp/esdlscriptlib/CMakeLists.txt new file mode 100644 index 00000000000..15e67acd136 --- /dev/null +++ b/esp/esdlscriptlib/CMakeLists.txt @@ -0,0 +1,72 @@ +################################################################################ +# HPCC SYSTEMS software Copyright (C) 2013 HPCC Systems®. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ +# Component: esdllib + +project( esdllib ) + +include_directories ( + ${HPCC_SOURCE_DIR}/system/xmllib + ${HPCC_SOURCE_DIR}/esp/bindings + ${HPCC_SOURCE_DIR}/esp/bindings/http/client + ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp + ${HPCC_SOURCE_DIR}/esp/platform + ${HPCC_SOURCE_DIR}/system/include + ${HPCC_SOURCE_DIR}/esp/services/common + ${HPCC_SOURCE_DIR}/system/jlib + ${HPCC_SOURCE_DIR}/system/security/shared + ${HPCC_SOURCE_DIR}/rtl/eclrtl + ${HPCC_SOURCE_DIR}/rtl/include #IXMLWriter + ${HPCC_SOURCE_DIR}/common/dllserver #loading plugins + ${HPCC_SOURCE_DIR}/system/masking/include +) + +ADD_DEFINITIONS ( -D_USRDLL -DESDLSCRIPTLIB_EXPORTS ) + +set ( SRCS + esdl_script.cpp + ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp; + ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp/xpp/xpputils.cpp +) + +if (USE_LIBXSLT) + list (APPEND SRCS + esdl_xpath_extensions_libxml.cpp + ) +else() + list (APPEND SRCS + esdl_xpath_extensions_unsupported.cpp + ) +endif() + +HPCC_ADD_LIBRARY( esdlscriptlib SHARED ${SRCS} + ${HEADERS} +) + +install ( TARGETS esdlscriptlib RUNTIME DESTINATION bin LIBRARY DESTINATION lib ) + +add_dependencies ( esdlscriptlib jlib espscm) + +target_link_libraries ( esdlscriptlib + jlib + dllserver + esphttp +) + +IF (USE_LIBXSLT) + include_directories ( + ${LIBXML2_INCLUDE_DIR} + ) +ENDIF() diff --git a/esp/esdllib/esdl_script.cpp b/esp/esdlscriptlib/esdl_script.cpp similarity index 99% rename from esp/esdllib/esdl_script.cpp rename to esp/esdlscriptlib/esdl_script.cpp index dd3d7bf5f0d..b1a3db77ac8 100644 --- a/esp/esdllib/esdl_script.cpp +++ b/esp/esdlscriptlib/esdl_script.cpp @@ -3133,7 +3133,7 @@ class CEsdlTransformOperationSetTraceOptions : public CEsdlTransformOperationWit const char* locked = stag.getValue("locked"); if (!isEmptyString(locked)) m_locked.setown(compileXpath(locked)); - + if (!m_enabled && !m_locked) recordError(ESDL_SCRIPT_MissingOperationAttr, "missing all options"); } @@ -3911,11 +3911,11 @@ class CEsdlTransformMethodMap : public CInterfaceOf } }; -esdl_decl IEsdlScriptContext* createEsdlScriptContext(IEspContext* espCtx, IEsdlFunctionRegister* functionRegister, IDataMaskingEngine* engine) +esdlscript_decl IEsdlScriptContext* createEsdlScriptContext(IEspContext* espCtx, IEsdlFunctionRegister* functionRegister, IDataMaskingEngine* engine) { return new CEsdlScriptContext(espCtx, functionRegister, engine); } -esdl_decl IEsdlTransformMethodMap *createEsdlTransformMethodMap() +esdlscript_decl IEsdlTransformMethodMap *createEsdlTransformMethodMap() { return new CEsdlTransformMethodMap(); } diff --git a/esp/esdllib/esdl_script.hpp b/esp/esdlscriptlib/esdl_script.hpp similarity index 90% rename from esp/esdllib/esdl_script.hpp rename to esp/esdlscriptlib/esdl_script.hpp index 4566341881d..9a935a9db1a 100644 --- a/esp/esdllib/esdl_script.hpp +++ b/esp/esdlscriptlib/esdl_script.hpp @@ -18,10 +18,10 @@ #ifndef ESDL_SCRIPT_HPP_ #define ESDL_SCRIPT_HPP_ -#ifdef ESDLLIB_EXPORTS - #define esdl_decl DECL_EXPORT +#ifdef ESDLSCRIPTLIB_EXPORTS + #define esdlscript_decl DECL_EXPORT #else - #define esdl_decl + #define esdlscript_decl #endif #include "jlib.hpp" @@ -30,7 +30,7 @@ #include "jlog.hpp" #include "esp.hpp" -#include "esdl_def.hpp" +//#include "esdl_def.hpp" #include "datamaskingengine.hpp" #include "tracer.h" @@ -163,7 +163,7 @@ interface IEsdlScriptContext : extends ISectionalXmlDocModel * The absence of a sectional document model in the parameter list implies the returned instance * is responsible for creating its own model. */ -extern "C" esdl_decl IEsdlScriptContext* createEsdlScriptContext(IEspContext* espCtx, IEsdlFunctionRegister* functionRegister, IDataMaskingEngine* engine); +extern "C" esdlscript_decl IEsdlScriptContext* createEsdlScriptContext(IEspContext* espCtx, IEsdlFunctionRegister* functionRegister, IDataMaskingEngine* engine); interface IEsdlCustomTransform : extends IInterface { @@ -229,11 +229,11 @@ interface IEsdlTransformMethodMap : extends IInterface virtual void bindFunctionCalls() = 0; }; -esdl_decl IEsdlTransformMethodMap *createEsdlTransformMethodMap(); +esdlscript_decl IEsdlTransformMethodMap *createEsdlTransformMethodMap(); -esdl_decl IEsdlCustomTransform *createEsdlCustomTransform(const char *scriptXml, const char *ns_prefix); +esdlscript_decl IEsdlCustomTransform *createEsdlCustomTransform(const char *scriptXml, const char *ns_prefix); -esdl_decl void processServiceAndMethodTransforms(IEsdlScriptContext * scriptCtx, std::initializer_list const &transforms, const char *srcSection, const char *tgtSection); -esdl_decl void registerEsdlXPathExtensions(IXpathContext *xpathCtx, IEsdlScriptContext *scriptCtx, const StringArray &prefixes); +esdlscript_decl void processServiceAndMethodTransforms(IEsdlScriptContext * scriptCtx, std::initializer_list const &transforms, const char *srcSection, const char *tgtSection); +esdlscript_decl void registerEsdlXPathExtensions(IXpathContext *xpathCtx, IEsdlScriptContext *scriptCtx, const StringArray &prefixes); #endif /* ESDL_SCRIPT_HPP_ */ diff --git a/esp/esdllib/esdl_xpath_extensions_libxml.cpp b/esp/esdlscriptlib/esdl_xpath_extensions_libxml.cpp similarity index 100% rename from esp/esdllib/esdl_xpath_extensions_libxml.cpp rename to esp/esdlscriptlib/esdl_xpath_extensions_libxml.cpp diff --git a/esp/esdllib/esdl_xpath_extensions_unsupported.cpp b/esp/esdlscriptlib/esdl_xpath_extensions_unsupported.cpp similarity index 100% rename from esp/esdllib/esdl_xpath_extensions_unsupported.cpp rename to esp/esdlscriptlib/esdl_xpath_extensions_unsupported.cpp diff --git a/esp/logging/logginglib/CMakeLists.txt b/esp/logging/logginglib/CMakeLists.txt index 1beb7a573f7..23e3727bbd7 100644 --- a/esp/logging/logginglib/CMakeLists.txt +++ b/esp/logging/logginglib/CMakeLists.txt @@ -32,6 +32,7 @@ include_directories ( ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/Platform #CSoapRequestBinding ${HPCC_SOURCE_DIR}/esp/clients #edwin.h in generated/ws_loggingservice.esp ${HPCC_SOURCE_DIR}/esp/esdllib + ${HPCC_SOURCE_DIR}/esp/esdlscriptlib ${HPCC_SOURCE_DIR}/common/thorhelper ) @@ -58,5 +59,5 @@ target_link_libraries ( logginglib jlib xmllib esphttp - esdllib + esdlscriptlib ) diff --git a/esp/protocols/http/CMakeLists.txt b/esp/protocols/http/CMakeLists.txt index b2d39e4e075..db16c06339a 100644 --- a/esp/protocols/http/CMakeLists.txt +++ b/esp/protocols/http/CMakeLists.txt @@ -64,10 +64,11 @@ include_directories( ./../../../system/security/shared ./../../../system/security/LdapSecurity ./../../../system/security/zcrypt - ./../../../system/mp + ./../../../system/mp ./../../../dali/base ./../../../common/workunit ${HPCC_SOURCE_DIR}/common/thorhelper + ${HPCC_SOURCE_DIR}/esp/esdllib ) add_definitions(-DESPHTTP_EXPORTS -DESP_TIMING -D_USRDLL -DESP_PLUGIN -DTXSUMMARY_EXPORTS) @@ -76,6 +77,7 @@ if(USE_OPENLDAP) endif() HPCC_ADD_LIBRARY(esphttp SHARED ${SRCS}) add_dependencies(esphttp espscm) + install(TARGETS esphttp RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR}) target_link_libraries( esphttp @@ -86,6 +88,7 @@ target_link_libraries( dalibase thorhelper # this should not be dependent on the engine helper dll workunit # neither should it be dependent on the wokunit dll + esdllib ) if(LIBMEMCACHED_FOUND) diff --git a/esp/scm/additional.cmake b/esp/scm/additional.cmake index 105dbaa7b63..e34b4b9c76a 100644 --- a/esp/scm/additional.cmake +++ b/esp/scm/additional.cmake @@ -53,6 +53,9 @@ foreach ( loop_var ${ESPSCM_SRCS} ) set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}_esp.ipp PROPERTIES GENERATED TRUE) set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}.xml PROPERTIES GENERATED TRUE) set ( ESP_GENERATED_INCLUDES ${ESP_GENERATED_INCLUDES} ${ESPSCM_GENERATED_DIR}/${result}.esp ${ESPSCM_GENERATED_DIR}/${result}.hpp ${ESPSCM_GENERATED_DIR}/${result}.ipp ${ESPSCM_GENERATED_DIR}/${result}_esp.ipp ${ESPSCM_GENERATED_DIR}/${result}.xml ) + if ( PLATFORM ) + Install( FILES ${ESPSCM_GENERATED_DIR}/${result}.xml DESTINATION componentfiles/esdl_files COMPONENT Runtime ) + endif ( PLATFORM ) endforeach ( loop_var ${ESPSCM_SRCS} ) include_directories ( ${ESPSCM_GENERATED_DIR} ${HPCC_SOURCE_DIR}/esp/espcommon) diff --git a/esp/scm/smcscm.cmake b/esp/scm/smcscm.cmake index 42ff20ff9d3..d90d80364c3 100644 --- a/esp/scm/smcscm.cmake +++ b/esp/scm/smcscm.cmake @@ -70,6 +70,9 @@ foreach ( loop_var ${ESPSCM_SRCS} ) set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}_esp.ipp PROPERTIES GENERATED TRUE) set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}.xml PROPERTIES GENERATED TRUE) set ( ESP_GENERATED_INCLUDES ${ESP_GENERATED_INCLUDES} ${ESPSCM_GENERATED_DIR}/${result}.esp ${ESPSCM_GENERATED_DIR}/${result}.hpp ${ESPSCM_GENERATED_DIR}/${result}.ipp ${ESPSCM_GENERATED_DIR}/${result}_esp.ipp ${ESPSCM_GENERATED_DIR}/${result}.xml ) + if ( PLATFORM ) + Install( FILES ${ESPSCM_GENERATED_DIR}/${result}.xml DESTINATION componentfiles/esdl_files COMPONENT Runtime ) + endif ( PLATFORM ) endforeach ( loop_var ${ESPSCM_SRCS} ) include_directories ( ${ESPSCM_GENERATED_DIR} ${HPCC_SOURCE_DIR}/esp/espcommon ) diff --git a/esp/services/esdl_svc_engine/CMakeLists.txt b/esp/services/esdl_svc_engine/CMakeLists.txt index 969d98f23ee..796c164eba2 100755 --- a/esp/services/esdl_svc_engine/CMakeLists.txt +++ b/esp/services/esdl_svc_engine/CMakeLists.txt @@ -61,6 +61,7 @@ include_directories ( ${HPCC_SOURCE_DIR}/rtl/eclrtl ${HPCC_SOURCE_DIR}/rtl/include ${HPCC_SOURCE_DIR}/esp/esdllib + ${HPCC_SOURCE_DIR}/esp/esdlscriptlib ${HPCC_SOURCE_DIR}/esp/logging/logginglib ${HPCC_SOURCE_DIR}/esp/logging/loggingmanager ${CMAKE_BINARY_DIR} @@ -86,6 +87,7 @@ target_link_libraries ( esdl_svc_engine remote dalibase esdllib + esdlscriptlib dllserver dalibase ${COMMON_ESP_SERVICE_LIBS} diff --git a/esp/services/ws_esdlconfig/CMakeLists.txt b/esp/services/ws_esdlconfig/CMakeLists.txt index b2f01116d01..87d794da1f3 100644 --- a/esp/services/ws_esdlconfig/CMakeLists.txt +++ b/esp/services/ws_esdlconfig/CMakeLists.txt @@ -57,6 +57,7 @@ include_directories ( ${HPCC_SOURCE_DIR}/esp/smc/SMCLib ${HPCC_SOURCE_DIR}/esp/services/esdl_svc_engine ${HPCC_SOURCE_DIR}/esp/esdllib + ${HPCC_SOURCE_DIR}/esp/esdlscriptlib ${HPCC_SOURCE_DIR}/esp/logging/logginglib ${HPCC_SOURCE_DIR}/esp/logging/loggingmanager ${HPCC_SOURCE_DIR}/common/thorhelper diff --git a/esp/xslt/CMakeLists.txt b/esp/xslt/CMakeLists.txt index 91ecc66a870..53666fb5690 100644 --- a/esp/xslt/CMakeLists.txt +++ b/esp/xslt/CMakeLists.txt @@ -43,6 +43,7 @@ FOREACH( iFILES ${CMAKE_CURRENT_SOURCE_DIR}/esdl2monitor.xslt ${CMAKE_CURRENT_SOURCE_DIR}/esdl2monitor_cassandra.xslt ${CMAKE_CURRENT_SOURCE_DIR}/esxdl2xsd.xslt + ${CMAKE_CURRENT_SOURCE_DIR}/esp_service_xml2xsd.xslt ${CMAKE_CURRENT_SOURCE_DIR}/esdl2java_srvbase.xslt ${CMAKE_CURRENT_SOURCE_DIR}/esdl2java_srvdummy.xslt ${CMAKE_CURRENT_SOURCE_DIR}/esdl2cpp_srvbasehpp.xslt diff --git a/esp/xslt/esp_service_xml2xsd.xslt b/esp/xslt/esp_service_xml2xsd.xslt new file mode 100644 index 00000000000..dc1a6b3d7d0 --- /dev/null +++ b/esp/xslt/esp_service_xml2xsd.xslt @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all + + + + + + + + + + + + + + + + + + + ArrayOf + + + + + + + tns: + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + xsd: + + xsd: + + xsd: + + xsd: + + xsd: + + xsd: + + tns: + + + + + + + + true + false + + + Test string: <abc> & <def> + + + + + + + + + + + +
+ + + + + + + + + + + + + + true + false + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xsd: + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + tns: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xsd:string + + + tns: + + + + + + + + + + + + + + + + + + + + + + + + tns:EspStringArray + + + + + + + + + + + + + + + tns:ArrayOf + + + + + + + + + + + + + + + xsd:string + tns: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SoapIn + + + + tns: + + tns: + + + + + + + SoapOut + + tns: + + + + + + ServiceSoap + + + + + + + tns:SoapIn + + + tns:SoapOut + + + + + + + + ServiceSoap + tns:ServiceSoap + + + + + + + + /?ver_= + + + + + + + + + + + + + + + + + + + + ServiceSoap + tns:ServiceSoap + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/testing/unittests/CMakeLists.txt b/testing/unittests/CMakeLists.txt index 3c5c40c755b..58153493d35 100644 --- a/testing/unittests/CMakeLists.txt +++ b/testing/unittests/CMakeLists.txt @@ -83,6 +83,7 @@ include_directories ( ${HPCC_SOURCE_DIR}/esp/bindings ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp ${HPCC_SOURCE_DIR}/esp/esdllib + ${HPCC_SOURCE_DIR}/esp/esdlscriptlib ${HPCC_SOURCE_DIR}/esp/logging ${HPCC_SOURCE_DIR}/esp/logging/logginglib ${HPCC_SOURCE_DIR}/esp/logging/loggingmanager diff --git a/tools/hidl/hidlcomp.cpp b/tools/hidl/hidlcomp.cpp index 18435d24ee0..eab25cd41f2 100644 --- a/tools/hidl/hidlcomp.cpp +++ b/tools/hidl/hidlcomp.cpp @@ -4995,6 +4995,9 @@ void EspServInfo::write_esp_binding_ipp() //method ==> processRequest outs("\tvirtual int processRequest(IRpcMessage* rpc_call, IRpcMessage* rpc_response);\n"); + // method ===> getXmlFilename + outs("\tint getXmlFilename(StringBuffer &filename);\n"); + //method ==> getXsdDefinition outs("\tint getXsdDefinition(IEspContext &context, CHttpRequest* request, StringBuffer &content, const char *service, const char *method, bool mda);\n"); @@ -5049,7 +5052,7 @@ void EspServInfo::write_esp_binding_ipp() outs("\tvirtual int onGetInstantQuery(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method);\n"); //Method ==> getDefaultClientVersion - outs("\tbool getDefaultClientVersion(double &ver);\n"); + outs("\tvirtual bool getDefaultClientVersion(double &ver);\n"); //Method ==> xslTransform if (needsXslt) @@ -5116,7 +5119,7 @@ void EspServInfo::write_esp_binding_ipp() outs("};\n\n"); } -void EspServInfo::write_esp_binding() +void EspServInfo::write_esp_binding(const char *packagename) { EspMethodInfo *mthi=NULL; int useMethodName = getMetaInt("use_method_name", 0); @@ -5360,12 +5363,21 @@ void EspServInfo::write_esp_binding() outs("\treturn -1;\n"); outs("}\n"); - //method ==> getXsdDefinition + + //method ==> getXmlFilename for xsd and wsdl transformations + outf("\nint C%sSoapBinding::getXmlFilename(StringBuffer &filename)\n", name_); + outs("{\n"); + outf("\tfilename.append(\"%s.xml\");\n", packagename); + outs("\treturn 1;\n"); + outs("}\n"); + + //method ==> getXsdDefinition packagename is the base ecm filename outf("\nint C%sSoapBinding::getXsdDefinition(IEspContext &context, CHttpRequest* request, StringBuffer &content, const char *service, const char *method, bool mda)\n", name_); outs("{\n"); outs("\tBoolHash added;\n"); + // version if (hasVersion) { @@ -5374,6 +5386,9 @@ void EspServInfo::write_esp_binding() } outs("\tDBGLOG(\"Client version: %g\", context.getClientVersion());\n"); + // getXSDDefinition(StringBuffer &content, const char *packageName, const char *serviceName, double version, const char *method); +// outf( "getXSDDefinition(content, \"%s\", \"%s\", context.getClientVersion(), method);\n\n", packagename, name_); + indentReset(1); outf(1, "bool fullservice = (!Utils::strcasecmp(service, \"%s\"));\n", name_); indentOuts("bool allMethods = (method==NULL || *method==0);\n"); @@ -6626,7 +6641,7 @@ void HIDLcompiler::write_esp() EspServInfo *si; for (si=servs;si;si=si->next) { - si->write_esp_binding(); + si->write_esp_binding(packagename); outs("\n\n"); si->write_esp_service(); outs("\n\n"); diff --git a/tools/hidl/hidlcomp.h b/tools/hidl/hidlcomp.h index f2841bbd0a4..a78c530223a 100644 --- a/tools/hidl/hidlcomp.h +++ b/tools/hidl/hidlcomp.h @@ -1232,7 +1232,7 @@ class EspServInfo void write_client_interface(); void write_factory_impl(); - void write_esp_binding(); + void write_esp_binding(const char *); void write_esp_binding_ipp(); void write_esp_service_ipp(); void write_esp_binding_ng_ipp(EspMessageInfo *);