requesting object "picture" attributes

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

requesting object "picture" attributes

Post by NBDAB »

Hello,

We have to request a BO's attributes via the API.

3 attributes are "picture" attributes which we would like to return information.

However it returns an empty strings?

Any advice?


Thanks,
Mark
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

failed to mention

Post by NBDAB »

Hi, Failed to mention

Methods: I am accessing xml.do and method is get_objects_action
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Instead of specifying the name of the attribute, specify the name of the attribute followed by dot and "DOCDATA", for example: AttriibuteName.DOCDATA

This should return the binary data of the picture
Aware IM Support Team
zikr
Posts: 7
Joined: Mon Jan 04, 2010 2:31 pm

Post by zikr »

seems that this information is useless in web application, because there is no way to show these bytes in HTML image element. Why not to change API to return here also picture attribute URL's in normal response (without DOCDATA request). Guess that they should be easily accessible on server side from DB. When autogenerated forms are used, responses that comes from server, contains these urls.
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

In Aware IM pictures are stored in the database, not in the file system. Therefore, the info is returned as binary data. You can easily save this data as a file and then use this file in your HTML image elements (this is what we are doing all the time ourselves)
Aware IM Support Team
zikr
Posts: 7
Joined: Mon Jan 04, 2010 2:31 pm

Post by zikr »

Hi,

I have not looked on DB structure, therefore can't comment. But here how are you doing in your autogenerated forms. When form opens, request get_form_data_action goes to webif.awr. Response in xml has UI layout for form and attribute values.
Here is sample request for me:

Code: Select all

POST /AwareIM/webif.awr?undefined HTTP/1.1
Accept: */*
Accept-Language: en-US,lv;q=0.5
Referer: http://192.168.1.2:8080/AwareIM/logonAdmin.aw#
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded,text/xml,application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; AntivirXP08; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: 192.168.1.2:8080
Content-Length: 99
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=D438684934CB7F98C5512ABB6225EE58

<root><get_form_data_action object_name='DriverLicense' form_context='edit' object_id='3' /></root>

And here is sample response:

Code: Select all

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 05 Jan 2010 12:08:32 GMT

<?xml version='1.0' encoding='UTF-8' ?> 
<root> 
<get_form_data_action_return> 
<form_data form_name="Main" object_name="DriverLicense" form_context="edit" title="Driver License" object_id="3" object_version="17"> 
<form_section_data title="Main" name="Main" label_column_width="90"> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="SignImage" label="Sign Image"> 
<standard_attribute_data type="picture" picture_height="50" picture_width="150" size="20" max_length="40"> 
<attribute_data_val>BASTestDomainNBDAB_tm1.164_DriverLicense_SignImage_3_17</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="DriverId" label="Driver Id"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="20" max_length="20"> 
<attribute_data_val>DL2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Zip" label="Zip"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="5" max_length="5"> 
<attribute_data_val>Z2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="MiddleName" label="Middle Name"> 
<standard_attribute_data type="text" format="" size="35" max_length="35"> 
<attribute_data_val>M2211</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="DateOfBirth" label="Date Of Birth"> 
<standard_attribute_data type="date" allow_blank="false" format="MM/dd/yyyy" size="20" max_length="40"> 
<attribute_data_val>12/11/2009</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="EyeColor" label="Eye Color"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="10" max_length="10"> 
<attribute_data_val>Green</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="State" label="State"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="2" max_length="2"> 
<attribute_data_val>S2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Height" label="Height"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="20" max_length="20"> 
<attribute_data_val>H2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Expires" label="Expires"> 
<standard_attribute_data type="date" allow_blank="false" format="MM/dd/yyyy" size="20" max_length="40"> 
<attribute_data_val>12/06/2009</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="LastName" label="Last Name"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="35" max_length="35"> 
<attribute_data_val>LN2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="FirstName" label="First Name"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="35" max_length="35"> 
<attribute_data_val>FN2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Sex" label="Sex"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="1" max_length="6"> 
<static_choices choices_editable="false" user_defined="false" > 
<static_choice value="Male" >Male</static_choice> 
<static_choice value="Female" >Female</static_choice> 
</static_choices> 
<attribute_data_val>Female</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Address" label="Address"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="50" max_length="100" number_of_lines="2"> 
<attribute_data_val>A2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Address2" label="Address2"> 
<standard_attribute_data type="text" format="" size="50" max_length="100" number_of_lines="2"> 
<attribute_data_val></attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Issued" label="Issued"> 
<standard_attribute_data type="date" allow_blank="false" format="MM/dd/yyyy" size="20" max_length="40"> 
<attribute_data_val>12/30/2009</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="Image" label="Image"> 
<standard_attribute_data type="picture" picture_height="150" picture_width="200" size="20" max_length="40"> 
<attribute_data_val></attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="FaceImage" label="Face Image"> 
<standard_attribute_data type="picture" picture_height="50" picture_width="50" size="20" max_length="40"> 
<attribute_data_val>BASTestDomainNBDAB_tm1.164_DriverLicense_FaceImage_3_17</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
<layout_row> 
<layout_cell_data type="attribute"> 
<attribute_data attribute_name="City" label="City"> 
<standard_attribute_data type="text" allow_blank="false" format="" size="20" max_length="20"> 
<attribute_data_val>C2</attribute_data_val> 
</standard_attribute_data> 
</attribute_data> 
</layout_cell_data> 
</layout_row> 
</form_section_data> 
</form_data> 
</get_form_data_action_return> 
</root> 

After that your FormParser creates PictureField(s) and in internal image sets src to attribute_data_val from response. For example in my case for attribute SignImage its relative url is BASTestDomainNBDAB_tm1.164_DriverLicense_SignImage_3_17. I can directly in browser navigate to full url: http://192.168.1.2:8080/AwareIM/BASTest ... Image_3_17. To make my image elements work in custom forms, similar functionality for get_objects_action response would be really required, so I can extract image url from attribute and assign it to img src attribute through JavaScript.

Thanks,
Z.
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

As you seem to be quite familiar with AJAX/Javascript you should look at the file aware_full.js that contains all the Javascript code for the Aware IM UI. There is a PictureField and DocumentField objects that implements pictures and documents in Aware IM.

For pictures and documents a separate request is sent to the server - the name of the action is get_attr_doc_url_action (off the top of my head). This will return the URL of the image (the web server code in Aware IM will do exactly what I said - it will retrieve the binary data, create a temporary image and return the URL of this image).

The picture field will handle response of this request and display the image.
Aware IM Support Team
Post Reply