+ Start a Discussion
pooja biswaspooja biswas 

display data from webservice inside visualforce page

I am getting data from an external webservice purely in json format, data is more than 1 lakh records.
My requirement not to store this data into an sobject but just display it in an visualforce page.

I do not need entire code but conceptually how this can be handled in the most efficient manner , I mean without hitting viewstate error.
I know about transient keyword , static to avoid viewstate
somebody told me about javascript remoting but I dont know how to go about it.

a) How to call external webservice in apex controller?

b) can we call the same webservice in visualforce page, if so what is the advantage

c) How to structure the vf page so has to handle pagination and also call remoting?

Please elaborate

Pooja B

NagendraNagendra (Salesforce Developers) 
Hi Pooja,

I believe you just want them to be shown on VF page.

So you can use javascript remoting. JS remoting will call your web service. You will get the JSON response.
On your VF page, parse the JSON response and display these in form of tables using Javascript. JS remoting doesn't consume ViewState. And once you get data in JSON onto browser you can create own tables and display in the format you want.

Also if it is for Viewing purpose, its advised to not insert those records into your database.

Note: You cannot insert more than 10000 records in a transaction.

Please check with below links on javascript remoting with web services. Regards,