我的问题与另一个现有问题类似(对此感到抱歉),但有一些不同......我的 XML 输入具有字符串格式:
* def token = '123456'
* def payload =
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.com">
<soapenv:Header/>
<soapenv:Body>
<ws:isValid>
<token>#(token)</token>
</ws:isValid>
</soapenv:Body>
</soapenv:Envelope>
"""
* print payload
哪个打印:
[print] <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.com">
<soapenv:Header/>
<soapenv:Body>
<ws:isValid>
<token>#(token)</token>
</ws:isValid>
</soapenv:Body>
</soapenv:Envelope>
你能帮我吗?
我尝试了给定的解决方案,但也不起作用:
def num = '<num>' + random_num(5) + '</num>'
[print] <num>39631</num>
Given request:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1>
<ns1:XML_INPUT>
<testone>00</testone>
<numtwo>267</testtwo>
#(num)
<testthree>267</testthree>
</ns1:XML_INPUT>
</ns1>
</soap:Body>
</soap:Envelope>
尝试:
* def token = '<token>' + 123456 + '</token>'
* def payload =
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.com">
<soapenv:Header/>
<soapenv:Body>
<ws:isValid>#(token)</ws:isValid>
</soapenv:Body>
</soapenv:Envelope>
"""
@cherryhoney,你找到解决方案了吗?我也面临着同样的问题。如果问题解决了,请告诉我