2

I'm implementing Liferay 7 Service Builder which should not create database table and will call RESTful web services API. The web services to be invoked are custom and outside the Liferay; they have nothing to do with Liferay at all. The web services provide JSON format data to Service Builder. The Service Builder shall map it to its generated POJO class, and by using Jackson library would convert it back to JSON string. The portlet which would call the Service Builder (XxxServiceImpl) converts the JSON string to POJO object and render it on JSP.

I've search the world wide web to no avail. I hope anybody can help me.

Thank you.

Julez
  • 1,010
  • 22
  • 44

1 Answers1

2

By creating an empty entity, you'll get the services generated for you, though with no model classes - they'd be up to you to create yourself:

<service-builder package-path="com.example.foo">
    <namespace>FOO</namespace>
    <entity name="Foo" local-service="true" remote-service="true">
    </entity>
</service-builder>

This will generate FooService, FooLocalService and the matching implementation classes, but no FooModel etc. - as this is something that you'd persist yourself anyways, you can (and should) build the model classes on your own. Liferay's ServiceBuilder would help you with the database persistence, but not with any other persistence.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • Thanks for quick response. I will try it and will let you know if it will work. Thank you. – Julez Mar 22 '17 at 04:22
  • By creating empty entity, it's getting error as it's looking for primary key for the entity. I put it back and build was successful, however, it generated model classes (API and service). – Julez Mar 22 '17 at 05:50
  • Did you leave the uuid in? You don't need a uuid if there is nothing to identify – Olaf Kock Mar 22 '17 at 06:15
  • My bad! I left it in. After removing it, it worked like a charm and exactly as you described above. I will now accept your answer. Thank you so much. – Julez Mar 22 '17 at 06:53