Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

IF_HTTP_CLIENT

Former Member
0 Likes
1,775

Hello.

I am trying to receive a file by HTTP. The file is in a server in the same network as SAP. This server uses IIS and requires authentication.

I am using the following piece of code:

DATA: url TYPE STRING,

http_client TYPE REF TO IF_HTTP_CLIENT,

return_code TYPE I,

content TYPE STRING.

url = 'http://192.168.0.1:6100/file.bmp'.

CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL

EXPORTING

URL = url

IMPORTING

CLIENT = http_client

http_client->send( ).

http_client->receive( ).

http_client->response->get_status( IMPORTING code = return_code ).

content = http_client->response->get_cdata( ).

http_client->close( ).

When i run the program i get a popup that asks for a login. I put in the correct login but it wont accept it (Note: The login includes a domain: domain\user) and after 3 times i get a 401 error from the server.

How can i authenticate in the iis server?

Thank you

Nuno Silva

3 REPLIES 3
Read only

Former Member
0 Likes
979

Anyone got any ideas on how to pass the authentication credentials?

Thank you

Nuno Silva

Read only

Former Member
0 Likes
979

try this:

call method http_client->request->set_authorization

EXPORTING

username = 'xyz'

password = 'xxx'.

Read only

Former Member
0 Likes
979

Hi Silva,

I have use the same thing thing in Different Way, Like..

We Don't have any http server . but as per our requirement we have to upload a file into SAP Daily a night 01.00 AM. We have tried this this thing with local PC in the same network but it will not work , Then we create a FTP server .

We have created our legecy system like that it's will donwnload the file in FTP server at 12.00. and SAP will catch from there.

hope it will be useful.

Thanks

Swati....