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: 

Need to suppress the authentication popup while consuming external web service in sap abap

Former Member
0 Kudos

Hi Experts,

While am trying to consume the external system web service,system always prompting the Authentication Pop up for User name and Password,

even am setting the password using the method authentication.

As the third party system instructions, user name and password should be encoded into base64(UTF8) format and need to set the value as header 'Authorization'.

The same is working,while using from c#,but in the sap abap even passing the converted user and password for the header 'Authorization'

still Authentication Pop up is raising at the time of calling receive method.

Please give me the suggestions to suppress the dialog popup.

Code Snippet used for authentication:

CALL METHOD cl_http_client=>create_by_url

     EXPORTING

       url                = lv_url

       ssl_id             = 'ABCDE'

     IMPORTING

       client             = lr_client

     EXCEPTIONS

       argument_not_found = 1

       plugin_not_active  = 2

       internal_error     = 3

       OTHERS             = 4.



CONCATENATE 'agc' ':' 'XXXXXXXXXXXX' INTO logon.

   logon_b64 = l_utility->encode_base64( logon ).

   CONCATENATE 'Basic' logon_b64 INTO logon_b64              "#EC NOTEXT

      SEPARATED BY space.

   CALL METHOD lr_client->request->set_header_field

     EXPORTING

       name  = 'Authorization'                               "#EC NOTEXT

       value = logon_b64.

CALL METHOD lr_client->request->set_method( 'GET' ).


"Calling the Webservice

   CALL METHOD lr_client->send

     EXPORTING

       timeout                    = 200

     EXCEPTIONS

       http_communication_failure = 1

       http_invalid_state         = 2

       http_processing_failed     = 3

       OTHERS                     = 4.

   "Receive the Responce from the Web Service

   CALL METHOD lr_client->receive

     EXCEPTIONS

       http_communication_failure = 1

       http_invalid_state         = 2

       http_processing_failed     = 3.

   "Read HTTP RETURN CODE

   CALL METHOD lr_client->response->get_status

     IMPORTING

       code   = lv_http_status

       reason = lv_status_text.


Thanks and Regards.

Y. Ravi Kumar.




1 REPLY 1

larshp
Active Contributor

Set propertytype_logon_popup to disabled,

DATA: lo_client TYPE REF TO if_http_client.

cl_http_client=>create_by_url(

  EXPORTING

    url    = 'http://securesite'

  IMPORTING

    client = lo_client ).

lo_client->propertytype_logon_popup = if_http_client=>co_disabled.