0
votes

i'm trying to get a JSON representation of a view with an ajax request from a XPage. First of all, i did it with the following url https://myserver/mydb/myview?readviewentries&outputformat=JSON&count=-1.

It works in browsers but not in IBM Notes Client (my application have to work in the both), i got an error 404, i read on internet that we can't use that syntax in the Notes client. So i tried to use the restService element from XPages to get my JSON.

I create a XPage with the following code :

<xe:restService id="restService1" pathInfo="JoursFeries">
    <xe:this.service>
        <xe:viewJsonService defaultColumns="true"
            databaseName="Applis/JoursFeries.nsf" viewName="JoursFeries">
        </xe:viewJsonService>
    </xe:this.service>
</xe:restService>

I changed my URL to call my Rest service like that : myXpage.xsp/JoursFeries (My new XPage is on the same database as the calling XPage). One more time, it works on browsers but still not in IBM Notes client. I called it like that :

var feries = {
    url : "xRestJoursFeries.xsp/JoursFeries",
    handleAs : "json",
    sync : true,
    preventCache : this.urlPreventCache,
    load : function(json) {
        // My callback function
    }
}

dojo.xhrGet(feries);

When I activate my XPage debugger in Notes client, I just can see that the page returns an error 500, my console just said that :

WARNING CLFAD####W: State data not available for /xRestJoursFeries because no control tree was found in the cache. ::class.methot=com.ibm.xsp.application.ViewHandlerExImpl_restoreView() ::thread=Thread-348 ::loggername=anonymous

I tried many parameters on my XPages which provides the REST service, but without success.

Thank you in advance.

1
What version of the Notes client are you using?Patrick Sawyer
I'm using the version 9 on both, client and serverDorian

1 Answers

2
votes

The URL's in xPINC are different. You will need to change the URL's. Check this page for some info. http://xomino.com/2013/02/03/xpinc-browser-url-format-and-why-my-demo-failed-at-ibmconnect-part-2/

You could utilize @ClientType() in an if statement to choose onee URL over another.

You could also run xpages on the server and the app would work in both.