Skip to Content

Authentication error when using CL_HTTP_CLIENT

Hi all,

I'm using an instruction from the blog of Thomas Jung to get an image from the content server into the cache of the ICM framework. See this [blog Thomas Jung|;jsessionid=(J2EE3417200)ID0623211050DB12910368107152505592End?blog=/pub/wlg/1012].

See also this thread: [Approach content repository other way then URL approach| content repository other way then URL approach]

At the point where I want to receive the response I currently get a popup where I'm asked to logon. Probably logon to the contentserver. I get this logon when the authentication on the content server is swithed on. Evwerything works fine when this authentication is switched off.

I want to know how I can set this authentication in my instance of CL_HTTP_CLIENT in order to make the receive of the image working fine.

Has anybody ever faced the same issue?



Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Oct 20, 2009 at 02:42 PM

    You have two choices.

    1. You can feed the authentication into the CL_HTTP_CLIENT instance using the authenticate method:

    call method cl_http_client=>create
          host               = me->ls_login_info-url
          service            = me->c_http_service_port
          scheme             = cl_http_client=>schemetype_http
          client             = me->http_client
          argument_not_found = 1
          plugin_not_active  = 2
          internal_error     = 3
          others             = 4.
       me->http_client->propertytype_logon_popup = me->http_client->co_disabled.
        data l_username type string.
        data l_password type string.
        l_username = 'MyUser'
        l_password = 'MyPassword'.
        call method me->http_client->authenticate
            username             = l_username
            password             = l_password.

    2. Second option is to use HTTP destinations from SM59. This is a bit more managable since the password is maintained in the SM59 configuration and encrypted for you.

          destination              = c_destination    " Logical destination (specified in function call)
          client                   = r_api->http_client  " HTTP Client Abstraction
          argument_not_found       = 1
          destination_not_found    = 2
          destination_no_authority = 3
          plugin_not_active        = 4
          internal_error           = 5
          others                   = 6 ).

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Thomas,

      Me problem is solved now. In constantly faced some "orgnizational hurdles" when trying to get credentials for creating an RFC (to put it delicately). But I found another way of creating the URL to the contentserver. Via the service sap/bc/contentserver/ I concatenate a URL as follows:

       CONCATENATE 'http://' sy-host 'domain:port/sap/bc/contentserver/' sy-mandt '?' 

      After that I finish the rest of the URL by concatenating the pointer to the document after the ? in the above URL.

      The I create the http_client as you described in your blog via the create_by_url, followed by all the other steps.

      To use the service "contentsever" in SICF as described above, you need to create an external alias in SICFwhere you specify the logon data based upon a systemuser.

      Thanks for thinking with me!



      P.S. Enjoyed your session in Vienna about new WD4A functionality...very nice stuff coming up!!! Didn't talk to you anymore...maybe next time.