I am trying to use a variable instead of hardcoding the namespace value inside the ExtractVariable policy for XML/SOAP payload. But it seems to not work. Am i missing something or is this functionality not available currently?
This is working fine. But i want to pass a variable instead of hardcoding “http://schemas.xmlsoap.org/soap/envelope/” just in case it changes in the future. I am just providing this namespace as example. I will have multiple namespaces.
<Namespaces>
<Namespace prefix="soap">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
</Namespaces>
Below is what i want to do. I tried using ref also but no luck
<Namespaces>
<Namespace prefix="soap">{namespace1}</Namespace>
</Namespaces>
1 Like
I don’t think you can do that with ExtractVariables.
But maybe there is a workaround. There is an xpath function available in the Message Template, which you can use to extract data.
You would use dynamic namespaces like this:
<AssignMessage name='AM-Extract'>
<AssignVariable>
<Name>ns1</Name>
<!-- prefix:namespace -->
<Template>ns1:{actual_namespace_here}</Template>
</AssignVariable>
<AssignVariable>
<Name>soap</Name>
<!-- this one is hard-coded -->
<Value>s:http://schemas.xmlsoap.org/soap/envelope/</Value>
</AssignVariable>
<AssignVariable>
<Name>path1</Name>
<Value>/s:Envelope/s:Body/ns1:getIDPListRequest/ns1:IDP/text()</Value>
</AssignVariable>
<AssignVariable>
<Name>extracted</Name>
<!--
pass arguments to the xpath function as _variables_:
1: query
2: xml document (eg, maybe request.content)
3...n : namespace specifiers, if any
Do not insert spaces between the variable names or parens!
-->
<Template>{xpath(path1,xml,soap,ns1)}</Template>
</AssignVariable>
</AssignMessage>