cancel
Showing results for 
Search instead for 
Did you mean: 

Getting null value from holder.getNodeValue while the properties has value in it.

SOLVED
Occasional Contributor

Getting null value from holder.getNodeValue while the properties has value in it.

Error at assertion: Incorrect Service Type. Expression: (ServiceTypeResponse == ServiceTypeExcel). Values: ServiceTypeResponse = null, ServiceTypeExcel = Air

 

Namespace ns2 is correctly defined.

 

This is the complete groovyscript.

 

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder(messageExchange.getResponseContent())
def namespace = holder.declareNamespace('ns2', "http://sita.aero/iborders/external/EventServiceWSDLTypes/V12")
def ServiceTypeResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ExpectedService/ServiceType")
def ServiceCodeResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ExpectedService/ServiceCode")
def ServiceNumberResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ExpectedService/ServiceNumber")
def ServiceRouteResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ServiceRoute")
def DeparturePortResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/DeparturePort")
def ArrivalPortResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ArrivalPort")
def GenderResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/Gender")
def TravelDocumentTypeResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/TravelDocument/Type")
def TravelDocumentNumberResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/TravelDocument/Number")
def TravelDocumentIssueCountryResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/TravelDocument/IssueCountry")
def SuccessResponse = holder.getNodeValue("//ns2Smiley FrustratedearchExpectedMovementsResponse//ns2:ReturnCode/Type")

def ServiceTypeExcel = context.expand('${Properties#ServiceType}')
def ServiceCodeExcel = context.expand( '${Properties#ServiceCode}' )
def ServiceNumberExcel = context.expand( '${Properties#ServiceNumber}' )
def ServiceRouteExcel = context.expand( '${Properties#ServiceRoute}' )
def DeparturePortExcel = context.expand( '${Properties#DeparturePort}' )
def ArrivalPortExcel = context.expand( '${Properties#ArrivalPort}' )
def GenderExcel = context.expand( '${Properties#Gender}' )
def TravelDocumentTypeExcel = context.expand( '${Properties#DocumentType}' )
def TravelDocumentNumberExcel = context.expand( '${Properties#DocumentNumber}' )
def TravelDocumentIssueCountryExcel = context.expand( '${Properties#DocumentIssueCountry}' )

assert(ServiceTypeResponse == ServiceTypeExcel): "Incorrect Service Type"
assert(ServiceCodeResponse == ServiceCodeExcel): "Incorrect Service Code"
assert(ServiceNumberResponse == ServiceNumberExcel): "Incorrect Service Number"
assert(ServiceRouteResponse == ServiceRouteExcel): "Incorrect Service Route"
assert(DeparturePortResponse == DeparturePortExcel): "Incorrect Departure Port"
assert(ArrivalPortResponse == ArrivalPortExcel): "Incorrect Arrival Port"
assert(GenderResponse == GenderExcel): "Incorrect Gender"
assert(TravelDocumentTypeResponse == TravelDocumentTypeExcel): "Incorrect Travel Document Type"
assert(TravelDocumentNumberResponse == TravelDocumentNumberExcel): "Incorrect Travel Document Number"
assert(TravelDocumentIssueCountryResponse == TravelDocumentIssueCountryExcel): "Incorrect Travel Document Issue Country"
assert(SuccessResponse == "Success"): "Success Not Present in Response"

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Leader

Re: Getting null value from holder.getNodeValue while the properties has value in it.

hi @pankajmalinda

 

ServiceTypeResponse is not getting data from your response. Update it and it will work fine

 

Do like if you find it as solution!!

 

Thanks,

Himanshu


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
2 REPLIES 2
Community Leader

Re: Getting null value from holder.getNodeValue while the properties has value in it.

hi @pankajmalinda

 

ServiceTypeResponse is not getting data from your response. Update it and it will work fine

 

Do like if you find it as solution!!

 

Thanks,

Himanshu


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
Contributor

Re: Getting null value from holder.getNodeValue while the properties has value in it.

Hi,

If you post your xml then would be better to figure out your failure. It seems you input a wrong xpath expression. Please check

New Here?
Join us and watch the welcome video:
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win