How to Print the DataHandler Content for SOAP Request - soap

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!

Related

calling a web service in Talend tRestClient

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.

Best way to send content in PERL POST Request?

I am sending a PERL POST Request over HTTPS. During sending the request i need to send two things in content one is an authorization token and other is the command need to be executed on the server side.
What should be the approach to send these two things as the content?
Should it be:-
$request->content($token)
$request->content($command)
OR should it be
my #content =($token,$command)
$request->content(\#content)
The module which i am using is LWP::UserAgent and in that i will be creating a HTTP::Request type object my $request = HTTP::Request->new(POST => "<url>"); and in
this object i am sending content.
There is only a single content (request body) for a POST request. So any call of content just replaces the previously defined content. Please have a look at the documentation for LWP::UserAgent::post which clearly defines how to send POST data with multiple values. Also, it might be useful if you understand how forms in HTML work, both on the client (browser) and on the server side. Because only if you know what the server side expects in detail you can create the proper request.

How to remove HTML content from REST API response?

I have started to work with REST APIs - specifically JIRA REST APIs.
I'm using the API to get response to a JIRA query but the JSON response I am getting contains lot of HTML chunk inside it.
It is not clean enough as showcased here
How can I use it in such a way to get a proper JSON response?
I think, JIRA response in JSON format only if request is successful, if request has any error than it comes in HTML response. actually that html belongs to the JIRA's error page. So correct your request, you will not get any response in HTML fomat. :)

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.

HTTP PUT Request limit

I am designing a RESTful API when I noticed something strange.
When I make a POST request for creating a new record, the form data is sent in request payload.
But when I make a PUT request to update a record, it appends form data in the URL, very similar to GET request.
Now a URL has certain length limit. So what would happen if PUT request has larger data than this limit.
Will the PUT request fail?
Is it unsafe to use PUT instead of POST to update a record having large form data?
EDIT:
I am using NodeJS server. I am using restangular(angular framework) to build my PUT request.
Use customPUT to send the form data in payload.
baseObj.customPUT(newObj).then(function(xyz){})
Have a look at these threads
Can HTTP PUT request have application/x-www-form-urlencoded as the Content-Type?
PHP multipart form data PUT request?
application/x-www-form-urlencoded or multipart/form-data?
Sounds like you can basically set a Content-type: multipart/form-data header and be golden. Basically comes down to configuration of the request with restangular and support thereof on the NodeJS server.