掲示板

question about service builder

3年前 に Scarletake Bwi によって更新されました。

question about service builder

Expert 投稿: 326 参加年月日: 10/12/20 最新の投稿
i have two questions

1. sometimes, i want create web service, but i do not need create table of database, or, the data i need are from many exist tables. how can i do? create an service builder and an empty table?
2. sometimes, i provide web service (with service builder) for some client. but i also have to use some ext-data be provided by other publish service. how can i do both in same project? (got information via outside service and also provide service)

any suggestion?
thank you
thumbnail
8年前 に Bijan Vakili によって更新されました。

RE: question about service builder

Expert 投稿: 375 参加年月日: 09/03/10 最新の投稿
The answer to the first question's below. I'm not sure about the second question; may want to create a new thread, explain.

<!--?xml version="1.0" encoding="UTF-8"?-->

<service-builder package-path="com.bvakili.service">
	<author>Bijan Vakili</author>
	<namespace>yournamespace</namespace>

	<entity name="MyCustom" local-service="false" remote-service="true">

	</entity>
</service-builder>
3年前 に Scarletake Bwi によって更新されました。

RE: question about service builder

Expert 投稿: 326 参加年月日: 10/12/20 最新の投稿
Bijan Vakili:
The answer to the first question's below. I'm not sure about the second question; may want to create a new thread, explain.

<!--?xml version="1.0" encoding="UTF-8"?-->

<service-builder package-path="com.bvakili.service">
	<author>Bijan Vakili</author>
	<namespace>yournamespace</namespace>

	<entity name="MyCustom local-service=" false" remote-service="true">

	</entity>
</service-builder>


thank you, Mr. Bijan

i also find some info: Fake Service Entity
i have a extend question. empty entity won't create table, it's good, but how if i have to return an object? i mean, if i only return an string, integer or boolean... it's okay, but if i have to return an customize object, can any way to do it?

again, thank you
thumbnail
8年前 に Bijan Vakili によって更新されました。

RE: question about service builder

Expert 投稿: 375 参加年月日: 09/03/10 最新の投稿
I'm not sure what you mean; may you explain?

how if i have to return an object? i mean, if i only return an string, integer or boolean... it's okay, but if i have to return an customize object, can any way to do it?

Are you talking about in service class?
Well, one point of empty entity is: make as many custom objects you want; you can then reference custom objects; see Service Builder DTD comment:
<!--
The reference element allows you to inject services from another service.xml
within the same class loader. For example, if you inject the Resource entity,
then you'll be able to reference the Resource services from your service
implementation via the methods getResourceLocalService and getResourceService.
You'll also be able to reference the Resource services via the variables
resourceLocalService and resourceService.
-->
<!--ELEMENT reference (#PCDATA)-->

<!--
See the comments in reference element.
-->
<!--ATTLIST reference
	package-path CDATA #IMPLIED
	entity CDATA #IMPLIED
-->

https://github.com/liferay/liferay-portal/blob/6.2.x/definitions/liferay-service-builder_6_2_0.dtd#L445
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: question about service builder

Liferay Legend 投稿: 14918 参加年月日: 06/09/02 最新の投稿
Scarletake Bwi:
i also find some info: Fake Service Entity


Hey, that's my blog entry emoticon

Fake entities are awesome!

i have a extend question. empty entity won't create table, it's good, but how if i have to return an object? i mean, if i only return an string, integer or boolean... it's okay, but if i have to return an customize object, can any way to do it?


Fake entities. You can define them as a normal entity, is not backed by anything in the database, and you can return whatever you want.

I've been using this approach to build flattened objects to return to the browser via the built-in axis support. You can define a flattened object that has all relevant data, sometimes a lot easier than working with a Liferay object graph or multiple calls for child objects.