get file from a post http

Hi,

I want to create a rest service that will can get a file from an http post file.

So i use postman chrome plugin in order to call my rest service and i send a file.
ex:http://localhost:5555/rest/Test/Service/file

But i don’t succeed in getting my file.
Which flow services must to be use to get the file either binary or form-data?.
do you have an exemple ?

best regards.

thanks for your help.

I believe you can’t use regular http service to test the REST instead you can use pub.jason* service to receive the payload from the REST API invoke.

Is that the way you want the functionality rather than just http post a XML and receive the payload to the target service?

HTH,
RMG

1 Like

Regina – You didn’t succeeded in achieving – Did you see any errors ? Can you please more specific ?

Thanks,

Hi,

i will try to explain what i want. it’s very simple.

i want to expose a rest service that can get a file from a http post.

So a customer could want to call ma rest service and send me a zip file a jpg, an xml file ,a text file or another.

so my rest service should be able to get the file sent and then copy it on a local folder.

But i don’t know how to do this. i dont’t find any service that can help me to achieve my goal.

can you help me ?

best regards,

Patrick.

Please go through below link which is helpful to you. Also please read documentation on REST for better understanding.

Thanks,

One way of doing this is keep the fileName parameter in the rest post service which can accept the full file name. Then in the flow service you can use ftp services to get the file and store it in the local system.

Patrick,
You could ask the source system to send the file in base64 encoded format. Once you receive via REST call, you can make use of the public built in services under pub.file folder (stringToFile, bytesToFile etc.,) to place the file in specific folder in the same machine.

-Senthil

Please check this link, hope it will helps you.

[b]http://serviceorientedarchitect.com/how-to-create-a-rest-service-in-webmethods-integration-server/

Regards,
krishna

try to use this url http://localhost:5555/rest/Test/Service/file?jsonFormat=stream. Use jsonStream object as the input of the service.

hi everyone,

thanks a lot.
i’m succeed in resolving my issue.

indeed i put a contentStream object in my input parameter.
then i used the pub.file:streamToFile service in order to write the file in my local repository.

Good to know that you resolved the issue.

Krish