简体   繁体   中英

Standard way to map a URL string to RFC Destination in ABAP?

In SAP (AS ABAP 7.4) I have configured a set of RFC Destinations (Transaction SM59), including an SSL configuration using a client certificate for authentication at the service.

Say, one of these RFC Destinations goes to: myserver:443 and myserver requieres SSL client certificate authentication.

In my ABAP class I am given an arbitrary URL such as https://myserver:443/my/ressouce.xml

I am using CL_HTTP_CLIENT to fetch the ressource, but as far as I can see, there is no way to initialize the HTTP client in a way that it uses the correct SSL client certificate, except passing the appropriate RFC Destination using CL_HTTP_CLIENT.CREATE_BY_DESTINATION

To achieve this, one can manually read/parse the SAPs RFCDST table and map the given URL to the correct RFC destination.

My question is if there is a better way in SAP (eg a standard SAP function) than this manual approach?

The only viable way appears to be:

  • "Manually" select the destination names from RFCDES with RFCTYPE = IF_DEST_ROOT~CO_TYPE_HTTP_EXT
  • Parse the settings of each destination using RFC_READ_HTTP_DESTINATION
  • Compare the values against the given URL - you will have to strip some part from either side, so that would have to be be custom code anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM