Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-31936 WsEcl unable to get sample request or response XML #18728

Merged

Conversation

asselitx
Copy link
Contributor

@asselitx asselitx commented Jun 4, 2024

Adjust EspHttpBinding and CWsEclBinding to use info from the roxie to generate WSDL/XSD and sample request/response XML, rather than attempting to use ESDL files.

This means moving the old implmenetation of "getSchema" from EspHttpBinding into CWsEclBinding, and allowing the WsEcl override to be called when the ESDL-based generation isn't applicable (there is no xmlServiceFileName).

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

Tested through ECLWatch UI on local bare metal deployment. Exercised every interface element that seemed likely to be affected and found that wsdl/xsd generation also needed to be fixed. Though valgrind found a likely out-of-bounds string access error in ws_ecl that has a ticket HPCC-31996.

@asselitx asselitx requested a review from kenrowland June 4, 2024 17:00
Copy link
Contributor

@kenrowland kenrowland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am leaving the testing of returning the required XSDs to you.

Please see comments. Changes are optional.

getServiceSchema(context, request, serviceQName, methodQName,
version, isWsdl, false, schema);
// Allow derived classes such as WsEcl to use custom getSchema() logic when there is no serviceXmlFilename
StringBuffer serviceXmlFilename;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a concern I have. This does a copy of the serviceXmlFile name, and if present, calls the getServiceSchema method. That method does another copy of the service XML filename. Perhaps there could be a way to avoid two copies and add a "hasSerivceXML" type method. I don't think it practical to pass the service XML filename as a parameter.

If you feel this is valid, let's open a Jira to make that change and add this one as a dependency. It can be done afterwards. It would require a change to HIDL probably. I don't mind making the change.

As part of that change, the XML filename could be cached, but I don't think that would gain too much.

@@ -200,6 +203,7 @@ class CWsEclBinding : public CHttpSoapBinding

int getXsdDefinition(IEspContext &context, CHttpRequest *request, StringBuffer &content, WsEclWuInfo &wsinfo);
bool getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequest* req, WsEclWuInfo &wsinfo) ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider renaming this method and moving it to be a protected member, unless there is another component that is calling it.

Copy link

github-actions bot commented Jun 4, 2024

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-31936

Jirabot Action Result:
Workflow Transition: Merge Pending
Updated PR

@kenrowland
Copy link
Contributor

Another possibility is to implement this fix only in getServiceSchema. If the call to get the service xml filename fails, then call getSchema and return. If the subclass for the binding, as will Ws_ECL, has a getSchema method, it is handled as required. If not, an error is thrown by the base class implementation. This gets rid of the two copies.

Thoughts?

@asselitx
Copy link
Contributor Author

asselitx commented Jun 5, 2024

Another possibility is to implement this fix only in getServiceSchema....

That seems like it might be cleaner, and I can't think of drawbacks. I'll make and test those two changes and re-push.

@asselitx asselitx requested a review from kenrowland June 6, 2024 19:50
Copy link
Contributor

@kenrowland kenrowland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question, otherwise looks good.

@@ -140,6 +140,12 @@ class CWsEclBinding : public CHttpSoapBinding
private:
CWsEclService *wsecl;

protected:
bool getSchema(StringBuffer& schema, IEspContext &ctx, CHttpRequest* req, const char *service, const char *method,bool standalone) override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there any specific reason this was moved to being protected from public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function with the final bool parameter wasn't overridden in this class before, but it is/was protected in the base class EspHttpBinding- I think it just looks confusing because I renamed & moved the other one.

The other getSchema function (with the final wuinfo parameter) I moved from public to protected in this class and renamed to getSimpleSchema (on your suggestion- seemed reasonable especially now that it makes sense to refactor it away in favor of the other one).

@asselitx asselitx force-pushed the samplexml-hpcc-31936 branch from f5bf94d to fa7571d Compare June 6, 2024 21:24
@asselitx asselitx changed the base branch from master to candidate-9.6.x June 6, 2024 21:25
@asselitx
Copy link
Contributor Author

asselitx commented Jun 6, 2024

@ghalliday squashed and approved for merge

Copy link

github-actions bot commented Jun 7, 2024

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-31936

Jirabot Action Result:

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Will merge if smoke test passes

Adjust EspHttpBinding and CWsEclBinding to use info from the roxie to generate
WSDL/XSD and sample request/response XML rather than attempting to use ESDL.

This means moving the old implmenetation of several functions from prior to
HPCC-28978 from EspHttpBinding into CWsEclBinding. Specifically:

 - getSchema is overridden in CWsEclBinding, and called when the ESDL-based
   generation isn't applicable (there is no xmlServiceFileName).
 - getWsdlOrXsd is moved into CWsEclBinding, and the onXSD/onWsdl handlers in
   CWsEclBinding call it directly.

Noted that the non-overridden CWsEclBinding member function getSchema was
substantially similar to the overridden version, so renamed it getSimpleSchema
and made it protected. Created ticket HPCC-32016 to refactor that code.

Signed-off-by: Terrence Asselin <[email protected]>
@asselitx asselitx force-pushed the samplexml-hpcc-31936 branch from fa7571d to 17b49b1 Compare June 7, 2024 15:31
@asselitx
Copy link
Contributor Author

asselitx commented Jun 7, 2024

Failed job is vcpkg related- downloading package for Windows build. Re-run didn't fix, so rebased and pushed.

@ghalliday ghalliday merged commit 58aa3e6 into hpcc-systems:candidate-9.6.x Jun 11, 2024
50 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants