0
votes

I am working on the Wso2 ESB and DataService Server.

While i am running the CURL command on terminal side, with respect to ESB, The JSON look like as follows.

{"Body":{"Id":0,"Body":       [{"UserGroupId":-1,"UserGroupCode":"NONE","UserGroupName":"NONE","UserGroupCreatedById":-1,"UserGroupCreatedOn":"/Date(1340024633000)/","UserGroupModifiedById":-1,"UserGroupModifiedOn":"/Date(1340024633000)/","UserGroupSortOrder":9999,"UserGroupStatus":1,"UserGroupVersion":1,"UserGroupSourceType":1,"UserGroupDetailArray":[{"UserGroupDetailId":-1,"UserGroupId":-1,"UserGroupCode":"NONE","UserGroupName":"NONE","UserGroupDetailSlNo":1,"UserId":-1,"UserCode":"GBADMIN","UserName":"Administrator"},{"UserGroupDetailId":-149999779,"UserGroupId":-1799999942,"UserGroupCode":"SHSBCPLUM","UserGroupName":"HSBCMALAD_Plumber","UserGroupDetailSlNo":9,"UserId":-2147483640,"UserCode":"r2416","UserName":"AlexRupan"}]}]},"Current":"","ETag":"","First":"","From":"","Id":"","Last":"","Next":"","Previous":"","ReplyTo":"","Status":200,"To":"","Total":5}

for this i tried in DSS using Nested queries it's not working. My Dss as above.enter code here.

    <data name="musergroup_DataService" serviceNamespace="http://ws.wso2.org/dataservice">
   <config id="default">
      <property name="carbon_datasource_name">USCProduction</property>
   </config>

  <query id="selectallusergroups" useConfig="default">
      <sql>select usergroupdetailid as UserGroupDetailId ,musergroup.usergroupid as UserGroupId,usergroupcode as UserGroupCode,usergroupname as UserGroupName,slno as UserGroupDetailSlNo,muser.userid as UserId,usercode as UserCode,username as UserName from muser join musergroupdetail on muser.userid= musergroupdetail.userid join musergroup on musergroupdetail.usergroupid=musergroup.usergroupid</sql>
      <result element="UserGroupDetailArray" rowName="UserGroupDetailArray">
         <element column="UserGroupDetailId" name="UserGroupDetailId" xsdType="integer"/>
         <element column="UserGroupId" name="UserGroupId" xsdType="integer"/>
         <element column="UserGroupCode" name="UserGroupCode" xsdType="string"/>
         <element column="UserGroupName" name="UserGroupName" xsdType="string"/>
         <element column="UserGroupDetailSlNo" name="UserGroupDetailSlNo" xsdType="integer"/>
         <element column="UserId" name="UserId" xsdType="integer"/>
         <element column="UserCode" name="UserCode" xsdType="string"/>
         <element column="UserName" name="UserName" xsdType="string"/>
      </result>
   </query>
   <query id="select_id_columns" useConfig="default">
      <sql>select musergroup.usergroupid as UserGroupId,usergroupcode as UserGroupCode,usergroupname as UserGroupName from musergroup join musergroupdetail on musergroup.usergroupid=musergroupdetail.usergroupid</sql>
      <result element="Body" rowName="Datalist">
         <element column="UserGroupId" name="UserGroupId" xsdType="integer"/>
         <element column="UserGroupCode" name="UserGroupCode" xsdType="string"/>
         <element column="UserGroupName" name="UserGroupName" xsdType="string"/>
         <call-query href="selectallusergroups" requiredRoles=""/>
      </result>
   </query>

   <operation name="selectallusergroups">
      <call-query href="selectallusergroups"/>
   </operation>
   <operation name="select_id_columns">
      <call-query href="select_id_columns"/>
   </operation>
</data>

@My question:-How can i create in Esb proxy service with Dss has endpoint.

while i am running the curl command on terminal side as the output has above JSON.

1

1 Answers

0
votes

For instructions how to execute nested Query on WSO2 DSS please refer the blog post on [1].

To expose SOAP service on DSS side as JSON on ESB output you can use the sample 440 on Wso2 esb on [2].

[1]. http://dinushasblog.blogspot.com/2012/07/how-to-use-result-of-one-operation-as.html [2].http://wso2.org/project/esb/java/4.0.3/docs/samples/advanced_mediation_samples.html#Sample440

Thank You, Dharshana.