You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Patrick <pa...@gmail.com> on 2010/02/01 02:25:41 UTC

simple code fails please help

Basically I am trying to pass a ProductCategory into the service
createProductCategory below

<simple-method method-name="createUserLoginAndCategory"
login-required="false">
<make-value value-field="productCat" entity-name="ProductCategory"/>
<set field="productCat.productCategoryId" value="778"/>
<set field="productCat.categoryName" value="TEST"/>
<call-service service-name="createProductCategory" in-map-name="productCat" />

I would like to create this entity "ProductCategory" and pass it into
the service "createProductCategory"

The error I get is this, java.lang.IllegalArgumentException:
[GenericEntity.set] "userLogin" is not a field of ProductCategory,
must be one of: productCategoryId, productCategoryTypeId,

This doesn't make sense to me, because I know that userLogin is not a
field of ProductCategory, my code doesn't indicate that at all.
Thanks in advance for any assistance. Patrick

Re: simple code fails please help

Posted by Patrick <pa...@gmail.com>.
I figured it out - I'll post just send this for the archives - the way
to create an entity and add it to a contextMap

<make-value value-field="productCat" entity-name="ProductCategory"/>
<set field="productCat.productCategoryTypeId" value="CATALOG_CATEGORY"/>
<set field="productCat.categoryName" value="TEST2"/>
<set-service-fields to-map="contextMap"
service-name="createProductCategory" map="productCat"/>
<call-service service-name="createProductCategory" in-map-name="contextMap"/>





On Mon, Feb 1, 2010 at 7:40 AM, Patrick <pa...@gmail.com> wrote:
> Hi David
> How do I put an entity into a context / contextMap? Thanks Patrick
>
> On Sun, Jan 31, 2010 at 8:17 PM, David E Jones <de...@me.com> wrote:
>>
>> The map passed to a service call is the "context" (incoming parameters) for that service.
>>
>> You're passing an entity value object to the service as the context instead of putting the entity value object IN the context and then passing the context. There are two problems with that:
>>
>> 1. the entity value object will likely have values in it that are not valid for the service
>> 2. the service engine is going to look for values in the value object that are not part of the entity, thus triggering an error meant to help with run-time debugging
>>
>> -David
>>
>>
>> On Jan 31, 2010, at 7:25 PM, Patrick wrote:
>>
>>> Basically I am trying to pass a ProductCategory into the service
>>> createProductCategory below
>>>
>>> <simple-method method-name="createUserLoginAndCategory"
>>> login-required="false">
>>> <make-value value-field="productCat" entity-name="ProductCategory"/>
>>> <set field="productCat.productCategoryId" value="778"/>
>>> <set field="productCat.categoryName" value="TEST"/>
>>> <call-service service-name="createProductCategory" in-map-name="productCat" />
>>>
>>> I would like to create this entity "ProductCategory" and pass it into
>>> the service "createProductCategory"
>>>
>>> The error I get is this, java.lang.IllegalArgumentException:
>>> [GenericEntity.set] "userLogin" is not a field of ProductCategory,
>>> must be one of: productCategoryId, productCategoryTypeId,
>>>
>>> This doesn't make sense to me, because I know that userLogin is not a
>>> field of ProductCategory, my code doesn't indicate that at all.
>>> Thanks in advance for any assistance. Patrick
>>
>>
>

Re: simple code fails please help

Posted by Patrick <pa...@gmail.com>.
Hi David
How do I put an entity into a context / contextMap? Thanks Patrick

On Sun, Jan 31, 2010 at 8:17 PM, David E Jones <de...@me.com> wrote:
>
> The map passed to a service call is the "context" (incoming parameters) for that service.
>
> You're passing an entity value object to the service as the context instead of putting the entity value object IN the context and then passing the context. There are two problems with that:
>
> 1. the entity value object will likely have values in it that are not valid for the service
> 2. the service engine is going to look for values in the value object that are not part of the entity, thus triggering an error meant to help with run-time debugging
>
> -David
>
>
> On Jan 31, 2010, at 7:25 PM, Patrick wrote:
>
>> Basically I am trying to pass a ProductCategory into the service
>> createProductCategory below
>>
>> <simple-method method-name="createUserLoginAndCategory"
>> login-required="false">
>> <make-value value-field="productCat" entity-name="ProductCategory"/>
>> <set field="productCat.productCategoryId" value="778"/>
>> <set field="productCat.categoryName" value="TEST"/>
>> <call-service service-name="createProductCategory" in-map-name="productCat" />
>>
>> I would like to create this entity "ProductCategory" and pass it into
>> the service "createProductCategory"
>>
>> The error I get is this, java.lang.IllegalArgumentException:
>> [GenericEntity.set] "userLogin" is not a field of ProductCategory,
>> must be one of: productCategoryId, productCategoryTypeId,
>>
>> This doesn't make sense to me, because I know that userLogin is not a
>> field of ProductCategory, my code doesn't indicate that at all.
>> Thanks in advance for any assistance. Patrick
>
>

Re: simple code fails please help

Posted by David E Jones <de...@me.com>.
The map passed to a service call is the "context" (incoming parameters) for that service.

You're passing an entity value object to the service as the context instead of putting the entity value object IN the context and then passing the context. There are two problems with that:

1. the entity value object will likely have values in it that are not valid for the service
2. the service engine is going to look for values in the value object that are not part of the entity, thus triggering an error meant to help with run-time debugging

-David


On Jan 31, 2010, at 7:25 PM, Patrick wrote:

> Basically I am trying to pass a ProductCategory into the service
> createProductCategory below
> 
> <simple-method method-name="createUserLoginAndCategory"
> login-required="false">
> <make-value value-field="productCat" entity-name="ProductCategory"/>
> <set field="productCat.productCategoryId" value="778"/>
> <set field="productCat.categoryName" value="TEST"/>
> <call-service service-name="createProductCategory" in-map-name="productCat" />
> 
> I would like to create this entity "ProductCategory" and pass it into
> the service "createProductCategory"
> 
> The error I get is this, java.lang.IllegalArgumentException:
> [GenericEntity.set] "userLogin" is not a field of ProductCategory,
> must be one of: productCategoryId, productCategoryTypeId,
> 
> This doesn't make sense to me, because I know that userLogin is not a
> field of ProductCategory, my code doesn't indicate that at all.
> Thanks in advance for any assistance. Patrick