Clarity Service Management

Expand all | Collapse all

CA service Desk: problem using removeLrelRelationships

Jump to Best Answer
  • 1.  CA service Desk: problem using removeLrelRelationships

    Posted 03-07-2016 09:50 AM

    Hi team,

     

    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">

       <soapenv:Header/>

       <soapenv:Body>

          <ser:removeLrelRelationships>

             <sid>1984841277</sid>

             <contextObject>cnt:3D00F38B55685744BF02A15A28FE9CE3</contextObject>

             <lrelName>roles</lrelName>

             <removeObjectHandles>

                <string>400002</string>

             </removeObjectHandles>

          </ser:removeLrelRelationships>

       </soapenv:Body>

    </soapenv:Envelope>

     

    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">

       <soapenv:Body>

          <soapenv:Fault>

             <faultcode>soapenv:Client</faultcode>

             <faultstring>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type!  Offending handle: 400002</faultstring>

             <faultactor/>

             <detail>

                <ErrorMessage>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type!  Offending handle: 400002</ErrorMessage>

                <ErrorCode>1000</ErrorCode>

             </detail>

          </soapenv:Fault>

       </soapenv:Body>

    </soapenv:Envelope>

     

    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.



  • 2.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-07-2016 11:15 AM

    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

    /J



  • 3.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-07-2016 11:30 AM

    Hi jmayer,

     

    Thanks so much for your response. I did already tried with role:400002, but it gave me the same 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">

      <soapenv:Body>

          <soapenv:Fault>

            <faultcode>soapenv:Client</faultcode>

            <faultstring>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type!  Offending handle: role:400002</faultstring>

            <faultactor/>

            <detail>

                <ErrorMessage>Bad handle passed to update_handle for lrel 'roles' - it's of the wrong type!  Offending handle: role:400002</ErrorMessage>

                <ErrorCode>1000</ErrorCode>

            </detail>

          </soapenv:Fault>

      </soapenv:Body>

    </soapenv:Envelope>



  • 4.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-07-2016 02:08 PM

    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.

    /j



  • 5.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-07-2016 04:13 PM

    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>    



  • 6.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-07-2016 04:16 PM

    yep good catch Gutis

    was focusing on the handle and did notice the wrong lrelname

    /J



  • 7.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-08-2016 03:46 PM

    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.



  • 8.  Re: CA service Desk: problem using removeLrelRelationships
    Best Answer

    Posted 03-08-2016 06:36 PM

    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:



  • 9.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-08-2016 06:54 PM

    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

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">

       <soapenv:Header/>

       <soapenv:Body>

          <ser:getLrelValues>

             <sid>1347379007</sid>

             <contextObject>cnt:2205ACC2A7449B43A179DA002501123B</contextObject>

             <lrelName>roles</lrelName>

             <startIndex>0</startIndex>

             <endIndex>3</endIndex>

             <attributes>

                <!--1 or more repetitions:-->

                <string>role_obj</string>

             </attributes>

          </ser:getLrelValues>

       </soapenv:Body>

    </soapenv:Envelope>

     

    you will receive response similar to this:

     

    <UDSObject>

    <Handle>cnt_role:400053</Handle>

    <Attributes>

    <Attribute DataType="2005">

    <AttrName>role_obj</AttrName>

    <AttrValue>10024</AttrValue>

    </Attribute>

    </Attributes>

    </UDSObject>

    <UDSObject>

    <Handle>cnt_role:400052</Handle>

     

    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">

       <soapenv:Header/>

       <soapenv:Body>

          <ser:callServerMethod>

             <sid>1347379007</sid>

             <methodName>delete_wc</methodName>

             <factoryName>api</factoryName>

             <formatList></formatList>

             <parameters>

                <!--1 or more repetitions:-->

                <string>cnt_role</string>

                <string>id = 400053</string>

                <string xsi:nil='true' />

             </parameters>

          </ser:callServerMethod>

       </soapenv:Body>

    </soapenv:Envelope>

     

    Now you can use getLrelValues method to check that relation is removed



  • 10.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-08-2016 07:04 PM

    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



  • 11.  Re: CA service Desk: problem using removeLrelRelationships

    Posted 03-09-2016 07:05 AM

    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.