Expand my Community achievements bar.

Can't deploy a model that includes a service

Avatar

Former Community Member

I'm using flashbuilder 4.5.1 & lcds 3.1 and I'm trying to deploy a model that includes a service something like this:

<service name="Zoo">

    

        <annotation name="ActionScriptGeneration">

            <item name="ServiceType">RemoteObject</item>

        </annotation>

        <function name="scoop" return-type="void">

        

         <parameter name="animal" type="opaque"/>

           

        </function>

    </service>

When I try to deploy it I get this lcds error about expecting an annotation.  I've successfully used this capability in the past, any suggestions or workarounds?

thanks in advance

fmlError.jpg

3 Replies

Avatar

Employee

The FlashBuilder error dialog states that the function element only allows annotation as a child element. Your declaration for service's function arguments is incorrect. Flash Builder should have flagged this as an error in the Errors tab. In any case, the declaration should be (note bold line):

<service name="Zoo">

        <annotation name="ActionScriptGeneration">

            <item name="ServiceType">RemoteObject</item>

        </annotation>

        <function name="scoop" arguments="animal:opaque" return-type="void"/>

</service>

For complete syntax, refer to the LCDS 3.1 modelling guide.

Hope that helps you move forward.

Rohit

Avatar

Level 1

Rohit,

Thank you very much for the explanation. 

By the way, the Flash Builder 4.5  Data Model perspective displays the following when you hover over a <function…> tag and appears to be in error. See text in red below.

Defines the prototype of an externally defined function within a service.

For information about functions, including how to add them in Design mode, see Add service functions. Can

appear

A function element can only appear as an immediate child of a service element. Attributes

Attribute

Req/Opt

Default

Description

name

Required

Specifies the function name.

arguments (deprecated)

Optional  

Note: The arguments attribute is deprecated in LiveCycle Data Services 4.5. For prolonged support an d

augmented functionality, use the parameters attribute.

Specifies the names and types of the function’s arguments. If present, the value specified for arguments

takes the form name:type, where name and type denote argument names and types, respectively.

Names must be valid data model language names, and types must be valid data model language type

expressions

Instead of an arguments attribute, you can use child parameter elements. If you use parameter elements,

you cannot include the arguments attribute.

parameters

Optional  

Specifies the names and types of the function arguments. A missing parameters attribute indicates that the

function takes zero arguments.

If present, the value specified for arguments takes the form name:type[=default], where name , type, and

default denote parameter names and types, and default values respectively. The name and type are required.

The default value is optional.

Separate mutliple parameters with commas.

Default values can be literal values or expressions.

Names must be valid data model language names, and types must be valid data model language type

expressions.

Instead of a parameters attribute, you can use child parameter elements. If you use parameter elements, you

cannot include the parameter attribute.

return-type

Optional  

Specifies the return type of the function.

You must specify the type of data that is returned. However, the attribute is optional because you can use a

child return-type element instead. Child elements

A function element can contain zero or more annotation and parameter elements, and zero or one return-

type elements. Example

The data model in the following example contains a service with two functions, both of which are called

from expressions in properties of an entity. <model xmlns="http://ns.adobe.com/Fiber/1.0">

    <entity name="Applicant" persistent="true">

        <property name="name" type="string"/>

        <property name="ssn" type="string"/>

        <property name="age" type="integer"/>

        <property name="state" type="string"/>

        <property name="score" expr="CreditScore.getCreditScore(ssn)"/>

        <property name="risk" expr="CreditScore.getRisk(state, age, score)"/>

        <id name="id" type="integer"/>

    </entity>

    <service name="CreditScore">

        <function name="getCreditScore" parameters="ssn:string" return-type="integer"/>

        <function name="getRisk" parameters="state:string, age:integer,

             score:integer" return-type="integer"/>

    </service>

</model> <

Maybe you can pass this info along so it gets fixed on the next Data Model plugin release…

Thanks,

Oscar

Avatar

Employee

I should have added that, the support for parameter element within function element was not part of LCDS 3.1 schema and was introduced later on. The error message you see corresponds to the LCDS 4.5 schema.

BTW, your post does not mention if you are using Modeller 3.1 plugin or not. There is a known issue of using Modeller 3.11 plugin in FB 4.5 with LCDS 3.1, which causes something similar to happen (see the following post for location etc.) In either case, it will help clarify things.

Rohit