You can get the String size using Xpath expression. Find the blow steps:
1. Assign the string value to the property.
2. Get the value using Xpath expression.
Find the below sample proxy.
After executing this proxy, you can see the length value in console:
1. Assign the string value to the property.
2. Get the value using Xpath expression.
fn:string-length(get-property('StringValue'))
Find the below sample proxy.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="Proxy1" startOnLoad="true" statistics="disable" trace="disable" transports="https,http"> <target> <inSequence> <property name="stringvalue" value="Colombo"/> <property expression="fn:string-length(get-property('stringvalue'))" name="string_length"/> <log level="custom"> <property expression="get-property('string_length')" name="Length"/> </log> </inSequence> </target> <description/> </proxy>
After executing this proxy, you can see the length value in console:
[2017-05-09 00:08:10,153] INFO - LogMediator Lenght = 7.0
No comments:
Post a Comment