Hi All,
I need to extract namespace from a node to perform further operations. My XML is something like shown below.
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header>...</SOAP-ENV:Header> <SOAP-ENV:Body> <CreateAndSendEnvelope xmlns="http://www.docusign.net/API/3.0">....</CreateAndSendEnvelope> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
I need to extract namespace of CreateAndSendEnvelope node.
I used extract variable policy as shown below.
<XMLPayload> <Namespaces> <Namespace prefix="dir">http://schemas.xmlsoap.org/soap/envelope</Namespace> </Namespaces> <Variable name="operationname" type="string"> <XPath>/dir:Envelope/dir:Body/CreateAndSendEnvelope/@xmlns</XPath> </Variable> </XMLPayload>
Any help would be appreciated,
Thankyou
Solved! Go to Solution.
Namespaces in XML are very specific. The namespace often looks like a web URI, and we may assume that
is equivalent to
http://foo/bar (no trailing slash)
But that is not the case, when dealing with XML namespaces.
Specific to your case, you have
<Namespaces> <Namespace prefix="dir">http://schemas.xmlsoap.org/soap/envelope</Namespace> </Namespaces>
And that's not good. The namespace you want ends with a slash.
Add the trailing slash:
<Namespaces> <Namespace prefix="dir">http://schemas.xmlsoap.org/soap/envelope/</Namespace> </Namespaces>
But, two additional things.
The result of these three changes like this:
<XMLPayload> <Namespaces> <!-- note the trailing slash here --> <Namespace prefix="s">http://schemas.xmlsoap.org/soap/envelope/</Namespace> </Namespaces> <Variable name="operationname" type="string"> <XPath>local-name(/s:Envelope/s:Body/*)</XPath> </Variable> <Variable name="xmlns" type="string"> <XPath>namespace-uri(/s:Envelope/s:Body/*)</XPath> </Variable> </XMLPayload>
Hi,
Can u try with this line:
<Namespaces> <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/encoding/</Namespace> </Namespaces> <Variable name="CreateAndSendEnvelope" type="string"> <XPath>/soapenv:Envelope/soapenv:Header/soapenv:Header:Body/CreateAndSendEnvelope</XPath> </Variable>
No, that's not it.
hi, I can guess what the problem is, but YOU DIDN'T SAY IT.
You said "I need to extract namespace of CreateAndSendEnvelope node."
and "this is the policy I used"
and...
WHAT HAPPENED? What results did you see?
You didn't say.
I will have to guess. I guess that you didn't get the data extracted as you expected. Is that right?
Hi,
yes, I am unable to extract the value. operationname variable is Null
Namespaces in XML are very specific. The namespace often looks like a web URI, and we may assume that
is equivalent to
http://foo/bar (no trailing slash)
But that is not the case, when dealing with XML namespaces.
Specific to your case, you have
<Namespaces> <Namespace prefix="dir">http://schemas.xmlsoap.org/soap/envelope</Namespace> </Namespaces>
And that's not good. The namespace you want ends with a slash.
Add the trailing slash:
<Namespaces> <Namespace prefix="dir">http://schemas.xmlsoap.org/soap/envelope/</Namespace> </Namespaces>
But, two additional things.
The result of these three changes like this:
<XMLPayload> <Namespaces> <!-- note the trailing slash here --> <Namespace prefix="s">http://schemas.xmlsoap.org/soap/envelope/</Namespace> </Namespaces> <Variable name="operationname" type="string"> <XPath>local-name(/s:Envelope/s:Body/*)</XPath> </Variable> <Variable name="xmlns" type="string"> <XPath>namespace-uri(/s:Envelope/s:Body/*)</XPath> </Variable> </XMLPayload>
Thank you it worked !!!
User | Count |
---|---|
7 | |
2 | |
2 | |
1 | |
1 |