cancel
Showing results for 
Search instead for 
Did you mean: 

Could not upload or download documents through the gateway server !!

ssuratharajan
Participant
0 Kudos

Dear Basis consultants ,

I have a issue in uploading and downloading any file through the gateway server

I have looked in to the below link as reference , Please can you tell me what am I missing here ?

http://scn.sap.com/community/gateway/blog/2013/08/14/how-to-upload-and-download-files-using-sap-nw-g...

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello,

The way you are firing is wrong.

Make sure that u do the below things :

U need to define your model as Media Type which is important.

To Upload file -

1. To Upload any file implement Create_Stream method and write logic inside it to save accordingly.

2. When u fire service u need to set method as POST not GET.

3. U need to add SLUG ( where u pass the key value ) & Content-Type headers ( example - if attachment is pdf then u need to pass application/pdf ).

To Download file -

1. Implement Get_Stream method and write logic accordingly.

2. When u fire service method shud be GET.

3. URL shud have $value at the end.

U need to take care of all necessary things to accomplish what u r asking as question.

Regards,

Ashwin

ssuratharajan
Participant
0 Kudos

Dear Ashwin,

Thank you for the tips ,

I was able to get the error go away by taking a restart of the system , As the above parameters and logic has been set in the system already by our developers.

I face an issue when I execute the gateway service after adding the file , I encounter this error

  • Error Message at client: The specified HTTP method is not allowed for the resource identified by the Data Service Request URI

They say that we should point to a correct URI , Could you please tell me what that means , I should be able to tell my developer team if it is a issue with the coding .

AshwinDutt
Active Contributor
0 Kudos

Hello Rajan,

1.Use HTTP method POST.

2.Please use correct content-type(mime-type) header when u r performing POST/Create_Stream

Have a glance at the below for mime-type related info.

http://help.sap.com/saphelp_nwpi71/helpdata/en/46/bb1832ab4811d4968100a0c94260a5/content.htm

Regards,

Ashwin

0 Kudos

Hi Ashwin,

I have done the following things for upload photo scenario.

1. Implement Create_Stream method and write logic inside it to save accordingly.

2. Fire service using POST.

3. I have added a jpeg file using add file button option in the gateway client.

For the below post request, create_stream is not triggering instead create_entity is triggered.

..../uplPhoto(Pernr='1')/$value

What parameter will trigger create_stream? Is it must to add slug parameter?

Kindly help!

Regards,

S.Vikgnesh

AshwinDutt
Active Contributor
0 Kudos

Hello Vikgnesh,

Note - U need to define your model as Media-Type which is a must.

Please correct the URL.

Please see the below screen shot which shows how to fire a Craete_Stream to Upload an media content.

U need to send CSRF token as well and the headers shown below.

Regards,

Ashwin

0 Kudos

Hi Ashwin,

I defined my model as media type. But i am stuck due to virus scan profile settings. I passed the right URI. But i am getting the error as Incorrect configuration for profile '/SIHTTP/HTTP_DOWNLOAD/'.

Http method: POST

Requested URI: /sap/....../uplPhotoSet

Http request headers: Content-Type - image/png

                                    slug - cddpas.png

Response error - Incorrect configuration for profile /SIHTTP/HTTP_DOWNLOAD

Please find attached the error.

Regards,

S.Vikgnesh

AshwinDutt
Active Contributor
0 Kudos

Hello Vikgnesh,

U can test your operation by disabling virus scan in the SPRO setting but it is not advised to disable it.

U need to define profile for virus scan. As far as i know it should already been defined with a default one during the configuring GW systems.

But looking at the error i am not sure if its related to virus scan profile

Please have a look at the below discussion and see if something can help u here for this problem.

Regards,

Ashwin

ssuratharajan
Participant
0 Kudos

Hi Ashwin ,

Thanks for your Timely support ,And kudos to your wonderful explanation,

I finally found out the true concept of Virus scanning .

It seems that our Server does not Have a antivirus provider linked to the system

That is the reason we were getting a parameter error, Simple .

Anyhow , We require a Anti-Virus to be installed in our BI server to do this ,

Then we will have to worry about setting the parameter and then we will have to do post activities

Thus we can close the thread now.

Answers (1)

Answers (1)

former_member184867
Active Contributor
0 Kudos

Did you try with Advanced REST  client plugin in chrome ?

ssuratharajan
Participant
0 Kudos

It is not a browser Issue , BTW  the issue was resolved and it was just a bug , I had to restart the system. But now I am facing another error ,

  • Error Message at client: The specified HTTP method is not allowed for the resource identified by the Data Service Request URI

This occurs when we execute the gateway service after adding the file. This had been done through the Put Method.

ChandraMahajan
Active Contributor
0 Kudos

You need to use POST method.

Regards,

Chandra

ssuratharajan
Participant
0 Kudos

Dear Cheandrashekhar,

I tried the POST method and Im getting anther error unsupported media type .

I tried it with a txt file

"The server is refusing to process the request because the entity has a unsupported format"


If it is a error with the configuration ,Where should I go and correct this error ?



Thanks in advance.

Regards,

Suratharajan .S