...
- toujours dans workflow_ao_easy.xml, à l'issu du split d'identifiant 1 (se reporter à la documentation d'OsWorkflow pour de plus amples informations sur ce qu'est et comment fonctionne un split), l'instance de workflow se trouve simultanément dans 2 états : 'publié' (localement, étape 3) et 'en attente d'envoi vers HAL' (étape 6). Ce deuxième état fournit l'action suivante :
Parmi les post-functions invoquées par cette action, celle qui nous intéresse ici est invokeWSOperation. Cette fonction prend 2 arguments :Code Block xml xml title Action d'envoi vers HAL <action id="13" name="aoe-hal_upload"> <restrict-to> <conditions type="AND"> <condition type="spring"> <arg name="bean.name">hasRole</arg> <arg name="mask">AOE_OWNER</arg> </condition> <condition type="spring"> <arg name="bean.name">hasRemoteStatus</arg> <arg name="wsId">hal</arg> <arg name="wsStatus">EMPTY</arg> </condition> </conditions> </restrict-to> <results> <unconditional-result status="Underway" old-status="Finished" step="-1" /> </results> <post-functions> <function type="spring"> <arg name="bean.name">deletePermission</arg> <arg name="mask">AOE_DELETE USE_AOE_MODERATOR_FORM</arg> <arg name="recipient">AOE_OWNER</arg> </function> <!-- FONCTION D'ENVOI VERS HAL --> <function type="spring"> <arg name="bean.name">invokeWSOperation</arg> <arg name="wsId">hal</arg> <arg name="wsMethodId">upload</arg> </function> <function type="spring"> <arg name="bean.name">invokeWSOperation<>saveOrUpdateIndex</arg> <arg name="idOriIndexing">indexingServicePublic</arg> </function> <function type="spring"> <arg name="bean.name">saveXmlHistory</arg> </function> </post-functions> </action>
- wsId : nom du service distant
- wsMethodId : nom de la méthode ou fonction à invoquer auprès de ce service
- pour que la post-function invokeWSOperation décrite ci-dessus fonctionne, il faut qu'elle corresponde à une configuration présente dans le fichier remote-services-configs.xml de la contribution (ou du workflow par défaut comme le cas qu'on présente ici)
Comme le fichier addonContext.xml, remote-services-configs.xml est un fichier de configuration Spring. Il comprend donc un certain nombre de déclarations de beans Spring. Plus précisément, ce fichier doit déclarer :Info Comme le suggère le titre de cette page, l'appel au service distant (HAL dans cet exemple) n'est pas direct : il se fait via le module ORI-OAI-ext, ce qui permet de masquer la diversité de ces services derrière une interface unique, et de les invoquer d'une unique manière. Si l'on parle de configuration d'appels à un service distant, cela signifie donc en fait configuration de la communication avec ORI-OAI-ext.
- uniquement des beans de classe org.orioai.workflow.beans.remote.RemoteServiceConfig
- doit déclarer un bean RemoteServiceConfig par méthode ou fonction d'un service distant à appeler
Ainsi, pour l'appel à la méthode upload du service hal, on trouvera dans remote-services-configs.xml :Code Block xml xml title Appel à la méthode upload du service hal <bean class="org.orioai.workflow.beans.remote.RemoteServiceConfig"> <!-- TODO: remove these HAL identifiers from here... --> <property name="halUserId" value="${ext.hal.account.id}" /> <property name="halUserPassword"
value="${ext.hal.account.password}" /> <!-- END of things to remove --> <property name="wsId"
value="hal" /> <property name="wsMethodId" value="upload" /> <property name="metadataTypeId" value="dc_plus_fr_easy" /> <property name="statusKey" value="halArtStatus" /> <!--+ | Keys are proper to ori-oai-ext | Values are xpathes proper to the current metadataType
+--> <property name="
xPathesParams"
> <map> <entry key="fullTextName" value="//dc:title" /> <entry key="fullTextFormat" value="//dc:format" /> <entry key="fullTextUri" value="//dc:relation[@xsi:type = 'dcfr:file']" /> <entry key="envoiHal" value="//dcterms:accessRights[@xsi:type = 'dcfr:envoi_HAL']" />
</map> </property> <!--+ | Keys are xpathes proper to the current metadataType | Values are proper to ori-oai-ext | | NOTE : to edit one node with several values, values keys must | be space separated and the last key must be followed by a pipe | followed by the character which will separate the multiple values | in the node. +--> <property name="xmlContentEditionParams"> <map> <entry key="//dc:identifier[@xsi:type = 'dcfr:hal_id']" value="halArtId halArtVersion halArtPassword|," /> </map> </property> <!-- Keys are proper to ori-oai-workflow --> <property name="downloadResourcesParams"> <map> <!--+ | the value associated with downloadDecisionKey | is a key in xPathesParams +--> <entry key="downloadDecisionKey" value="envoiHal" /> <entry key="downloadDecisionValues" value="file_hal link_file_hal" /> <entry key="resourcesUrisKey" value="fullTextUri" /> <entry key="downloadWsId" value="download" /> <entry key="downloadWsMethodId" value="downloadResource" /> </
map>
</property> </
bean>
...