0
votes

I have a client who is interested in calling a Worklight adapter from separate projects. For example the adapter might live in ProjectA and the app lives in ProjectB. When I attempt to invoke a procedure for an adapter that resides in ProjectA from my client code in ProjectB using Worklight V6, I see the error

FWLSE0020E Ajax request exception, Adapter testAdapter does not exist.

Is there a way to call adapters that reside in a different project than the client code?

I saw the following question which stated that adapters are per-project entities: worklight server configuration - separating adapters and server

1

1 Answers

1
votes

As Idan mentioned at the bottom of the question you linked:

In Worklight 6.0 you are now able to concurrently run multiple Worklight projects (or, .war files) in the same server instance, so while adapters are still per-project entities, you can have them duplicated in separated projects on the same server machine running Worklight Server and have multiple separate projects (applications) use that server to connect to the backend.

The adapters being in different projects isn't as important as them being hosted on different WAR files. The client can only connect to an adapter that lives on the Worklight server that the client has been configured to connect with (to my knowledge, someone correct me if I'm wrong).

If you want two projects to connect to the same WAR file, right click your Worklight project and then click "Change Worklight Target Server". Change the context path to the name of the project you want all of your deployments to go to:

enter image description here

Now all adapters and all clients from both projects will go to the same WAR, and I can call the Worklight adapter from a client that connects to either project.

Note: For the second project, you may have to build each application for a remote server to point to the correct context root. I'm not sure and haven't tried it myself.