加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – SoapUI:是否可以从SOAP消息中的元素自动生成值?

发布时间:2020-12-16 08:01:13 所属栏目:百科 来源:网络整理
导读:使用 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:idrandomid_
使用 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>

因为WCF服务期望为我的id指定唯一的ID:我想知道SoapUI是否提供了自动生成随机GUID的功能?

而不是一个随机的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  ...

http://onebyteatatime.wordpress.com/2009/04/18/soapui-tips-n-tricks-part-2/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读