Hi Devs,
Say I have a DSS service as follows,
<data name="EPAGetContactPersonDS" serviceNamespace="
services.info.epa.mydeq.azdeq.gov">
<config id="MyDeqAzuriteDS">
<property name="carbon_datasource_name">MyDeqAzuriteDS</property>
</config>
<query id="getContactPerson" useConfig="MyDeqAzuriteDS">
<sql>call ARD_MYDEQ_EPAID_SUMMARY_PKG.get_contact_person(?, ?, ?,
?, ?, ?)</sql>
<result defaultNamespace="http://mydeq.azdeq.gov/epa/info/data"
element="contact_person_info" rowName="contact_person">
<element column="CUS_IDNO" name="cus_idno" xsdType="xs:string"
optional="true"/>
<element column="CUSNAM_IDNO" name="cusnam_idno"
xsdType="xs:string" optional="true"/>
<element column="PLCNAM_IDNO" name="plcnam_idno"
xsdType="xs:string" optional="true"/>
<element column="ADDRESS_LINE1" name="address1"
xsdType="xs:string" optional="true"/>
<element column="ADDRESS_LINE2" name="address2"
xsdType="xs:string" optional="true"/>
<element column="CITY" name="city" xsdType="xs:string"
optional="true"/>
<element column="STATE" name="state" xsdType="xs:string"
optional="true"/>
<element column="COUNTRY_CODE" name="country"
xsdType="xs:string" optional="true"/>
<element column="POSTAL_CODE" name="zip" xsdType="xs:string"
optional="true"/>
<element column="PLUS4" name="plus4" xsdType="xs:string"
optional="true"/>
<element column="START_DATE" name="start_date"
xsdType="xs:string" optional="true"/>
<element column="CUS_EMAIL" name="email" xsdType="xs:string"
optional="true"/>
<element column="CATEGORY" name="category" xsdType="xs:string"
optional="true"/>
<element column="LAST_NAME" name="last_name"
xsdType="xs:string" optional="true"/>
<element column="FIRST_NAME" name="first_name"
xsdType="xs:string" optional="true"/>
<element column="MIDDLE_I" name="middle_initial"
xsdType="xs:string" optional="true"/>
<element column="PREFIX" name="prefix" xsdType="xs:string"
optional="true"/>
<element column="SUFFIX" name="suffix" xsdType="xs:string"
optional="true"/>
<element column="KNOWN_AS" name="known_as" xsdType="xs:string"
optional="true"/>
<element column="TITLE" name="title" xsdType="xs:string"
optional="true"/>
<element column="COMPANY_NAME" name="company_name"
xsdType="xs:string" optional="true"/>
<element column="AREA_CODE" name="phone_area_code"
xsdType="xs:string" optional="true"/>
<element column="PHONE" name="phone_number" xsdType="xs:string"
optional="true"/>
<element column="EXT" name="phone_ext" xsdType="xs:string"
optional="true"/>
<element column="PHONE_TYPE" name="phone_type"
xsdType="xs:string" optional="true"/>
</result>
<param name="p_place_idno" sqlType="INTEGER"/>
<param name="p_cus_idno" sqlType="INTEGER"/>
<param name="p_epaid" sqlType="STRING"/>
<param name="p_contact" sqlType="ORACLE_REF_CURSOR" type="OUT"/>
<param name="p_err_code" sqlType="STRING" type="OUT"/>
<param name="p_err_msg" sqlType="STRING" type="OUT"/>
</query>
<resource method="GET"
path="getContactPerson/{p_place_idno}/{p_cus_idno}/{p_epaid}">
<call-query href="getContactPerson">
<with-param name="p_place_idno" query-param="p_place_idno"/>
<with-param name="p_cus_idno" query-param="p_cus_idno"/>
<with-param name="p_epaid" query-param="p_epaid"/>
</call-query>
</resource>
</data>
>From this service I get a response as below,
{
"contact_person_info": {
"contact_person": [
{
"cus_idno": "#####",
"cusnam_idno": "#########",
"plcnam_idno": ######,
"address1": "############",
"address2": #############,
"city": "#############",
"state": "##########",
"country": "########",
"zip": ####,
"plus4": ####,
"start_date": "#######",
"email": ####,
"category": "####",
"last_name": "####",
"first_name": "#### ",
"middle_initial": ###,
"prefix": ####,
"suffix": ####,
"known_as": ####,
"title": ####,
"company_name": ####,
"phone_area_code": "#####",
"phone_number": "####",
"phone_ext": "####",
"phone_type": "#####"
}
]
}
}
But In my use case I want the the following response instead of the above.
{
"contact_person": {
"cus_idno": "#####",
"cusnam_idno": "#########",
"plcnam_idno": ######,
"address1": "############",
"address2": #############,
"city": "#############",
"state": "##########",
"country": "########",
"zip": ####,
"plus4": ####,
"start_date": "#######",
"email": ####,
"category": "####",
"last_name": "####",
"first_name": "#### ",
"middle_initial": ###,
"prefix": ####,
"suffix": ####,
"known_as": ####,
"title": ####,
"company_name": ####,
"phone_area_code": "#####",
"phone_number": "####",
"phone_ext": "####",
"phone_type": "#####"
}
}
New response doesn't has "contact_person_info" element and simple change
in the JSON format in the response.
I was able to generate the response as I wanted by changing the result tag
as following,
<result defaultNamespace="http://mydeq.azdeq.gov/epa/info/data"
element="contact_person_info"
rowName="contact_person">
to
<result defaultNamespace="http://mydeq.azdeq.gov/epa/info/data"
element="contact_person">
I just wanted to check whether this is a good practice from DSS perspective
as in not having a rowName, and whether this could cause any issues, Any
thoughts ?
Thanks,
Kasun
*Kasun de Silva*
Software Engineer | *WSO2 Inc.*; http://wso2.com
lean.enterprise.middleware
email : [email protected]
mobile : +94 77 794 4260
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev