I'm looking to do a transformation (xslt), but struggling to find the function to do what I'm trying.
We have an incoming request, which contains an alias. That alias is defined in DataPower (default domain > Network > Host Alias) as a host alias. What I have working is setting that alias (from the incoming request) as my routing url, the message then gets routed to the correct back end system.
What I want to do now is, when setting the routing url, I want to match the alias to the host alias name held in DataPower (they are both the same), get the matching IP address and then set the routing url to use the IP address.
The bit I'm struggling with is finding the dp function to get an IP address from the host alias, when the name is given.
Is this possible?
This topic has been locked.
6 replies Latest Post - 2012-11-27T17:13:22Z by swlinn
Pinned topic Replace Host Alias with IP address
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-11-27T17:13:22Z at 2012-11-27T17:13:22Z by swlinn
HermannSW 2700006U542818 PostsACCEPTED ANSWER
Re: Replace Host Alias with IP address2012-11-23T08:51:56Z in response to dp_rbOne question first:
Why do you want to replace the host alias by its IP in a stylesheet?
routing-url may contain an alias -- DataPower will resolve that alias when contacting the backend for you.
Re: Replace Host Alias with IP address2012-11-23T09:52:03Z in response to HermannSWIt works fine for using the host alias in the routing url, which we have been doing for all our back end systems. However, one of our back end systems does not accept the host alias, when testing, it only accepts IP addresses.
We think it maybe to do with the host field in the http header being populated with the alias, which cannot be resolved, but I also think resolving the alias and populating the routing url with the ip address will fix the problem.
kenhygh 120000PD1B792 PostsACCEPTED ANSWER
Re: Replace Host Alias with IP address2012-11-23T12:23:06Z in response to dp_rbCan I suggest something different? I typically use an XML lookup table for routing, something similar to what's described in the DataPower Handbook (http://books.google.com/books?id=acullmuy8zEC&pg=PT1051&lpg=PT1051&dq=datapower+%22routing+xml%22+rasmussen&source=bl&ots=OEHVwjNkVE&sig=cYw8K35zBv67g1T6olwyfdfqMGY&hl=en&sa=X&ei=r2avUL-zJIWu8AS-sIDwDg&ved=0CFIQ6AEwBQ)
This kind of thing can be used across multiple dev/test/prod environments cleanly, you can put into such a table either DNS names or IP addresses, whatever you want.
Re: Replace Host Alias with IP address2012-11-23T15:48:25Z in response to kenhyghHi Ken,
Thanks for the suggestion, although that solution would work, I'd prefer not to go down that route, considering that the IP address's are already stored in the host alias and I didn't want to have anything duplicated.
swlinn 100000E7QE1327 PostsACCEPTED ANSWER
Re: Replace Host Alias with IP address2012-11-27T17:13:22Z in response to dp_rbThis would be the only way to get configuration for your use within a processing stylesheet. Also as I am just catching up on the forum after some time away, please note that the best practice is to use host aliases for DataPower local addresses ONLY. If you have backend servers you wish to associate a name to an IP, that is technically a DNS static host entry. Functionally they are the same as far as resolving the IP in a URL, but when you have a front side handler for example that has a local address field, you get to choose from a list of host aliases, and off box IPs don't apply. I concur with Ken, it is a very common practice to use a routing table. You can keep your static dns entries in DataPower and have the table map some criteria to the static dns name, and DataPower will get the proper IP.