Application Development 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: 

Get File with HTTP

Former Member
0 Kudos

Hello.

I am trying to get a file that is in a web server using HTTP protocol. The server is IIS and needs authentication, also, the url i give will redirect me to the url of the file i need to download.

How can this be done?

Thank you

Nuno Silva

1 ACCEPTED SOLUTION

anversha_s
Active Contributor
0 Kudos

hi nuno,

chk this

CL_HTTP_CLIENT

or u can use these function module - > HTTP_GET_FILE

rgds

anver

mark points if hlped

Message was edited by: Anversha s

12 REPLIES 12

anversha_s
Active Contributor
0 Kudos

hi nuno,

chk this

CL_HTTP_CLIENT

or u can use these function module - > HTTP_GET_FILE

rgds

anver

mark points if hlped

Message was edited by: Anversha s

0 Kudos

I'm trying the following code:

url = 'http://192.168.0.1/image.bmp'.

CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL

EXPORTING

URL = url

IMPORTING

CLIENT = http_client

EXCEPTIONS

ARGUMENT_NOT_FOUND = 1

PLUGIN_NOT_ACTIVE = 2

INTERNAL_ERROR = 3

others = 4.

IF SY-SUBRC = 0.

http_client->send( ).

http_client->receive( ).

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

http_client->close( ).

ENDIF.

When i try this i get a popup asking me for the username and password. I put the correct password and it wont work. After the third try it will just fail.

Any idea why does this fail?

Thank you

Nuno Silva

0 Kudos

can you have a close look at the pop up and tell us what user id pwd it is asking? is it proxy authentication or user id pwd of 'http://192.168.0.1?

Regards

Raja

0 Kudos

also since this is a image dont use

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

use

data: content type xstring.

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

Regards

Raja

0 Kudos

Its requesting the user and password from the iis server. It's a local address and i'm not using a proxy.

Thank you

Nuno Silva

0 Kudos

ok,add the following code to pass user id /pwd

call method cl_http_client=>create
  exporting
    host          = 'www.xxx.com'
    service       = '80'
    scheme        = '1'
  importing
    client        = http_client.

http_client->propertytype_logon_popup = http_client->co_disabled.

wf_user = user .
wf_password = password .

call method http_client->authenticate
  exporting
    username             = wf_user
    password             = wf_password.

Regards

Raja

0 Kudos

Hello.

I tried creating and testing an RFC HTTP connection thru SM59. It reacts the same way (asks for user and password and fails at the third time). Whan it fails it return error 401 and says the server is not prepared to receive the authorization headers i am sending.

I believe this is because the server is configures for NTLM authentication.

How can i do this?

Thank you

Nuno Silva

0 Kudos

Hello,

in case IIS is configured not to accept basic authentication HTTP_Client->authenticate will not work.

SAP WAS is not able to provide NTLM autentication when acting as HTTP-Client (at least for version 6.20/6.40).

However, we had the same requirement some month ago and we have implemented NTLM authentication.

If you´re still interested in this I can provide you this code.

Best regards,

Stefan

0 Kudos

Hello Stefan,

can you please provide us your NTLM authentication (solution) since we have the same problems here.

Thank you in advance,

Erhard

0 Kudos

Hello Stefan

Can you please provide us your NTLM authentication code?

Thanks,

Regards,

Anthony.

0 Kudos

Hi Stefan,

Would be great if you can share your approach. I am facing currently into same problems that I want to interface sharepoint and they only accept NTLMv2 protocol.

Regards

   Helmut

0 Kudos

Hello Stefan,

can you please post the NTLM authentication code ?

Had anyone here received an answer ?

Thank you in advance

Roman