Hello!
It sounds like you're on the right track with your XPath expression, but the SOAP response is adding XML tags around the IP, which is why you're seeing the <value xsi-type="soapenc:string">
tags in the output.
To get only the IP address without the extra tags, you could try modifying your approach in one of these ways:
-
Modify the XPath to retrieve only the text - Use //keyParam[key='userIP']/value/text()
in your XPath expression, if your tool or SOAP job processor supports it. This should return just the IP as text, without XML tags.
-
Post-process the variable - If you can't directly adjust the XPath, you might be able to use a string manipulation function in your SOAP job environment to strip out everything except the IP address from the variable's stored value.
Give these a try, and let us know how it works out!
Best of luck!
Original Message:
Sent: Oct 28, 2024 11:08 AM
From: kiran Kumar Vasanthavada
Subject: Need to print only IP address
Hello All,
I am working in use case where i am using an soap api-url for soap job. Inorder to get only Ip address from the soap api-url i am using the expression
//keyParam[key='userIP']/value for my xml request. So its working fine in Xpather.com able to get only IP, but where as in soap job level for xpath query where i am saving output into variable with above mentioned expression. Getting output as
Variable '&RETURN#' was stored with value '<value xsi-type="soapenc:string">1**.1**.2**.1**</value>'. . I am getting extra characters along with IP. I need only IP to get in the mentioned output. Can we remove extra characters and print only IP. IPS may get changed for every run and they may get in different ranges too.l Hope you got my query. Awaiting your replies.
Regards,
Kiran Kumar Vasanthavada.