Martin Perrie
Martin Perrie

Reputation: 410

XPages REST Service and concurrent calls

I am investigating some issues with an old Notes application that uses the XPages REST Service control to provide an API to an external application. The XPage utilises a SSJS script library that contains the functions referenced by the REST service.

For example:-

<xe:restService id="restService4" pathInfo="userRegistration">
        <xe:this.service>
            <xe:customRestService
                contentType="application/json"
                requestContentType="application/json"
                requestVar="userRegistration"
                doPost="#{javascript:RegisterCustomer(userRegistration)}">
            </xe:customRestService>
    </xe:this.service>
</xe:restService>

where "RegisterCustomer" is a function in the SSJS library that does the work. All it's really doing in that function is some validation of the data contained in the body of the POST request, some lookups to get other data and then creating a Notes document that contains the POSTed and looked up data.

This all works fine when individual requests are received. But when multiple requests are received at the same time various errors are occurring (such as "Object has been removed or recycled" when using a NotesView object in the SSJS function).

I was under the impression that each call to the REST service would run in it's own thread, but it feels like they are tripping over each other. I can recreate the issues using Postman to run some performance tests.

Is there anything I should be checking for to ensure that all calls to the REST service are self-contained and not affecting each other?

Upvotes: 0

Views: 96

Answers (0)

Related Questions