Data Services - "Element" works but "Attribute" does not
Hi,
I created a Data Service using a CSV file. The following code does not work:
<data name="WeatherService">
<config>
<property name="csv_datasource">/usr/local/mashup/dataservices/weather.csv</property>
<property name="csv_columnseperator">,</property>
<property name="csv_columns">City,Weather</property>
<property name="csv_columnordinal">1,2</property>
<property name="csv_startingrow">1</property>
<property name="csv_maxrowcount">10</property>
<property name="csv_hasheader">true</property>
</config>
<query id="listWeatherQry">
<result element="weatherlist" rowName="weatheritem">
<attribute name="city" column="1" />
<attribute name="weather" column="2" />
</result>
</query>
<operation name="listWeather">
<call-query href="listWeatherQry" />
</operation>
</data>
But the following code works (uses "Element" instead of "Attribute"):
<data name="WeatherService">
<config>
<property name="csv_datasource">/usr/local/mashup/dataservices/weather.csv</property>
<property name="csv_columnseperator">,</property>
<property name="csv_columns">City,Weather</property>
<property name="csv_columnordinal">1,2</property>
<property name="csv_startingrow">1</property>
<property name="csv_maxrowcount">10</property>
<property name="csv_hasheader">true</property>
</config>
<query id="listWeatherQry">
<result element="weatherlist" rowName="weatheritem">
<element name="city" column="1" />
<element name="weather" column="2" />
</result>
</query>
<operation name="listWeather">
<call-query href="listWeatherQry" />
</operation>
</data>
What could be wrong?
Regards,
Ganesh Prasad
- Login or register to post comments
- Printer friendly version
- 339 reads











hi Ganesh, Data Service
hi Ganesh,
Data Service release that comes with WSAS 2.2 does not support formatting results as attributes for CSV & Excel types. I will fix this & make a patch available to you along with instructions on how to apply it.
Thanks,
/sumedha
One more minor nit
Thanks, Sumedha.
One minor point: csv_columnseperator should be spelt cvs_columnseparator (with an 'a' instead of an 'e').
Regards,
Ganesh