WSO2 DataMapper : Mapping field Error while parsing XML input stream - wso2

i want to send data that i recive it from API to datamapper then return it to the client .
Everytime i call the api it's return null but if i remove datamapper config , it's return the values .
anyway I also facing this error :
DataMapper Error : Mapping field Error while parsing XML input stream , Current context not object but root
I Try to make input file xml and output JSON but not working
Also input JSON and output JSON , not working
enter image description here

Related

Conversion error when converting an integer field from mongo to Json format as result in WSO2 Integration Studio

In WSO2 Integration Studio Data Service project, I am extracting data from mongo database using find query. While showing an integer field in json format, I get the following error.
I have a field called 'RoomCount' and an integer type that returns a Mongo query result. I am getting error while converting this field to Json Format as below. When I am pulling string type data its work but integer,double.. doesnt work !
<query id="MunicipalBuildingDetails" useConfig="MongoDb">
<expression>collectionName.find()</expression>
<result outputType="json" escapeNonPrintableChar="true">{
Result:
{
Data:
[{
"Col1":"$document.RoomCount"
}
]
}
}</result>
</query>
Error is;
DS Fault Message: Error occurred when retrieving data. :JSONObject["RoomCount"] not a string.
How can I solve this?
This is another issue with the Mongo JSON conversion implementation. The values are always read as Strings. If you have any Integers rather than reading the element return the complete response and let the client handle it or handle it in the integration layer.
<query id="MunicipalBuildingDetails" useConfig="MongoDb">
<expression>collectionName.find()</expression>
<result outputType="json" escapeNonPrintableChar="true">{
Result:
{
Data:
[{
"Col1":"$document"
}
]
}
}</result>
</query>
Another alternative is to use the MongoDB connector. Also I'm not sure whether there is any option in MongoDB to always return values as Strings, may be worth checking that option as well.

How to parse a HTML response to extract a specific value in postman

Html Response
I am trying to get only Authorization missing or invalid from the above html response
Test:
const $ = cheerio.load(pm.response.text());
console.log($("p").text());
Using the above code ,i am getting all the text between P tags

why I am getting this output in djangorestframework-jwt

hello I have implemented JWT in my test project using this package "djangorestframework-jwt"
I have generated the token by giving my "username" and "password"
but the problem is that I am getting this output bypassing my token with the endpoint
I am using postman to test API,Django=2.2.12, python 3.7.6
I am not getting my data from the database
{"eno":["This field is required."],"ename":["This field is required."],"esal":["This field is required."],"eaddr":["This field is required."]}
Your question is not correct, but I try to explain you what happend. So,
You try send POST request to your /api/ route and you got error because you dont send any required data. Go to Body tab and click on 'raw' radio button and than change 'Text' to JSON and insert correct JSON with data that you want to send to your server, it will be looks like:
{
"eno": "your_eno",
"ename": "your_ename"
.....
}
You should read about it if you dont know.

WSO2 Stream Processor : Correlation during http response handling for http service calls

I have a hosted http service that accepts a trend data and returns some output. This service is accessed in siddhi query language as follows:
#sink(type='http-request', sink.id='trends',
publisher.url='${SERVICE_URL}', #map(type='json', #payload(""" {"trend":{{trendArray}} } """) ) )
define stream Request(item string, trendArray string);
#source(type='http-response' , sink.id='trends', http.status.code='200',
#map(type='json', #attributes(stock = '<HOW_TO_GET_THIS_VALUE>', output = "<HOW_TO_GET_THIS_VALUE>")
) )
define stream Response(item string, output string);
The http request(and response) payload doesn't include item name.
when the response comes we would like to assign item name against which we scored the output - marked as HOW_TO_GET_THIS_VALUE above.
How to accomplish this in siddhi query ?
How to treat the response data of as-is as pass to the field ?
I did not see a description of this scenario in siddhi. If not supported, it will good to know details of a custom extension (based out of http extension) for this scenario. Solution to add a proxy layer for http call is less desired.
After some experiments , HOW_TO_GET_THIS_VALUE = 'trp:item'. The http sink should also have this field even though its not used in payload.

Querying Couchbase Bucket from Postman - Unrecognized parameter in request

Using the Postman tool, I'm trying to query a Couchbase bucket. I'm getting an error response 1065 that there is an "unrecognized parameter in request". The query will work fine within the Couchbase workbench, but I need to be able to do this from Postman.
I'm making a POST request with this body:
{
"statement" : "SELECT * from `myBucketName` where id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee""
}
There error message is:
"msg": "Unrecognized parameter in request: {\n\"statement\" : \"SELECT from `myBuckeyName` where _id "
I think this is just an issue with how my request body is formatted, I'm just new to this and not sure how it should be formatted based off the error I'm getting.
Here's how I did it:
Open Postman
Select POST
Use a URL of http://localhost:8093/query/service
Under "Authorization", use Basic Auth (with the username/password you've created for Couchbase)
Under "Body", select "x-www-form-urlencoded"
Add a KEY of statement and a value of your query
Click SEND
I got a 200 OK response with the results of the query. Screenshot:
You should definitely check out the Couchbase REST API documentation. It uses curl instead of Postman, but that's a translation you'll eventually get used to.