max1965
13 years agoContributor
extract value from xml
I try to apply the suggestion that I have from the forum to the following XML response, but I'm not able to extract the interested value.
First case:
I need to extract the result value (pending) from the following response:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns2:requestResponse xmlns:ns2="http://tempuri.org/provisioning.xsd">
<outputMsg><spml:statusResponse xmlns:spml='urn:oasis:names:tc:SPML:1:0'
xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' requestID='IDM-20130307092850677'
result='urn:oasis:names:tc:SPML:1:0#pending'>
</spml:statusResponse></outputMsg>
</ns2:requestResponse>
</env:Body>
</env:Envelope>
Second case:
I need to extract the errorCode value (1000) to the following response:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns2:requestResponse xmlns:ns2="http://tempuri.org/provisioning.xsd">
<outputMsg><![CDATA[<spml:statusResponse xmlns:spml='urn:oasis:names:tc:SPML:1:0'
xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' requestID='IDM-20130307092850677'
result='urn:oasis:names:tc:SPML:1:0#success'>
<spml:searchResponse requestID='IDM-20130307092850677'
result='urn:oasis:names:tc:SPML:1:0#success'>
<spml:operationalAttributes>
<dsml:attr name='errorCode'>
<dsml:value>1000</dsml:value>
</dsml:attr>
<dsml:attr name='errorMessage'>
<dsml:value>The operation is successfully completed</dsml:value>
</dsml:attr>
</spml:operationalAttributes>
<spml:searchResultEntry>
<spml:identifier type='urn:oasis:names:tc:SPML:1:0#GUID'>
<spml:id>00498800</spml:id>
</spml:identifier>
<spml:attributes>
<dsml:attr name='accessState'>
<dsml:value>0</dsml:value>
</dsml:attr>
<dsml:attr name='surname'>
<dsml:value>TERMINI</dsml:value>
</dsml:attr>
<dsml:attr name='metaFunctionalProfileDomain'>
<dsml:value>PR2HIGH@MS</dsml:value>
</dsml:attr>
<dsml:attr name='userProfile'>
<dsml:value>default</dsml:value>
</dsml:attr>
<dsml:attr name='strongAuth'>
<dsml:value>Y</dsml:value>
</dsml:attr>
<dsml:attr name='userType'>
<dsml:value>0</dsml:value>
</dsml:attr>
<dsml:attr name='password'>
<dsml:value>UMc7Czl6/1eZE</dsml:value>
</dsml:attr>
<dsml:attr name='container'>
<dsml:value>MS</dsml:value>
</dsml:attr>
<dsml:attr name='employeeId'>
<dsml:value>00498800</dsml:value>
</dsml:attr>
<dsml:attr name='administrativeState'>
<dsml:value>Active</dsml:value>
</dsml:attr>
</spml:attributes>
</spml:searchResultEntry>
</spml:searchResponse>
</spml:statusResponse>]]></outputMsg>
</ns2:requestResponse>
</env:Body>
</env:Envelope>
Someone could help me ? Thanls.
First case:
I need to extract the result value (pending) from the following response:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns2:requestResponse xmlns:ns2="http://tempuri.org/provisioning.xsd">
<outputMsg><spml:statusResponse xmlns:spml='urn:oasis:names:tc:SPML:1:0'
xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' requestID='IDM-20130307092850677'
result='urn:oasis:names:tc:SPML:1:0#pending'>
</spml:statusResponse></outputMsg>
</ns2:requestResponse>
</env:Body>
</env:Envelope>
Second case:
I need to extract the errorCode value (1000) to the following response:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns2:requestResponse xmlns:ns2="http://tempuri.org/provisioning.xsd">
<outputMsg><![CDATA[<spml:statusResponse xmlns:spml='urn:oasis:names:tc:SPML:1:0'
xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' requestID='IDM-20130307092850677'
result='urn:oasis:names:tc:SPML:1:0#success'>
<spml:searchResponse requestID='IDM-20130307092850677'
result='urn:oasis:names:tc:SPML:1:0#success'>
<spml:operationalAttributes>
<dsml:attr name='errorCode'>
<dsml:value>1000</dsml:value>
</dsml:attr>
<dsml:attr name='errorMessage'>
<dsml:value>The operation is successfully completed</dsml:value>
</dsml:attr>
</spml:operationalAttributes>
<spml:searchResultEntry>
<spml:identifier type='urn:oasis:names:tc:SPML:1:0#GUID'>
<spml:id>00498800</spml:id>
</spml:identifier>
<spml:attributes>
<dsml:attr name='accessState'>
<dsml:value>0</dsml:value>
</dsml:attr>
<dsml:attr name='surname'>
<dsml:value>TERMINI</dsml:value>
</dsml:attr>
<dsml:attr name='metaFunctionalProfileDomain'>
<dsml:value>PR2HIGH@MS</dsml:value>
</dsml:attr>
<dsml:attr name='userProfile'>
<dsml:value>default</dsml:value>
</dsml:attr>
<dsml:attr name='strongAuth'>
<dsml:value>Y</dsml:value>
</dsml:attr>
<dsml:attr name='userType'>
<dsml:value>0</dsml:value>
</dsml:attr>
<dsml:attr name='password'>
<dsml:value>UMc7Czl6/1eZE</dsml:value>
</dsml:attr>
<dsml:attr name='container'>
<dsml:value>MS</dsml:value>
</dsml:attr>
<dsml:attr name='employeeId'>
<dsml:value>00498800</dsml:value>
</dsml:attr>
<dsml:attr name='administrativeState'>
<dsml:value>Active</dsml:value>
</dsml:attr>
</spml:attributes>
</spml:searchResultEntry>
</spml:searchResponse>
</spml:statusResponse>]]></outputMsg>
</ns2:requestResponse>
</env:Body>
</env:Envelope>
Someone could help me ? Thanls.