Ste*_*ath 22 xml random guid soapui
使用SoapUI,可以将Soap XML消息发送到WCF服务.我有以下SOAP消息:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:my="http://myserviceprovider">
<soap:Header/>
<soap:Body>
<my:ProcessOrder>
<my:Orders>
<my:Order>
<my:id>randomid_1234567890</my:id>
<my:data>ABC</my:data>
</my:Order>
</my:Orders>
</my:ProcessOrder>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
因为WCF服务需要my:id的唯一ID ,所以我想知道SoapUI是否提供自动生成随机GUID的功能?
Bla*_*aff 11
而不是随机ID,我建议使用时间戳到毫秒,因为数字永远不会重复.
我自己没有这样做,但看起来你调用了一个字符串函数:
01 ...
02 ...
03 <!-- text within dateEffectiveFrom tag is replaced with a date 10 days from today in yyyy-MM-dd format -->
04 <dateEffectiveFrom>${= String.format('%tF', new Date() + 10) }</dateEffectiveFrom>
05
06 <!-- TestSuite property "date" is defined as "${= String.format('%tF', new Date() + 10) }" -->
07 <!-- Another example where dynamic date is defined as TestSuite property -->
08 <!-- and then SOAP Request can refer to this TestSuite property as shown below -->
09 <dateEffectiveFrom>${#TestSuite#date}</dateEffectiveFrom>
10 ...
11 ...
Run Code Online (Sandbox Code Playgroud)
http://onebyteatatime.wordpress.com/2009/04/18/soapui-tips-n-tricks-part-2/
我刚刚使用下面的代码在我的SOAPUI请求中生成随机数字,它没有任何问题.这将生成10位数的随机数.
<val:Id UniqueID="${=org.apache.commons.lang.RandomStringUtils.randomNumeric(10)}"/>
如果要更改位数,只需更改方法中所需的位数即可randomNumeric().
| 归档时间: |
|
| 查看次数: |
27070 次 |
| 最近记录: |