cancel
Showing results for 
Search instead for 
Did you mean: 
rbachmann
Nintex Newbie

Unable to parse XML

Jump to solution

Hi,

I query a custom Web Service in Nintex Workflow 2013 and get the following XML.

Somehow, I can't parse it using the Query XML Action. As a result, I get the orignal XML data back.

Can anybody help me out?

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 <s:Body>
  <GetPersonIdListResponse xmlns="http://tempuri.org/">
   <GetPersonIdListResult xmlns:a="http://schemas.datacontract.org/2004/07/xyz" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <a:Error>_NoError</a:Error>
    <a:ErrorMessage/>
    <a:Result>true</a:Result>
    <a:Count>4</a:Count>
    <a:Ids xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
     <b:int>100108</b:int>
     <b:int>100123</b:int>
     <b:int>100375</b:int>
     <b:int>103741</b:int>
    </a:Ids>
    <aSmiley Surprisedbjekt>Person</aSmiley Surprisedbjekt>
    <aSmiley FrustratedqlCommand>SELECT DISTINCT P.PERSONID FROM PERSON P INNER JOIN PERSONORG PO ON PO.PERSONID=P.PERSONID INNER JOIN ORGEINHEIT O ON O.ORGEINHEITID=PO.ORGEINHEITID INNER JOIN KOSTENSTELLE K ON K.KOSTENSTELLE_PKEY=O.KOSTENSTELLE_FKEY  WHERE K.KREIS LIKE '501' AND P.MODIFYDATE&gt;=TO_DATE('2015.08.12 00:00:00', 'yyyy/mm/dd hh24:mi:ss') AND P.MODIFYDATE&lt;TO_DATE('2016.08.10 00:00:00', 'yyyy/mm/dd hh24:mi:ss') ORDER BY 1</aSmiley FrustratedqlCommand>
    <aSmiley FrustratedtrIds xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
   </GetPersonIdListResult>
  </GetPersonIdListResponse>
 </s:Body>
</s:Envelope>

0 Kudos
Reply
16 Replies
Automation Master
Automation Master

Re: Unable to parse XML

Jump to solution

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

0 Kudos
Reply
rbachmann
Nintex Newbie

Re: Unable to parse XML

Jump to solution

Hi

This is how my configuration looks like...

... and here is the result

0 Kudos
Reply
Automation Master
Automation Master

Re: Unable to parse XML

Jump to solution

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

0 Kudos
Reply
Automation Master
Automation Master

Re: Unable to parse XML

Jump to solution

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

View solution in original post

0 Kudos
Reply
rbachmann
Nintex Newbie

Re: Unable to parse XML

Jump to solution

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.

0 Kudos
Reply
Automation Master
Automation Master

Re: Unable to parse XML

Jump to solution

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?

0 Kudos
Reply
rbachmann
Nintex Newbie

Re: Unable to parse XML

Jump to solution

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.

0 Kudos
Reply
Automation Master
Automation Master

Re: Unable to parse XML

Jump to solution

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

0 Kudos
Reply
rbachmann
Nintex Newbie

Re: Unable to parse XML

Jump to solution

Ok, will try that next. Thanks for your support so far. 

0 Kudos
Reply