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

Load WSDL files from the cache #168

Merged
merged 1 commit into from
Jul 10, 2018

Conversation

jonrober-80
Copy link
Contributor

Description

We discussed with @raymondfeng the idea of being able to load WSDL files from memory into strong-soap (as opposed to from a file system or a url). Reymond suggested making use of the existing loading structure (as used by WSDL.open(...) ), which can be described as:

  1. Read the contents of the file form the file system/url.
  2. Create a WSDL object using the var wsdl = new WSDL(definition....) constructor.
  3. Perform a load() on this object to process the contents of the wsdl, using wsdl.load(....)

There are 2 usecases that this PR is aiming to cover.

  1. Load a single wsdl file from memory.
  2. Load a multipart wsdl (a collection of wsdls and xsd files) from memory.

Usecase 1) could be achieved by the current strong-soap functionality, so to achieve this all this PR does it to add a new test to demonstrate it.

Usecase 2) could technically be achieved by the current strong-soap functionality by reading the files from the file system, creating WSDL objects from them, loading each object into options.WSDL_CACHE, then calling load(). The problem was that the order these objects were loaded in was important and the load would fail if they were done in the wrong order. The implication of this was the in order to be able to dynamically load a multipart wsdl into strong-soap, the user would be required to parse the tree structure then call load() in the correct order (which is one of the jobs that strong-soap was already doing for free).

As a result this PR makes some small updates to the loading processes in order to recognize WSDLs which have been added to the cache, but not had load() called against them. If any of these are found then load() will be called. This is done by the introduction of an isLoaded flag which will get set in the objects load() function.

The files used in the tests are ones already present in this repository, however, in order to keep this test self contained, they have been copied to the directory wsdl/from-memory

Related issues

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style
    guide

@slnode
Copy link

slnode commented Jul 10, 2018

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

Add tests to cover loading a multipart wsdl from memory

Allow the wsdl parser to load files from WSDL_CACHE

Update to comments
@raymondfeng
Copy link
Contributor

@jonrober-80 Thank you for the patch. I'll take a look soon.

@raymondfeng raymondfeng merged commit 7d0a425 into loopbackio:master Jul 10, 2018
@raymondfeng
Copy link
Contributor

Released as strong-soap@1.11.0

@jonrober-80 jonrober-80 mentioned this pull request Jul 31, 2018
2 tasks
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.

None yet

3 participants