Contributions
Getting NULL value when trying to trigger script assertion.
Trying to get value from XML response. But getting NULL value with script assertion passed. Script: import com.eviware.soapui.support.XmlHolder import javax.xml.XMLConstants import javax.xml.transform.stream.StreamSource import javax.xml.validation.SchemaFactory def holder = new XmlHolder( messageExchange.responseContentAsXml ) def val=holder.getNodeValue("//*:NDCMSG_Header//@Function") log.info(val) Response: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:NDCMSG_Envelope xmlns:ns2="http://dummy.aero/NDC/NDCUtility/v2"> <NDCMSG_Header> <Function>SOAPProject</Function> <SchemaType>SAMPLE</SchemaType> <SchemaVersion>2.0</SchemaVersion> <Recipient> <Address> <Company>SAMPLE</Company> <NDCSystemId>DEV</NDCSystemId> </Address> </Recipient> <Sender> <Address> <Company>SAMPLE</Company> <NDCSystemId>SAMPLE</NDCSystemId> </Address> </Sender> </NDCMSG_Header> <NDCMSG_Body> <NDCMSG_Payload> <Document> <Name>Sample Project</Name> <ReferenceVersion>3200</ReferenceVersion> </Document> <Success/> <DataLists> <PassengerList> <Passenger PassengerID="WJEUSGS-T1"> <PTC>ADT</PTC> </Passenger> </PassengerList> <FlightSegmentList> <FlightSegment SegmentKey="WERSDIL-SEGMENT-1"> <Departure> <AirportCode>MAA</AirportCode> <Date>2019-11-29</Date> <Time>14:30</Time> </Departure> <Arrival> <AirportCode>DEL</AirportCode> <Date>2019-11-29</Date> <Time>17:35</Time> </Arrival> <MarketingCarrier> <AirlineID>AB</AirlineID> <Name>Southwest Airlines</Name> <FlightNumber>100</FlightNumber> <ResBookDesigCode>C</ResBookDesigCode> </MarketingCarrier> <OperatingCarrier> <AirlineID>AB</AirlineID> <Name>Southwest Airlines</Name> </OperatingCarrier> <ClassOfService> <Code>C</Code> </ClassOfService> <FlightDetail> <FlightSegmentType>30</FlightSegmentType> <Stops> <StopQuantity>0</StopQuantity> </Stops> </FlightDetail> </FlightSegment> </FlightSegmentList> </DataLists> </OfferPriceRS> </NDCMSG_Payload> </NDCMSG_Body> </ns2:NDCMSG_Envelope> </soap:Body> </soap:Envelope> Trying to get value of Function. Please help to get one value from the response with help of groovy script.555Views0likes0Comments