Deserialize XML from SOAP output

ensure UiPath.Web.Activities is referenced via Dependency Manager
Process Looks like this:

@bcorrea. Like Dave said, this seems like the way to go but I am lost. Do you mean replace by “” in an assign operation?

no, as i said, you need to remove starting from/to xmls…Vendor’

sorry was interupted in quick answering. now its done:
XAML is provided
Short explanation is completed.

Happy Automation :+1:

Bruno, I think you mean like this? I get an error (I think because of the double quotes?)…sorry

yes, you want your root to be

> <GetPODetailResponse>

, for the quotes, add one more in each side

@bcorrea. I got the quotes figured out. and am getting output:

Now add a .Attribute(“price”).Value i guess…

@bcorrea Attribute is not available

Element is to use

1 Like

@ppr. I tried element…but no :frowning:

have a look on my xaml here you can find the part. FirstNode is blocking you, thats why it is not in intellisense

will easier like this:

1 Like

As an Alternate: Price value retrieval within an assign:

xDoc.Descendants(ns2 + “price”).First().Value.ToString in namespace case
xDoc.Descendants(“price”).First().Value.ToString without namespace case

1 Like

I encourage you to keep trying out all these solutions because there are many ways to solve every problem. I’ve noticed especially with XML navigation there are many ways to go about it. Here are 2 ways to get to the value you want based on the XML you uploaded earlier.

Step 1: Read the xml file as text
Step 2: Deserialize to an Xdocument
Step 3: Assign XNamespaces - this is done as 2 assigns because there are 2 namespaces being used to get to the value you want. Assign ns1 = "" and assign ns2 = ""
Step 4: Extract the value from the XML. This is where there are many different approaches you can take. If you want to navigate down the tree one by one it would look like this: Assign YourValue = XMLdoc.Root.Element(ns1 + "Body").Element(ns2 + "GetPODetailResponse").Element(ns2 + "GetPODetailResult").Element(ns2 + "PODetail").Element(ns2 + "PODetail").Element(ns2 + "price").Value

As you can see this is quite long. You can shorten it up by looking at the XML structure and making assumptions. I will assume that you always want to get the first price, from the first PODetail. With that assumption in place you can just use a single Descendants.FirstOrDefault statement to extract the value which is much shorter and works in this specific case:

Assign YourValue = XMLdoc.Descendants(ns2 + "price").FirstOrDefault().Value

EDIT: @jaspreet1003 Here is an .XAML showing both of the solutions Child1.xaml (7.1 KB)


back to same error. ah man!

@Dave. Thanks a ton Dave!! I will take a look at these.

Its showing missing activity…can you please send me a screenshot of the missing activity?

Sorry, never mind. I figured it out. Its the deserialize activity. For some reason, the web activities keeps uninstalling itself…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.