Hi Raphael,
can you maybe explain/show us how you configured your XML query action so we can try to find the source of the error?
Thanks
Philipp
Hi
This is how my configuration looks like...
... and here is the result
Hi Raphael,
first of all I have to say that the "Run Now" doesn't always work as expected. Especially if your XPath isn't valid, the result will often show useless stuff (just my experience) e. g. the whole XML.
It seems like you have used the XPath builder for your XPath query. I tested this myself and could reproduce your problem. I also used another XPath generator with no success.
Additionally I created a little (dirty) XPath that should do the trick:
//*[local-name()="int"][1]
This works fine if you test it on this site: Free Online XPath Tester / Evaluator
but it doesn't work on the XML Query action in Nintex and I have no idea why. The XML Query action DOES work in general, I have used it many times. But it seems like some of the XML returned by the web services is just too messy even for the .NET framework itself.
I would really love to hear some Nintex dev or maybe a user who had some time to deep dive into this topic to tell us about the magic that is happening there.
Sorry I can't help you at the moment.
Cheers
Philipp
folowing XPath expression should work
/s:Envelope/s:Body/defaultNS:GetPersonIdListResponse/defaultNS:GetPersonIdListResult/a:Ids/b:int[1]
you have had doubled namespace specifications for Ids and int
HI
Thanks for your help.
Just to make sure I correctly understand you: To achieve the same result like you, I have to modify the XML as well, right?
The combination of my original XML and your XPath expression does not seem to work.
no, just use xpath I posted.
I copy-pasted your source XML as you posted it in original question with no change.
I've meant following namespace specification doubled in your xpath:
/s:Envelope/s:Body/defaultNS:GetPersonIdListResponse/defaultNS:GetPersonIdListResult/
defaultNS
:a:Ids/
defaultNS:
b:int[1]
do you test in run now or do you run whole workflow?
do you get any error?
And I copy-pasted your XPath Expression.
This is very odd. I get the same result if I run the whole workflow or test it in "run now" but not the single ID like in your screenshot.
how did you get the XML you posted in the question?
is it really the input of query XML action? I mean if you got it from run now in call webservice action or from some 3rd party tools it need not exactly be what inputs into query XML
I guess you supply a variable to the query XML action that holds the XML to be parsed.
try to send it to yourself by mail action (as plain text!) and compare it to before posted XML.
you may want as well to attach that output to this thread as text file to avoid some HTML formatting issues
Ok, will try that next. Thanks for your support so far.
Thanks a lot , your XPath is working for me as well!
However, the XPath builder returns the wrong XPath-expression and is not to be relied upon.
Cheers
Philipp
I as well do not have very good experiences with query builder and have compiled above xpath by hand.
but I've tested builder for this specific case and it seems it works correctly for me
& you guys are awesome! Had to run the workflow. "Run now" didn't show the correct result. Now it's working. Thanks for your support, appreciate it!
Hello All,
I'm trying to accomplish the same thing and having trouble parsing the XML to get the Employee ID. The value of the Employee ID is in the 90th 'PropertyData' node and my xpath is not working. Here is my xpath:
/soap:Envelope/soap:Body/defaultNS:GetUserProfileByNameResponse/defaultNS:GetUserProfileByNameResult/defaultNS:PropertyDatat4]/defaultNS:Values/defaultNS:ValueData/defaultNS:Value/@xsi:type
This is the XML from the Call Web Service:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetUserProfileByNameResponse xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">
<GetUserProfileByNameResult>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name></Name>
<Privacy></Privacy>
<Values>
<ValueData>
<Value xmlns:q1="http://microsoft.com/wsdl/types/" xsi:type="q1:guid"></Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>State</Name>
<Privacy>Public</Privacy>
<Values>
<ValueData>
<Value xsi:type="xsd:string"></Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>ZipCode</Name>
<Privacy>Public</Privacy>
<Values>
<ValueData>
<Value xsi:type="xsd:string"></Value>
</ValueData>
</Values>
</PropertyData>
<PropertyData>
<IsPrivacyChanged>false</IsPrivacyChanged>
<IsValueChanged>false</IsValueChanged>
<Name>employeeID</Name>
<Privacy>Private</Privacy>
<Values>
<ValueData>
<Value xsi:type="xsd:string">0987654</Value>
</ValueData>
</Values>
</PropertyData>
</GetUserProfileByNameResult>
</GetUserProfileByNameResponse>
</soap:Body>
</soap:Envelope>
Its the last PropertyData node and the value I'm trying to get is 0987654 from the employeeID node. The value I am getting with the XPath is 'xsd:sring'
with @xsi:type at the very end you asked for that attribute value, so you got it.
just remove it from your xpath, make sure 'Return result' is set to text and you should get what you need
Thanks for your quick response Marian,
I removed @xsi:type but got an error. However, I was able to get the value I need by modifying the xPath to the following:
/soap:Envelope/soap:Body/defaultNS:GetUserProfileByNameResponse/defaultNS:GetUserProfileByNameResult/defaultNS:PropertyDataa4]/defaultNS:Values/defaultNS:ValueData/defaultNS:**local-name()='Value']
Thanks for your help
it should work.
this is tested on your data
..../defaultNS:*[local-name()='Value'] and ..../defaultNS:Value selectors do the same