simple code fails please help

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

simple code fails please help

Patrick-4
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
Reply | Threaded
Open this post in threaded view
|

Re: simple code fails please help

David E. Jones-2

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

Reply | Threaded
Open this post in threaded view
|

Re: simple code fails please help

Patrick-4
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 <[hidden email]> 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
>
>
Reply | Threaded
Open this post in threaded view
|

Re: simple code fails please help

Patrick-4
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 <[hidden email]> 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 <[hidden email]> 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
>>
>>
>