Foren

Web content display with data from external system

Rupesh Chotai, geändert vor 11 Jahren.

Web content display with data from external system

Regular Member Beiträge: 163 Beitrittsdatum: 23.03.11 Neueste Beiträge
Hi,
I have requirement to get data in my web content display from external system.
External system is exposing REST service and giving data in Json format. How can this be achieved in web content display?

Thanks in advance for replies.

Rupesh
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: Web content display with data from external system

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Did you read James blog?

http://www.liferay.com/ja/web/james.falkner/blog/-/blogs/yet-another-liferay-json-service-example
Rupesh Chotai, geändert vor 11 Jahren.

RE: Web content display with data from external system

Regular Member Beiträge: 163 Beitrittsdatum: 23.03.11 Neueste Beiträge
Hi Hitoshi,
I read the blog and also updated code for 6.1 for example 3. However I couldn't figure out
1. where this implementation goes
2. how my web content will access data of json service
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: Web content display with data from external system

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Instead of asking me that, why not ask James who wrote the blog directly. He's the community manager here and should be reading most of the posts. emoticon
thumbnail
James Falkner, geändert vor 11 Jahren.

RE: Web content display with data from external system

Liferay Legend Beiträge: 1399 Beitrittsdatum: 17.09.10 Neueste Beiträge
Rupesh Chotai:
Hi Hitoshi,
I read the blog and also updated code for 6.1 for example 3. However I couldn't figure out
1. where this implementation goes
2. how my web content will access data of json service


The blog post that Hitoshi refers to shows you how to retrieve web content articles from Liferay's WCMS using Liferay's JSON Web Services. Your use case is completely different, if I understand correctly.

You want to retrieve web content from some other system (not Liferay), in some JSON format, and render it as HTML within a Liferay page? Liferay can of course do this, but it doesn't really require the use of its WCMS. You just need some javascript to get the JSON and massage it into the desired HTML. You could do this with Liferay's WCM system but it would be like using IBM's "Watson" to compute the square root of 4 emoticon

Can you show us an example JSON object that you might retrieve from this system? Then we can show you how to show that in Liferay.
Rupesh Chotai, geändert vor 11 Jahren.

RE: Web content display with data from external system

Regular Member Beiträge: 163 Beitrittsdatum: 23.03.11 Neueste Beiträge
Hi James,
You understood correct that I want to display Json data from external system into web content display.
I know using simple java script could do this, however, i want to give user CMS features of web content. So want to retrieve data in web content.

The JSON data look like

{
    "NewsBulletin": {
        "newsBulletinBeanList": [
            {
                "newsId": "203",
                "newsTitle": "Test Title 1",
                "newsDescription": "test 1",
            },
            {
                "newsId": "202",
                "newsTitle": "Test Title 2",
                "newsDescription": "test 2",
            }
        ],
        "flag": 1
    }
}


Can you please share how can I achieve this?
Thanks for your reply.
thumbnail
James Falkner, geändert vor 11 Jahren.

RE: Web content display with data from external system

Liferay Legend Beiträge: 1399 Beitrittsdatum: 17.09.10 Neueste Beiträge
Rupesh Chotai:
Hi James,
You understood correct that I want to display Json data from external system into web content display.
I know using simple java script could do this, however, i want to give user CMS features of web content. So want to retrieve data in web content.

The JSON data look like

{
    "NewsBulletin": {
        "newsBulletinBeanList": [
            {
                "newsId": "203",
                "newsTitle": "Test Title 1",
                "newsDescription": "test 1",
            },
            {
                "newsId": "202",
                "newsTitle": "Test Title 2",
                "newsDescription": "test 2",
            }
        ],
        "flag": 1
    }
}


Can you please share how can I achieve this?
Thanks for your reply.


So you want to take those JSON objects and create real Web Content Articles in Liferay, for later display using the "Web Content Display" or "Asset Publisher" portlets? Or do you want to retrieve the JSON dynamically and immediately render it as HTML (but not create actual Web Content Articles within Liferay)?

If you want to create actual Web Content Articles, then you could execute a java application outside of Liferay, which reads the JSON, then creates articles inside of Liferay, then you'd need to add the Web Content Display or Asset Publisher portlets to a page to render them (and you'd also have to write a Web Content Structure and Template to associate them within the articles).

BTW, what's the 'flag' for?
Rupesh Chotai, geändert vor 11 Jahren.

RE: Web content display with data from external system

Regular Member Beiträge: 163 Beitrittsdatum: 23.03.11 Neueste Beiträge
Hi James,
Thanks for quick reply.

I want to display that json data in web content display. So, lets take an example - I will be creating a web content display on a page. It has some table which should be populated with data from external system - which is essentially json string.

As I can understand from our reply --
If you want to create actual Web Content Articles, then you could execute a java application outside of Liferay, which reads the JSON, then creates articles inside of Liferay, then you'd need to add the Web Content Display or Asset Publisher portlets to a page to render them (and you'd also have to write a Web Content Structure and Template to associate them within the articles).

that I have to create web content display with json data from outside the liferay. Can you please elaborate more on this?

BTW, that flag is just for one of the business need.
Gwowen Fu, geändert vor 11 Jahren.

RE: Web content display with data from external system

Expert Beiträge: 315 Beitrittsdatum: 27.12.10 Neueste Beiträge
Rupesh Chotai:
Hi,
I have requirement to get data in my web content display from external system.
External system is exposing REST service and giving data in Json format. How can this be achieved in web content display?

Thanks in advance for replies.

Rupesh


In your web content page, you can add Javascript to call the REST service and use Javascript to access the returned Json object and then update the content.
Rupesh Chotai, geändert vor 11 Jahren.

RE: Web content display with data from external system

Regular Member Beiträge: 163 Beitrittsdatum: 23.03.11 Neueste Beiträge
Hi Gwowen,
Yes, I can do that. However, I want to give user CMS capability for this component so want to leverage those from web content display.