Skip to Content
avatar image
Former Member

Get IP address of Remote System which is consuming SAP PI Web Service

Dear Experts

We have a scenario where third party system (remote system) is consuming web service which is hosted in SAP PI.

We need to got the IP address of third party system in message mapping so that we can perform some validation in SAP ECC.

Kindly suggest us some UDF (User Defined Function) in message mapping to get the IP of third party system. OR any other solution to validate the remote system IP in SAP PI or in ECC.

We are on SAP PI version 7.0

Trace level 2 is activated and we are able to see the remote system IP address in message log as shown in below screen shot.

Kindly note that we already test UDF described in link Get ip address from third-party system via UDF

Regards,

Iftikhar Ali

pi-remote-ip.jpg (280.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Nov 02, 2017 at 07:50 AM

    Hi Iftikhar!

    Use "Set Adapter-Specific Message Attributes" parameter in SOAP adapter's settings:

    In message mapping you can use UDF to get value from Dynamic configuration:

    public String getDynamicFileName(Container container) throws StreamTransformationException{
      String ipValue = "";
      try{ DynamicConfiguration config = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);  DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP", "SndrClientAddr"); ipValue = config.get(key1);
      }catch(Exception e){
        ipValue = "";
      }
      return ipValue;
    }

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 02, 2017 at 06:03 AM

    Hi,

    Can you open your ESR and then go to

    SAP BASIS -> SAP BASIS 7.00 -> http://sap.com/xi/XI/System -> Adapter Metadata -> SOAP and then search for the word "Dynamic Attributes"? It should give a list of the technical names supported in your system. For example, in my PI 7.11 system, here are the ones valid:

    and share your screenshot here?

    Regards,

    Mark

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Mark Dihiansan

      We shared the screen shot in new "Answers" tab. We were not able to attach multiple screen shots in comments section.

      Regards,

      Iftikhar Ali

  • avatar image
    Former Member
    Nov 03, 2017 at 05:11 AM

    Dear Mark Dihiansan

    Thanks for the reply.

    In SOAP sender communication channel, Adapter Specific Message Attribute is active. Unfortunatilly we cannot find Dynamic Configuration section in SOAP header from Message Monitory (SXMB_MONI). I am sharing you some screen shots:

    Regards,

    Iftikhar Ali

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member
      Same results after activating the Variable Transport Binding.

      I think there may be the problem with technical name of host. I am testing with "SndrClientAddr" and "SRemoteHost". Can you help us to find the technical host name in our system which is PI 7.0.

  • avatar image
    Former Member
    Apr 02 at 04:57 AM

    Dear Exerts, I am still unable to get the client IP in UDF. Currently I am doing following:

    In SOAP sender channel I checked both "Set Adapter Specific Message Aattributes" and "Variable Transport Binding".

    From ESR I found the dynamic attributes: "SRemoteHost" and namespace "http://sap.com/xi/XI/System" as shown in below screen shot:

    I create UDF in message mapping with following code:

    DynamicConfiguration dc = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); 
    
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/SOAP","SRemoteHost");String val = dc.get(key);if(val == null) val = "";return val;

    I am getting null in message mapping. Kindly suggest me the solution to get the client IP in message mapping. I am able to see the client IP in message monitory "SXI_MONITOR" at trace level "1" as shown in below screen shot:

    Regards,

    Iftikhar Ali

    Add comment
    10|10000 characters needed characters exceeded