Skip to main content

Hi,

 

I am trying to expose an attribute from the _response_body returned from a http caller.

 

This is the response:

 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2022-11-24T11:20:34.572Z</u:Created><u:Expires>2022-11-24T11:25:34.572Z</u:Expires></u:Timestamp></o:Security></s:Header><s:Body><CreateWorksheetResponse xmlns="http://webservices.whitespacews.com/"><CreateWorksheetResult xmlns:a="http://webservices.whitespacews.com/API/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><CodeDescription>Success</CodeDescription><ErrorCode>0</ErrorCode><ErrorDescription>Success</ErrorDescription><SuccessFlag>true</SuccessFlag><a:WorksheetResponse xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><b:anyType i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">129283</b:anyType><b:anyType i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema"/></a:WorksheetResponse></CreateWorksheetResult></CreateWorksheetResponse></s:Body></s:Envelope>

 

In bold is what i would like to expose.

 

I have set the elements to match anyType and attributes to expose to anyType.

 

The problem is that it returns two rows as there is two anyType attributes. I only need the first one.

 

any ideas on how i can ignore the second one? im not sure what it is used for as its never had any data in it.

 

Thank you.

 

You can use a Tester and check that the attribute "anyType" has a value. You'll have to expose "anyType" in the XMLFragmenter first:

imageYou'll also have to enable flattening:

imageFollowed by:

image 


If you just need to get the value of that first element you could also use an XMLXQueryExtractor

declare namespace b='http://schemas.microsoft.com/2003/10/Serialization/Arrays';
//b:anyTypea1]/text()

imageThis should return the value 129283


If you just need to get the value of that first element you could also use an XMLXQueryExtractor

declare namespace b='http://schemas.microsoft.com/2003/10/Serialization/Arrays';
//b:anyTypea1]/text()

imageThis should return the value 129283

Thank you, this is exactly what i was looking for.


You can use a Tester and check that the attribute "anyType" has a value. You'll have to expose "anyType" in the XMLFragmenter first:

imageYou'll also have to enable flattening:

imageFollowed by:

image 

Thank you for the detailed response David. I ended up using the XMLXQueryExtractor in the end as if the httpcaller was to return an error it would mean that the first anyType would also be blank and i would not want to filter it out in that case as i do some error handling later on.


Reply