Skip to content

Conversation

@jeclrsg
Copy link
Contributor

@jeclrsg jeclrsg commented Jan 6, 2022

Checklist:

  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit message includes a "fixes" reference if appropriate.
    • The commit is signed.
  • [] The change has been fully tested:
    • I have viewed all related gallery items
    • I have viewed all related dermatology items
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised new issues to address them separately

Testing:

@GordonSmith
Copy link
Member

GordonSmith commented Jan 12, 2022

A potential (and correct) output for "WUQueryActivationMode" could be:

export enum WUQueryActivationMode {
    Do_not_activate_query = 0,
    Activate_query = 1,
    Activate_query__suspend_previous = 2,
    Activate_query__delete_previous = 3
}

Note: WsDFU has a few more of these...

@GordonSmith
Copy link
Member

GordonSmith commented Jan 12, 2022

Next you could generate the calling stub for each operation:

<operation name="WUAction">
<soap:operation soapAction="WsWorkunits/WUAction?ver_=1.85" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="excfault">
<soap:fault name="excfault" use="literal"/>
</fault>
</operation>

You will need to use the associated SoapIn and SoapOut messages:

<message name="WUActionSoapIn">
<part name="parameters" element="tns:WUAction"/>
</message>
<message name="WUActionSoapOut">
<part name="parameters" element="tns:WUActionResponse"/>
</message>

@GordonSmith
Copy link
Member

FYI - I tidied up the util folder a bit in this draft PR: jeclrsg#1

const primitiveType = operation[prop].replace(/xsd:/gi, "");
if (prop.indexOf("[]") > 0) {
typeDefn[prop.slice(0, -2)] = primitiveType + "[]";
} else if (operation[prop].match(/.*\|.*\|.*/)) {
Copy link
Member

Choose a reason for hiding this comment

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

I have no idea what this looks like, but does this catch enums with only 2 options (TRUE|FALSE)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment to this. Looking at it again, realized that regex wasn't matching value(s) of an enum, but the string that node soap generates to represent an enum, which is always EnumName|type|values

@jeclrsg jeclrsg force-pushed the Wsdl_To_TS branch 3 times, most recently from edc50fc to 212a285 Compare February 10, 2022 21:34
@jeclrsg
Copy link
Contributor Author

jeclrsg commented Feb 10, 2022

I noticed there was a small issue where the members of the generated TS interfaces were being delimited by commas instead of semi-colons. That seems to be technically valid, but I thought I would go ahead and have them be replaced with semi-colons for consistency (https://typescript-eslint.io/rules/member-delimiter-style). I also squashed & rebased to trunk, so hopefully I didn't miss anything when merging the conflicts in package.json.

@jeclrsg jeclrsg marked this pull request as ready for review February 17, 2022 20:25
@jeclrsg jeclrsg requested a review from GordonSmith February 17, 2022 20:26
@jeclrsg
Copy link
Contributor Author

jeclrsg commented Feb 17, 2022

I think I covered the most recent requests for changes - the path where the .ts files are written is now of the format .../ServiceName/v#/ServiceName.ts, and the body of each operation is calling the connection wrapper around the service call.

I changed the usage comments slightly as well, noting that you can alternatively pass a local path to a WSDL file as well as a URL. Rodrigo was nice enough to provide me with a copy of the ws_logaccess WSDL yesterday afternoon.

@GordonSmith
Copy link
Member

The request interface need to optional either by:

WUQuery(request: Partial<WsWorkunits.WUQuery>): Promise<WsWorkunits.WUQueryResponse> {
	return this._connection.send("WUQuery", request);
}

or

export interface WUQuery {
    Wuid?: string;
    Type?: string;
    Cluster?: string;
    RoxieCluster?: string;
    Owner?: string;
    State?: string;
    StartDate?: string;
    EndDate?: string;
    ECL?: string;
    Jobname?: string;
    LogicalFile?: string;
    LogicalFileSearchType?: string;
...
}

I suspect the later is needed for nested structures

Copy link
Member

@GordonSmith GordonSmith left a comment

Choose a reason for hiding this comment

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

See comment re optional fields in the reqeusts

Signed-off-by: Jeremy Clements <jeremy.clements@lexisnexisrisk.com>
@GordonSmith GordonSmith merged commit d5a37af into hpcc-systems:trunk Feb 23, 2022
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.

2 participants