Foros de discusión

question about service builder

Scarletake Bwi, modificado hace 3 años.

question about service builder

Expert Mensajes: 326 Fecha de incorporación: 20/12/10 Mensajes recientes
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
Bijan Vakili, modificado hace 8 años.

RE: question about service builder

Expert Mensajes: 375 Fecha de incorporación: 10/03/09 Mensajes recientes
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>
Scarletake Bwi, modificado hace 3 años.

RE: question about service builder

Expert Mensajes: 326 Fecha de incorporación: 20/12/10 Mensajes recientes
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
Bijan Vakili, modificado hace 8 años.

RE: question about service builder

Expert Mensajes: 375 Fecha de incorporación: 10/03/09 Mensajes recientes
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
David H Nebinger, modificado hace 8 años.

RE: question about service builder

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
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.