2

I am retrieving the single row from DSS like

<Body xmlns="http://ws.wso2.org/dataservice">
   <Datalist>
      <username>anil</username>
      <password>anil123</password>
   </Datalist>
</Body>

and i am consuming this row in ESB Payload factory , while running the my ESB service,

i am getting like this :-

{"ResponseJSON":{"Body":{"Datalist":{"username":"anil","password":"anil123"}},"Status":"200","Total":"1.0"}}

But my output look like as JSON array.

{
    "ResponseJSON": {
        "Body": {
            "Datalist": [
                {
                    "username": "anil",
                    "password": "anil123"
                }
                        ]
        },
        "Status": "200",
        "Total": "1.0"
    }
}

How can we achieve this

Community
  • 1
  • 1
user2251940
  • 61
  • 1
  • 3
  • 11
  • 1
    for multiple rows it's retrieving the JSON array , but single row it's not retrieving the JSON array. My front end reads in JSON array format only. How can we achieve this. – user2251940 Apr 06 '13 at 12:15

2 Answers2

0

HI Add the following property in your Proxy Service sequence.

 <property name="messageType" value="application/json" scope="axis2"/>

or else if you are working on WSO2 ESB 4.7.0.

<property name="ContentType" value="application/json" scope="axis2"/>

then no need to write above properties.It is automatically converted into json format.

Try to work on latest WS02 E.S.B 4.7.0, it's working fie.

If you need anything let me know.

Kanchetianeel
  • 189
  • 2
  • 3
  • 15
  • 1
    I use WSO2 ESB 4.8.0 and I still have the problem. With one element in the list I get {}, with multiple elements I get []. But I would like to always have []. How to achieve this? – andQlimax May 23 '14 at 09:18
0

I am also facing same issue in WSO2ESB 4.8.0

But got workaround by using Script-mediator.

Please let me know if you have any other solution for this problem.

Thanks

lakhan_Ideavate
  • 375
  • 4
  • 14