Parameters passing problem to service

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

Parameters passing problem to service

suvendukmishra@yahoo.com
Hi:

We are using apache-ofbiz-12.04.05 against sql server 2012. To do a customization, We need to create a record in CustRequestAttribute entity. In order to achieve this, inside specialpurpose\projectmgr\script\org\ofbiz\project\ProjectSimpleEvents.xml's CreateCustRequestAndAssignTaskToPerson method, I am trying to call createCustRequestAttribute service using the following way:

<set field="custAttribute.custRequestId" from-field="custRequestId"/>
<set field="custAttribute.attrName" from-field="TM"/>               
<set field="custAttribute.attrValue" value="${parameters.teamMemberId}"/>
                        Error       
               
               
                               
<call-service service-name="createCustRequestAttribute" in-map-name="custAttribute"/>       
 


Please Note:
custRequestId and  ${parameters.teamMemberId} are holding valid value. You can see their values in the attached image


The problem is that, somehow attrName is not being passed which causing service validation exception being thrown.

As you can see in the image file, the other two parameters  - custRequestId and attrValue have been passed but due to missing of attrName, error is being thrown.

Please help, as I stuck in this problem since couple of days.

Thanks in advance.

Regards,
Suvi.

Reply | Threaded
Open this post in threaded view
|

Re: Parameters passing problem to service

ayyoob
Hi Suvi,

As I see you are setting the "attrName" field from the "TM" field, so you should make sure that The "TM" field is holding the required value.  
you can log its value using the <log/> tag like this: <log level="warning" message="TM value is: ${TM}"/>

to see your logged value go to "<ofbizUrl:port>/webtools/control/LogView" and search for your log (search for sth like: "TM value is:").


On Fri, Sep 4, 2015 at 2:06 PM, [hidden email] [via OFBiz] <[hidden email]> wrote:
Hi:

We are using apache-ofbiz-12.04.05 against sql server 2012. To do a customization, We need to create a record in CustRequestAttribute entity. In order to achieve this, inside specialpurpose\projectmgr\script\org\ofbiz\project\ProjectSimpleEvents.xml's CreateCustRequestAndAssignTaskToPerson method, I am trying to call createCustRequestAttribute service using the following way:

<set field="custAttribute.custRequestId" from-field="custRequestId"/>
<set field="custAttribute.attrName" from-field="TM"/>               
<set field="custAttribute.attrValue" value="${parameters.teamMemberId}"/>
                        Error       
               
               
                               
<call-service service-name="createCustRequestAttribute" in-map-name="custAttribute"/>       
 


Please Note:
custRequestId and  ${parameters.teamMemberId} are holding valid value. You can see their values in the attached image


The problem is that, somehow attrName is not being passed which causing service validation exception being thrown.

As you can see in the image file, the other two parameters  - custRequestId and attrValue have been passed but due to missing of attrName, error is being thrown.

Please help, as I stuck in this problem since couple of days.

Thanks in advance.

Regards,
Suvi.




If you reply to this email, your message will be added to the discussion below:
http://ofbiz.135035.n4.nabble.com/Parameters-passing-problem-to-service-tp4671861.html
To start a new topic under OFBiz - Dev, email [hidden email]
To unsubscribe from OFBiz - Dev, click here.
NAML



--
.
.
.
Ayyoob Imani
BSC student of Computer Engineering
Iran University Of Scince & Technology (IUST)
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Parameters passing problem to service

suvendukmishra@yahoo.com
Thanks a lot Ayyoob for your help !!!

I changed the code to following and now it worked:
<set field="DEFMAN" value="DEFMAN"/>
<set field="custAttribute.attrName" from-field="DEFMAN"/>     


My requirement was to pass that as hard coded string, hence earlier I direct assigned that to map.

I tried to replicate from one of the existing codes (ProjectSimpleEvents.xml --> CreateCustRequestAndAssignTaskToPerson):

<set field="assignParty.workEffortId" from-field="workEffortId"/>
<set field="assignParty.partyId" from-field="parameters.partyId"/>
<set field="assignParty.roleTypeId" from-field="parameters.roleTypeId"/>
<set field="assignParty.statusId" value="PAS_ASSIGNED"/>
<call-service service-name="assignPartyToWorkEffort" in-map-name="assignParty"/>

As you can see here, "PAS_ASSIGNED" is passed directly (not through any variable, I checked already).

So, how it is differentiating the value, like which one is variable and which one is plain string?

Regards,
Suvi.

     
Reply | Threaded
Open this post in threaded view
|

Re: Parameters passing problem to service

ayyoob
Hi suvi,
the "<set>" tag can be used in different ways according to its attributes:
<set field="custAttribute.attrName"  from-field="DEFMAN" >: this will set the value from field named "DEFMAN" witch is a variable.
<set field="custAttribute.attrName" value="DEFMAN">: this will set the the value as "DEFMAN" witch is a string constant.

you can consider these two equivalent to this java snippet:
the first one is like: 
String DEFMAN = "DEFMAN";
custAttribute.set("attrName", DEFMAN);

the second one is like:
custAttribute.set("attrName", "DEFMAN");

I suggest you to take a look at the "minilang - simple-method - Reference" at: https://cwiki.apache.org/confluence/display/OFBADMIN/Mini+Language+-+minilang+-+simple-method+-+Reference

regards,
ayyoob.
 

--
.
.
.
Ayyoob Imani
BSC student of Computer Engineering
Iran University Of Scince & Technology (IUST)
[hidden email]