Changing metadata of an image object using DocumentObj 2.5 SetMetaData

I'm wring a PowerShell script to change objects metadata at once. My script woks properly for topic objects. However, it does not work for image objects. I wrote the following code to change metadata using DocumentObj 2.5.

function DocumentObj-SetMetaData()
{
  $functionName = "DocumentObj-SetMetaData"
  $documentObjUrl = $infosharewsurl + "DocumentObj25.asmx?WSDL"
  $documentObjWebService = new-webServiceProxy -uri $documentObjUrl -UseDefaultCredential
  try
  {
    $psXMLMetadata = "<ishfields>"
    $psXMLMetadata += "<ishfield name='FTITLE' level='logical'>" + $ftitle + "</ishfield>"
    $psXMLMetadata += "<ishfield name='FKUBOTAMODELCLASSIFICATION' level='version'>" + $classification + "</ishfield>"
    $psXMLMetadata += "<ishfield name='FKUBOTAMODELSERIES' level='version'>" + $modelseries + "</ishfield>"
    $psXMLMetadata += "<ishfield name='FKUBOTAMODEL' level='version'>" + $model + "</ishfield>"
    $psXMLMetadata += "<ishfield name='FKUBOTAREGION' level='version'>" + $region + "</ishfield>"
    $psXMLMetadata += "<ishfield name='FKUBOTACOUNTRY' level='version'>" + $country + "</ishfield>"
    $psXMLMetadata += "<ishfield name='FKUBOTAKEYWORD' level='version'>" + $keywords + "</ishfield>"
    $psXMLMetadata += "</ishfields>"
  
    $psXMLRequiredCurrentMetadata = "<ishfields/>"
  
    # Write-Host($psXMLMetadata)
    Write-Host($id)
    $result = $documentObjWebService.SetMetaData([REF]$context, $id, [REF]$version, $language, $resolution, $psXMLMetadata, $psXMLRequiredCurrentMetadata)
  }
  catch [System.Web.Services.Protocols.SOAPException]
  {
    ("error at " + $functionName)
      Return-Result $Error[0].Exception.InnerException.Message
  }

  $result #returning the function value by simply outputting it
}
When this function is called, following ishfields are given via $psXMLMetadata variable.
<ishfields>
  <ishfield name='FTITLE' level='logical'>OM-GUIDE-0001</ishfield>
  <ishfield name='FKUBOTAMODELCLASSIFICATION' level='version'></ishfield>
  <ishfield name='FKUBOTAMODELSERIES' level='version'></ishfield>
  <ishfield name='FKUBOTAMODEL' level='version'></ishfield>
  <ishfield name='FKUBOTAREGION' level='version'></ishfield>
  <ishfield name='FKUBOTACOUNTRY' level='version'></ishfield>
  <ishfield name='FKUBOTAKEYWORD' level='version'>guide</ishfield>
  <ishfield name='FRESOLUTION' level='lng'>Thumbnail</ishfield>
</ishfields>
An exception occurs when the $documentObjWebService.SetMetaData is executed and it returns '-102003' as the error code. I looked into the error code explanation in the following page. But I cannot figure out the reason of the error.
Please give me advises to resolve this issue.
Kind regards,
Naoki
Parents Reply
  • Hi Dave,

    This PowerShell code was given by a SDL support engineer and had been working well for map/topic objects. This is reason why I'm using the deprecated ASMX-SOAP API functions. Regarding ISHRemote, there isn't enough information and I didn't realize it works as the alternative of the ASMX-SOAP API functions.

    We are using TD14 SP1 so that ISHRemote works on it. I'll try ISHRemote by referring your suggested code.

    Thank you for good suggestion.

    Kind regards,

    Naoki

Children
No Data