如何在wso2 DSS中创建输出映射以实现以下结构?

时间:2013-05-20 06:49:54

标签: wso2 wso2dss

我在dss及其工作中创建了一个服务。问题是我输出为:

<cir_registryCollection xmlns="http://cts.falcon/cir">
 <cir_getRegistryData>
  <ID>AamProp_721</ID>
  <Description>its really tough to do this</Description>
  <ID>AamProp_721</ID>
  <SourceID>AamPublic_134</SourceID>
  <Description>its really tough to do this</Description>
  <ISO15926ReferenceURI>arya2Publication@books.com</ISO15926ReferenceURI>
  <Registry_ID>Book_112</Registry_ID>
</cir_getRegistryData>
</cir_registryCollection>

但我希望我的输出为:

<cir_registryCollection xmlns="http://cts.falcon/cir">
     <cir_getRegistryData>
      <ID>AamProp_721</ID>
      <Description>its really tough to do this</Description>
</cir_getRegistryData>
<cir_getCategoryData>
<ID>AamProp_721</ID>
      <SourceID>AamPublic_134</SourceID>
      <Description>its really tough to do this</Description>
      <ISO15926ReferenceURI>arya2Publication@books.com</ISO15926ReferenceURI>
      <Registry_ID>Book_112</Registry_ID>
</cir_getCategoryData>
        </cir_registryCollection>

如何使用输出映射实现此结构?期待你的回答。提前谢谢。

上面的事情已经完成,但是有问题吗?我有我的DSS服务:

<data name="cir_GetAllRegistry_DataService" serviceNamespace="http://cts.falcon/cir">
   <description>select all data from all tables                          &#13;                                &#13;                                &#13;                                &#13;                                &#13;                                &#13;                                </description>
   <config id="Cir_DataSource">
      <property name="carbon_datasource_name">CIR_MySQL_DB</property>
   </config>
   <query id="select_all_cir_table_query" useConfig="Cir_DataSource">
      <sql>select r.ID,r.Description,c.ID,c.SourceID,c.Description,c.ISO15926ReferenceURI,c.Registry_ID from cir_registry r join cir_category c&#13;on r.ID=c.Registry_ID;</sql>
      <result element="Entries" rowName="Entry">
         <element column="ID" name="ID" xsdType="string"/>
         <element column="Description" name="Description" xsdType="string"/>
         <element column="ID" name="ID" xsdType="string"/>
         <element column="SourceID" name="SourceID" xsdType="string"/>
         <element column="Description" name="Description" xsdType="string"/>
         <element column="ISO15926ReferenceURI" name="ISO15926ReferenceURI" xsdType="string"/>
         <element column="Registry_ID" name="Registry_ID" xsdType="string"/>
      </result>
   </query>
   <operation name="select_all_cir_table_operation">
      <description>selects all table data in case of no data passed                              &#13;                                    </description>
      <call-query href="select_all_cir_table_query"/>
   </operation>
</data>

我对表cir_registry和cir_category表的列名ID相同。由于两者都有相同的名称,因此每次都会覆盖我的值。那么如何唯一地引用注册表和类别表的列ID?

1 个答案:

答案 0 :(得分:1)

在DSS中,我们可以创建复杂的输出元素,也就是说,我们可以使用任意XML结构嵌套信息,请查看[1]以获取更多信息。

[1] http://docs.wso2.org/wiki/display/DSS301/Complex+Elements

干杯, 长香。