Get image of a transaction

Home Forums Convertigo Products Get image of a transaction

This topic contains 6 replies, has 2 voices, and was last updated by  silvia_munozatienza@iecisa.com 1 year, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #210944

    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.

    Attachments:
    You must be logged in to view attached files.
    #210946

    Gregory Vorbe
    Moderator

    Hello Silvia,

    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.

    QA&Support

    #210948

    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?
    Thanks

    #210949

    Gregory Vorbe
    Moderator

    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.

    QA&Support

    #210954

    Hi,
    I tried using the Write binary from Base64 step but I get the following error.
    Thank you.

    Attachments:
    You must be logged in to view attached files.
    #210956

    Gregory Vorbe
    Moderator

    Hello Silvia,

    Your error is due to a problem with the ‘Output file’ property of the ‘Write binary from Base64′ step.
    This is as Javascript property that must point to the file path the binary is written to, for example:

    ".//subFolder/myPicture.png"

    You can replace ‘myPicture.png’ with a JS variable computed before in your sequence to have a dynamic file name:

    ".//subFolder/" + myJSFileName

    QA&Support

    #210957

    Thank you, that works

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.