Check for presence of an element in soap body

icims-integration-rev2-2018-04-19.zipThe SOAP request am receiving is as follows

<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <soap:Body> <GetUserAvailabilityRequest xmlns:getuser="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <t:TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> <Bias>480</Bias> <StandardTime> <Bias>0</Bias> <Time>02:00:00</Time> <DayOrder>5</DayOrder> <Month>10</Month> <DayOfWeek>Sunday</DayOfWeek> </StandardTime> <DaylightTime> <Bias>-60</Bias> <Time>02:00:00</Time> <DayOrder>1</DayOrder> <Month>4</Month> <DayOfWeek>Sunday</DayOfWeek> </DaylightTime> </t:TimeZone> <MailboxDataArray> <t:MailboxData> <t:Email> <t:Address>user1@example.com</t:Address> </t:Email> <t:AttendeeType>Required</t:AttendeeType> <t:ExcludeConflicts>false</t:ExcludeConflicts> </t:MailboxData> <t:MailboxData> <t:Email> <t:Address>user2@example.com</t:Address> </t:Email> <t:AttendeeType>Required</t:AttendeeType> <t:ExcludeConflicts>false</t:ExcludeConflicts> </t:MailboxData> </MailboxDataArray> <t:FreeBusyViewOptions> <t:TimeWindow> <t:StartTime>2006-10-16T00:00:00</t:StartTime> <t:EndTime>2006-10-16T23:59:59</t:EndTime> </t:TimeWindow> <t:MergedFreeBusyIntervalInMinutes>60</t:MergedFreeBusyIntervalInMinutes> <t:RequestedView>DetailedMerged</t:RequestedView> </t:FreeBusyViewOptions> </GetUserAvailabilityRequest> </soap:Body> </soap:Envelope>

How do i check for the presence of "GetUserAvailabilityRequest" element in the request. I have tried using both extract variables and message validation policies to no avail

The xpath i used is /soap:Envelope[@xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"]/soap:Body/GetUserAvailabilityRequest[@xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"]

The proxy is attached as well

Thanks,

Vednath

Solved Solved
0 1 391
1 ACCEPTED SOLUTION

There's something not quite right with the XML you're receiving. The GetUserAvailability element doesn't have a namespace alias and there's no default namespace declared either.

A way to get that element just by its name (regardless of namespaces) is to use the XPath expression

//*[local-name()='GetUserAvailabilityRequest']

Finally, a standard XPath trick to test for the presence of an element is to use the count() function, and then test whether its value is greater than 0.

You could use the following XPath expression in your extract variables policy

count(//*[local-name()='GetUserAvailabilityRequest'])

and then check wheter the variable is greater than 0

View solution in original post

1 REPLY 1

There's something not quite right with the XML you're receiving. The GetUserAvailability element doesn't have a namespace alias and there's no default namespace declared either.

A way to get that element just by its name (regardless of namespaces) is to use the XPath expression

//*[local-name()='GetUserAvailabilityRequest']

Finally, a standard XPath trick to test for the presence of an element is to use the count() function, and then test whether its value is greater than 0.

You could use the following XPath expression in your extract variables policy

count(//*[local-name()='GetUserAvailabilityRequest'])

and then check wheter the variable is greater than 0