<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)">Hi guys, I developed a Rest Connector and it's working fine for almost all operations. I can create, update, query and delete accounts on the resource but there is an issue when I try to create account if it already exists on the resource. The connector raises an AlreadyExistsException on the create method as described <a href="https://wiki.evolveum.com/display/midPoint/Connector+Development+Guide">here</a>. The midpoint log shows that the framework detects the exception and searches the object with the matching attributes and finally it is found. For some reason after searching the object on the resource and converting it to a midpoint object, the shadow is not being created and the operations ends with a message "Probably invalid projection context: both old and new objects are null". The object is retrieved with all attributes (__UID__, __NAME__ and so on):</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)">
<span></span>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">2018-07-06 17:31:00,845 [] [pool-4-thread-10] TRACE (com.evolveum.midpoint.provisioning.impl.ResourceObjectConverter): Searching resource objects done: SUCCESS</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">2018-07-06 17:31:00,846 [] [pool-4-thread-10] DEBUG (com.evolveum.midpoint.provisioning.consistency.impl.ObjectAlreadyExistHandler): Processing "already exists" error for shadow:</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>shadow: (null, ShadowType)</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>intent: default</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>kind: ACCOUNT</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>objectClass: {...resource/instance-3}AccountObjectClass</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>resourceRef: oid=702ecc89-deba-4542-9618-5b9c8ba94abe(ResourceType)*</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>attributes:<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>email: <a href="mailto:aortis@identicum.com">aortis@identicum.com</a></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>name: aortis</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>lastName: Ortis</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>firstName: Agustin</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>iteration: 0</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>iterationToken:<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>metadata:<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>requestTimestamp: 2018-07-06T17:30:59.854-03:00</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>requestorRef: oid=00000000-0000-0000-0000-000000000002(UserType)('administrator')[default]</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>createChannel: <a href="http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user">http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user</a></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>createTimestamp: 2018-07-06T17:31:00.753-03:00</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>creatorRef: oid=00000000-0000-0000-0000-000000000002(UserType)('administrator')[default]</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>result: RT(com.evolveum.midpoint.provisioning.api.ProvisioningService.addObject,FATAL_ERROR,Could not create object on the resource. Object already exists on the resource: org.identityconnectors.framework.common.exceptions.AlreadyExistsException(HTTP error 409<span class="gmail-Apple-converted-space"> </span>: ))</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">Conflicting shadow:</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>null</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,250,244);background-color:rgb(14,16,25)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">2018-07-06 17:31:00,846 [] [pool-4-thread-10] ERROR (com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl): Couldn't add object. Object already exist: Object already exists on the resource: org.identityconnectors.framework.common.exceptions.AlreadyExistsException(HTTP error 409<span class="gmail-Apple-converted-space"> </span>: )</span></p>
</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)">The HTTP Error 409 (CONFLICT) is returned by the connected resource when it tries to create a user that already exists. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)">Here is the full operation log with provisioning logger on TRACE level:</div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif" size="2"><a href="https://pastebin.com/G9ZpZYPe">https://pastebin.com/G9ZpZYPe</a></font><br></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif" size="2"><br></font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif" size="2">By the way, if I import resource accounts (from the Resource / Accounts table) they are imported without any errors.</font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif" size="2"><br></font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif" size="2">Any Ideas ?</font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif" size="2"><br></font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif" size="2">Thanks in advance,</font></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif"><br><font color="#444444">Ing Nicolás Rossi</font><br><font color="#999999">Identicum S.A.</font><br><font color="#999999">Jorge Newbery 3226</font><br><font color="#999999">Tel: +54 (11) 4552-3050</font><br><font color="#999999"><a href="http://www.identicum.com" target="_blank">www.identicum.com</a></font></font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>