仅显示一种形式的请求和响应的文件

File displaying only one form of request and response

我正在生成一个文件,它应该从不同的 SOAP 请求步骤输出 2 个不同的请求和 2 个不同的响应,它们是:

TestRegion
TestRules

但是我注意到该文件只是生成 TestRegion 请求和响应,每次 2 次。对于每个请求,它显示 TestRegion 请求,对于每个响应,它显示 TestRegion 响应。为什么要这样做,我怎样才能得到正确的请求和响应来显示?它确实像 TESTREGION REQUEST: 一样正确显示硬编码字符串,然后在 TEST REGION RESPONSE 上显示正确,但请求和响应不正确。

def testRegionRequest = context.expand( '${${TestRegion}#Request}'  )
def testRegionResponse = context.expand( '${${TestRegion}#Response}'  )
def testRulesRequest = context.expand( '${${TestRules}#Request}'  )
def testRulesResponse = context.expand( '${${TestRules}#Response}'  )


def fileName = "XXX.txt"
def logFile = new File(fileName)

//Draws a line
def drawLine(def letter = '=', def count = 70) { letter.multiply(count)}

def testResult = new StringBuffer() 
testResult.append drawLine('-', 60) + "\n\n" 
testResult.append "\n\nTEST REGION REQUEST:\n\n" 
testResult.append(testRegionRequest.toString())
testResult.append "\n\n" + drawLine('-', 60) + "\n\n" 
testResult.append "\n\nTEST REGION RESPONSE:\n\n" 

testResult.append(testRegionResponse.toString())
testResult.append "\n\n" + drawLine('-', 60) + "\n\n" 
testResult.append "\n\nTEST RULES REQUEST:\n\n"
testResult.append(testRulesRequest.toString())
testResult.append "\n\n" + drawLine('-', 60) + "\n\n" 
testResult.append "\n\nTEST RULES RESPONSE:\n\n"
testResult.append(testRulesResponse.toString())

// Now create and record the result file
logFile.write(testResult.toString()) 

您在 context.expand

中使用的值似乎不正确

更改自:

${${SearchRegion}#Request}

收件人:

${SearchRegion#Request}

同样适用于其他属性。