Skip to content

Commit

Permalink
HPCC-29381 Improve XSD generation for ESP services
Browse files Browse the repository at this point in the history
Replaced explicit XSD and WSDL generation in genreated code by
using existing library function.

Signed-Off-By: Kenneth Rowland [email protected]
  • Loading branch information
kenrowland committed May 19, 2023
1 parent 8813b7a commit 213ea5a
Show file tree
Hide file tree
Showing 16 changed files with 6,163 additions and 171 deletions.
1 change: 1 addition & 0 deletions esp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
309 changes: 160 additions & 149 deletions esp/bindings/http/platform/httpbinding.cpp

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion esp/bindings/http/platform/httpbinding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 1 addition & 14 deletions esp/esdllib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,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}
)
Expand All @@ -71,8 +59,7 @@ add_dependencies ( esdllib jlib espscm)
target_link_libraries ( esdllib
jlib
xmllib
thorhelper
esphttp
dllserver
)

IF (USE_LIBXSLT)
Expand Down
72 changes: 72 additions & 0 deletions esp/esdlscriptlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
Loading

0 comments on commit 213ea5a

Please sign in to comment.