We have a call to a web service that returns an image in array of bytes.
When we try to add that image to an xmlElementStep, we can not assign it the value of that byte array because it does not appear in an xml tag that generates the response. This case occurs when the httpInfo property is true.
In the case where the httpInfo property is false, in the xpath of the source picker if we can access that array of bytes.
We have an HTTP transaction. Can we somehow access that array of bytes with the httpInfo property to true?
We attach the xml image of the repository with the httpInfo property to true.
Thank you very much.
In the source picker of your xmlElementStep point to //document/transaction/document/text() to get the data.
If you want to save the image data as a file in the server, i would suggest you to set the ‘HTTP data encoding’ property of the HTTP transaction to ‘base64′, then in your sequence, after the call of this transaction, use a ‘Write binary from Base64′ step to save it as an image file.
Great, that works.
Once saved in Convertigo workspace or current project folder, how can the mobile application access that resource? Can you generate a url to access that route where the image is stored?
You will only be able to access the file from an URL that is relative to the project folder, not the workspace.
If you are using a CTF Mobile project (7.4.X-), in your JS code you can call the following code to get the Convertigo Endpoint URL: C8O.vars.endpoint_url
If you are using a Mobile Builder Project (7.5.X+), in your TS code you can call the following code to get the Convertigo Endpoint URL: this.c8o.endpointConvertigo
You could also calculate the URL of the project folder using a sequenceJS step with following code: var projectURL = context.getProjectUrl();
Then add a jElement step where Expression property is set to projectURL.
You will have the project URL in the XML output and use it in your mobile application.
Your error is due to a problem with the ‘Output file’ property of the ‘Write binary from Base64′ step.
You can replace ‘myPicture.png’ with a JS variable computed before in your sequence to have a dynamic file name:
En poursuivant votre navigation sur ce site, vous acceptez l'utilisation par ce site et ses partenaires de Cookies ou autres dispositifs pour vous proposer, par exemple, des publicités ciblées adaptées à vos centres d'intérêts et réaliser des statistiques de visites.Ok