Inqueue (REST queue)
De Wiki1000
(Différences entre les versions)
(2 révisions intermédiaires par un utilisateur sont masquées) | |||
Ligne 39 : | Ligne 39 : | ||
Response: | Response: | ||
{"response":{"result":0,"msg":{"queueName":"DBQUEUE1","uniqueID":"000000000000000000C900013E120010","contentLength":17119,"param1":1,"param2":"toto"}}} | {"response":{"result":0,"msg":{"queueName":"DBQUEUE1","uniqueID":"000000000000000000C900013E120010","contentLength":17119,"param1":1,"param2":"toto"}}} | ||
+ | </pre> | ||
+ | |||
+ | Poster un message en utilisant PowerShell : | ||
+ | |||
<pre> | <pre> | ||
+ | # get the base64 encoded content of the file | ||
+ | $fileName = "C:\temp\exports\wfclassea.txt" | ||
+ | $fileContent = get-content $fileName | ||
+ | $fileContentBytes = [System.Text.Encoding]::UTF8.GetBytes($fileContent) | ||
+ | $fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes) | ||
+ | |||
+ | # prepare a payload with parameters | ||
+ | $postParams = @{ | ||
+ | "message.action"="importdip"; | ||
+ | "message.accessToken"="16000000840B0D0015009001F700000054B3C7A49B5EF2E6AE6209EB1735FF3DA6F1F8CF5F00FCF98CFAADD9D036DE01B3321CEC0C55F7961F9258862B5715F1D86A37E90975EB7BEEA7A2CB4978DA5C7DC274FB91DFE97409E9D8B347739F5822979CCF420856ABADEC0EDAD8751007D3AF721E8BBA302AC66402228BE884D2A106DA6C169579140D6411DE4D8397E3FA54642EFA6655AE25EC54A1F87C8FC5A1D5CECED228648F3C7217913D77B0E63A3A55B3236413B9419C5318ED3843DE1DDEEBD91A86F73C10575F7E2FA2DD30166C19B0E09D7C2FBD887466E44EC5DF4510CB4139CDDF648673C2F979909075535F058E4764E73A91CF71CC5AEC0C4FF3F6BB247E0A0CF5"; | ||
+ | "message.jobID"="1"; | ||
+ | "message.myRef"="my reference"; | ||
+ | "import.name"="testimport-wfclassea.dip"; | ||
+ | "content"=$fileContentEncoded | ||
+ | } | ||
+ | |||
+ | # This is because my test server certificate is self signed | ||
+ | [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } | ||
+ | |||
+ | # line has been splitted for formatting | ||
+ | Invoke-WebRequest -Uri https://.../servicename/server/rpc.l1000/rest/queue.inqueue?queueName=DBQUEUE1 | ||
+ | -Headers @{"Authorization"="Bearer 16000000840B0D0015009001F700000054B3C7A49B5EF2E6AE6209EB1735FF3DA6F1F8CF5F00FCF98CFAADD9D036DE01B3321CEC0C55F7961F9258862B5715F1D86A37E90975EB7BEEA7A2CB4978DA5C7DC274FB91DFE97409E9D8B347739F5822979CCF420856ABADEC0EDAD8751007D3AF721E8BBA302AC66402228BE884D2A106DA6C169579140D6411DE4D8397E3FA54642EFA6655AE25EC54A1F87C8FC5A1D5CECED228648F3C7217913D77B0E63A3A55B3236413B9419C5318ED3843DE1DDEEBD91A86F73C10575F7E2FA2DD30166C19B0E09D7C2FBD887466E44EC5DF4510CB4139CDDF648673C2F979909075535F058E4764E73A91CF71CC5AEC0C4FF3F6BB247E0A0CF5"} | ||
+ | -Method POST -Body $postParams | ||
+ | </pre> | ||
Voir aussi : | Voir aussi : |
Version actuelle en date du 24 mars 2015 à 09:31
Cette action poste un message dans une file d'attente
http://.../servicename/server/rpc.l1000/rest/queue.inqueue?queuename=nom_de_file
Paramètre | type | Valeur |
---|---|---|
queuename | string | Nom de la file d'attente |
content | string base64 | contenu du message |
Remarques :
- Tous les paramètres sont ajoutés comme paramètre du message
- Le contenu de la requête (POST) est stocké comme contenu binaire du message.
Exemple :
Request: POST http://hostname/servicename/server/rpc.l1000/rest/queue.inqueue?queuename=DBQUEUE1 content:application/x-www-form-encoded Authorization:Bearer 160000768..... Accept:application/json param1=1 param2=toto content=...base64 17119 bytes... Response: {"response":{"result":0,"msg":{"queueName":"DBQUEUE1","uniqueID":"000000000000000000C900013E120010","contentLength":17119,"param1":1,"param2":"toto"}}}
Poster un message en utilisant PowerShell :
# get the base64 encoded content of the file $fileName = "C:\temp\exports\wfclassea.txt" $fileContent = get-content $fileName $fileContentBytes = [System.Text.Encoding]::UTF8.GetBytes($fileContent) $fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes) # prepare a payload with parameters $postParams = @{ "message.action"="importdip"; "message.accessToken"="16000000840B0D0015009001F700000054B3C7A49B5EF2E6AE6209EB1735FF3DA6F1F8CF5F00FCF98CFAADD9D036DE01B3321CEC0C55F7961F9258862B5715F1D86A37E90975EB7BEEA7A2CB4978DA5C7DC274FB91DFE97409E9D8B347739F5822979CCF420856ABADEC0EDAD8751007D3AF721E8BBA302AC66402228BE884D2A106DA6C169579140D6411DE4D8397E3FA54642EFA6655AE25EC54A1F87C8FC5A1D5CECED228648F3C7217913D77B0E63A3A55B3236413B9419C5318ED3843DE1DDEEBD91A86F73C10575F7E2FA2DD30166C19B0E09D7C2FBD887466E44EC5DF4510CB4139CDDF648673C2F979909075535F058E4764E73A91CF71CC5AEC0C4FF3F6BB247E0A0CF5"; "message.jobID"="1"; "message.myRef"="my reference"; "import.name"="testimport-wfclassea.dip"; "content"=$fileContentEncoded } # This is because my test server certificate is self signed [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } # line has been splitted for formatting Invoke-WebRequest -Uri https://.../servicename/server/rpc.l1000/rest/queue.inqueue?queueName=DBQUEUE1 -Headers @{"Authorization"="Bearer 16000000840B0D0015009001F700000054B3C7A49B5EF2E6AE6209EB1735FF3DA6F1F8CF5F00FCF98CFAADD9D036DE01B3321CEC0C55F7961F9258862B5715F1D86A37E90975EB7BEEA7A2CB4978DA5C7DC274FB91DFE97409E9D8B347739F5822979CCF420856ABADEC0EDAD8751007D3AF721E8BBA302AC66402228BE884D2A106DA6C169579140D6411DE4D8397E3FA54642EFA6655AE25EC54A1F87C8FC5A1D5CECED228648F3C7217913D77B0E63A3A55B3236413B9419C5318ED3843DE1DDEEBD91A86F73C10575F7E2FA2DD30166C19B0E09D7C2FBD887466E44EC5DF4510CB4139CDDF648673C2F979909075535F058E4764E73A91CF71CC5AEC0C4FF3F6BB247E0A0CF5"} -Method POST -Body $postParams
Voir aussi :