-1

I'm struggling a bit with the following: I have a symfony web-application which calls a webservice (hosted on another server). The webservice returns a JSON object with calendar data, and in my symfony controller this data is saved in an array. For the visualisation of the calendar towards the users I use https://fullcalendar.io/, which needs to be "feeded" the data from the webservice. This works fine when the browser of the users connects directly towards the webservice to "read" the JSON stream with pretty standard Javascript, but the aim is that there will be no direct connections to the werbservice, only to the symfony webserver.

So I want the connection to go as followed:

User-browser -> Symfony webserver ->(JSON) -> Webservices -> SQL server 

But currently the User-browser has also still "one leg to the webservices" to consult the JSON feed with calendar items.

I think I'm missing something which is in plain sight, but how can I avoid that the user calls directly the Webservice?

  • I could make a (similar) webservice that gives a JSON feed on the symfony apllication (and so actually make my webserver act in a certain way as a proxy for the webservice server).
  • I could try to work with a global variable (https://fullcalendar.io/docs/events-array) that contains the array with the calendar items (could become messy when multiple users work simultaneously on it).

But these don't seem correct approaches to me...

Am I missing something obvious?

BertDB
  • 41
  • 7
  • Can you show the code to load the data in your symfony app? instead of deserializing it to an array and serialize it again to json you can just load as text and return the text (json) without de-serialisation, just like a proxy – john Smith May 23 '22 at 16:55
  • Hi, thank you for your reply, I just discovered a symfony documentation that actually to a large extend answers my question : https://symfony.com/doc/current/frontend/encore/server-data.html – BertDB May 24 '22 at 07:11
  • `I could make a (similar) webservice that gives a JSON feed on the symfony apllication (and so actually make my webserver act in a certain way as a proxy for the webservice server`...that's the standard approach to this kind of thing. Although it's unclear why you want to avoid the browser talking to the webservice...in what way is that causing you a problem? – ADyson May 25 '22 at 07:55
  • Hi, that's because the webserver is in the DMZ and the webservice is in the "inner network", so not directly reachable for users... – BertDB May 30 '22 at 05:30

1 Answers1

-1

The symfony documentation link is, in my mind, the best answer to be given to this question -> symfony.com/doc/current/frontend/encore/server-data.html

BertDB
  • 41
  • 7
  • 2
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Gary Houbre May 30 '22 at 07:13