Parse data from tsv file to json and use tRestClient to create record
Hi,
I have been trying to use the tRESTClient component to create/update data into the database.
Also, the headers being acknowledged but the payload is shown as null i.e {} .
I am attaching my job design here.
Could there possibly be some error in the flow of components? as the payload is not getting rendered in the response-code?
ID: 1
Address: http://.....
Http-Method: PUT
Content-Type: application/json
Headers: {Content-Type=, Accept=, PREAUTH_USER_ID=}
Payload: {}
//// why so???? --------------------------------------
Sep 08, 2014 8:41:57 PM org.apache.cxf.interceptor.LoggingInInterceptor
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 400
Encoding: UTF-8
Content-Type: application/json;charset=UTF-8
Headers: {connection=, Content-Length=, content-type=, Date=, Server=, Set-Cookie=}
Payload: {"id":"IE-1410189116899","errors":,"message":"Expecting Accept=application/vnd.......mdm-v1+json"}]}
-----------------------
Exception in component tRESTClient_1
javax.ws.rs.BadRequestException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.cxf.jaxrs.client.AbstractClient.convertToWebApplicationException(AbstractClient.java:463)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:881)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:852)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:410)
at org.apache.cxf.jaxrs.client.WebClient.put(WebClient.java:474)
at demotraining.test_put_0_1.test_Put.tWriteJSONField_1_InProcess(zany_Put.java:2778)
at demotraining.test_put_0_1.test_Put$1ThreadXMLField_tWriteJSONField_1_Out.run(test_Put.java:1078)
Also, could you help me with this please?
I want to set an element from the json as an array. Can this be done?
Current payload:
here i want the alternateCurrencyCodes and addresses as the array elements.
Required payload:
"alternateCurrencyCodes":,
"addresses":
}
Current settings in tXMLMap, but not working:
Hi,
thanks! that did help. IS there any way of adding square brackets before/after the elements in the array?
Example:
"alternateCurrencyCodes":
,
"addresses":
}
Hi
Which version are you using? I am using Talend Open Studio for ESB 5.5.1, if you are using an older version, try to upgrade your studio version and test it again.
Best regards
Shong
Hello,
I was using Talend Open Studio for Data Integration 5.5.1. Tried with ESB,it worked!
I have another issue.
Currently this is what i get in the payload :
,
"parentGroupId":"876",
"agencyGroupId":"191",
"locale":"en_NZ",
"defaultCurrencyCode":"GBP",
"addresses":
}
]
This is for only one row in the tsv file that is one record.
How can i implement a PUT loop for multiple records in the tsv?
That is the put request will get a payload of multiple values like :
{
"type": "Financial",
"addressLine1": "addressLine1",
"addressLine2": "Line2",
"addressLine3": "Line3",
"addressLine4": null,
"addressLine5": null,
"postCode": "postCode",
"addressId": "333"
},
{
"type": "Media",
"addressLine1": "addressLine1",
"addressLine2": "Line2",
"addressLine3": "Line3",
"addressLine4": null,
"addressLine5": null,
"postCode": "postCode",
"addressId": "653"
}
]
}
]
How can this be implemented? Will i have to use tFlowToIterate_1 component joining it to tRestClient(Tried but not working) or some other component?Thank you.
Hi..
I am trying to use txmlmap component with trestclient. I recieve the following error though I don't have any null values in the records:
" Payload: Error 400: BMXAA4149E - null is not a valid organization. Specify a valid Organization value as defined in the Organization application. "
Can you please post a solution for this. I am sharing the screenshots with you
Thanks
Anjali