How to get client IP Address in BPEL Component

How to get client IP Address in BPEL Component. This question has popped up few times in Oracle Forums and hence thought of blogging about it.

Requirement

When we develop services that are exposed to other clients, there might be requirements where the IP address of the caller of services to be captured and logged for auditing purposes.As part of this blog, we will see how to capture the IP address in BPEL & Mediator component.

 

Solution

A property named “transport.http.remoteAddress” holds the IP address of the caller. Let us see how to copy the value from this property to a variable in BPEL and Mediation component.

 

In BPEL Component

As part of the BPEL component, create a variable to hold IP address.

In the “Receive” activity, go to “Properties” tab. Locate “transpost.http.remoteAddress” property and assign it to a variable.

transport.http.remoteAddress

In Mediator Component

In the routing rule , select “Assign Values” and assign value of “transport.http.remoteAddress” to a variable.

transport.http.remoteAddress

Leave a Reply

Your email address will not be published. Required fields are marked *