calling a web service in Talend tRestClient - talend

How to call a Rest Web service using tRestClient with a POST method and pass a json.
I've viewed the documentation of Talend but nothing about POST method and how to pass the json to the tRestClient.
any help please?
thanks in advance

First, you have to set the HTTP Method to POST.
Then, a new field opens up, HTTP Body. Your JSON body could look like this:
"{
\"MyRequestParameter1\":\"abc\",
\"ANumberParameter\":\"456\"
}"
Just make sure all quotes in the JSON are escaped properly.

Related

How to use Talend tRESTClient component to send xml request with POST method

I'm trying to use Talend studio 6.4.1 to call a REST API, the request body is xml and the method is POST, by using a tRESTClient component, the response is
Error Response
It seems that the problem is caused by wrong url, but by using the Postman, it works well.
The screenshot is as below:
The job and tRESTClient component
and the input schema is like as below:
The input schema
I have search for this problem via Google and StackOverflow for a long time, but I can't find the reason, any suggestion would be very appreciated, thank you in advance. By the way, the 1.1.1.1 is not real IP I used, but just for privacy purpose.

How to Print the DataHandler Content for SOAP Request

I have the object of "javax.activation.DataHandler.DataHandler"
and i saw that it has been added to SOAP request using the below command
org.apache.axiom.util.stax.XMLStreamWriterUtils.writeDataHandler()
I want to get the content from DataHandler, the content which is actually will be the part of the SOAP request, as i know it will be in the form of string.
thanks in advance!

Get non file body from multipart/form-data using AWS API Gateway and Lambda

I am trying to get the form data from a multipart/form-data POST to my ASW Lambda web service via API Gateway.
The HTTP POST has Content-Type "multipart/form-data" and body that is URL encoded. File data is also sent in this post (hence the multipart, I guess).
The web service needs to integrate with a thirdparty service, so changing the format of the POST isn't really an option.
I have seen this thread talking about converting the URL encoded data to JSON object for use in Lambda, but this doesn't do the trick.
I have also tried setting the Integration Request -> Mapping Templates for content type multipart/form-data to Input passthrough. This didn't help either.
I did come across another question about uploading a file using multipart/form-data, but since I'm not interested in the file, just the body, that answer didn't help.
Below find screenshot (sorry) of the captured post via runscope.
If the goal is to use Lambda, you'll need to pass valid JSON to the function. Currently there isn't a way to JSON-ify data inside Api Gateway that comes in as non-JSON data.
Our short term fix (on our backlog) is to provide a variable in the mapping templates to grab the raw input of the request. That way you could do a simple JSON conversion using a template like:
{
"body" : "$input.body"
}
or something like that.
Check out the mapping template reference for more info: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
Edit 4/7 - feature has been released as $input.body

Handling HttpWebrequest post data at the end point

Hi I am trying to make a call to external rest service using httpwebrequest. I am sending some payload with the httpwebrequest. Now I am trying to code the endpoint. I am not able to figure out the how to get the payload that I sent along with httpwebrequest? I may sound stupid but any help would be appreciated.
I figured it out. It is same as making a rest call using any rest client. you can get the payload using "args" parameter.
for example I am sending a Json Object in the payload. Then I can receive it using the following code:
JObject items = args.payload["items"];
Not sure if it helps anybody.

RESTful post in Oracle Service Bus

Does anyone know how to create a proxy service that will handle this sort of thing?
What I'm looking for is a path parameter and a post body being formatted similar to this:
POST www.myurl.com/{123}
Post body:
myId=1&myOtherId=2
I am currently passing in an XML document and I'm doing an insert on the http:relative-URI element in the transport. This seems to work.
I am also currently doing an insert on the http:query-parameters for my post body name/value pairs.
I am inserting these on the outbound variable. When I debug, both are showing up and I'm contacting the REST service. I am getting a 400 -- Bad Request error. This happens when the post body is not configured correctly.
Any ideas how to do this?
If you are just Posting an XML, then while creating Proxy Service, Select Service Type as Any XML.