I'm having problems using the removeLrelRelationships with objects cnt and role. the following soap body is the example I am sending using the Soap UI:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
but I am getting this error:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<faultstring>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type! Offending handle: 400002</faultstring>
<ErrorMessage>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type! Offending handle: 400002</ErrorMessage>
in the cnt_role object, the cnt:3D00F38B55685744BF02A15A28FE9CE3 is linked to the role 400002. I mean I have a row in the table usp_cnt_role with the contact value "0x3D00F38B55685744BF02A15A28FE9CE3" and the the role_obj value "400002".
Please, what is wrong with my soap request?
Thanks a lot in advance.
Shortly from my mind..
as the error mention your have a bad handle.
Most of handle in SOAP refer to persid so I will try to use role:400002.
May not be but give it a quick try and let us know
Hope this help
Thanks so much for your response. I did already tried with role:400002, but it gave me the same error:
<faultstring>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type! Offending handle: role:400002</faultstring>
<ErrorMessage>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type! Offending handle: role:400002</ErrorMessage>
Not in the office to test, but checking closer into the wsdl i can see that this element type is imp:ArrayofString and may explain.
not sure either without test how to address it.
Hi, i thin you specified bad lrel name, and you also need to use persistent_id. <lrelName>cnt_role</lrelName><removeObjectHandles><string>role:400002</string>
yep good catch Gutis
was focusing on the handle and did notice the wrong lrelname
I am trying to verify this in our dev environment and something is still not right. Using getlrellegnth and getlrelvalues with 'roles' as the lrel name I can retrieve the roles from a contact as cnt_role:<role_id>. When I pass this list of roles to removelrelrelationships using 'roles' as the lrel name I get "error updating LREL: Method remove_dob is not supported for cnt_role". If I try to use 'cnt_role' as the lrel name I can't successfully use getlrellength or getlrelvalues. If I try to use 'cnt_role' as the lrel name for removelrelrelationships then I get "Internal err with update_lrel: Error getting attr info for cnt.cnt_role", with either role:<role_id> or cnt_role:<role_id> passed as removeobjecthandles. Of course if use role:<role_id> with 'roles' as the lrel name then I get the error originally reported in this post. Any further help would be appreciated, thanks.
I think you will not be able to use this method for role, since it is not full lrel relationship, role object does not contain BREL to cnt_role. Even getLrelValues methods in case of role bahaves differently than for others lrels e.g. cenv. In case of role it can get attrvalues from cnt_role table instead of role.
Here is example for cenv:
It is good that we know that we can execute any api object method from WS, so you still can delete your role relationship:
1. First you need to get persistent id of your relationship
<!--1 or more repetitions:-->
you will receive response similar to this:
Ok lets try to remove cnt_role:400053 relation, we will be using SOAP METHOD callServerMethod to call delete_wc spel method that is defined on api object. We will need to pass null value to the method so we need to include one more namespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<string>id = 400053</string>
<string xsi:nil='true' />
Now you can use getLrelValues method to check that relation is removed
P.S be very carefull with <string>id = 400053</string> part of the query. Since this is where clause for object deletion, if you will mess something e.g. will write where clause that is always true whole cnt_role table content may be deleted
Thank you all so much!
Yes Gutis... You're absolutely right! I used the same strategy to make it work. I called the delete_wc spel method using the web service method callserverMethod. to remove a cnt_role row, I built the where clause with the contact and role_obj handles, without searching previously for the cnt_role handle.