SOAP请求中的传递日期

时间:2019-05-09 01:26:42

标签: xml soap soapui

我正在尝试使用SOAP UI生成SOAP请求。我想将今天的日期传递到xml中,以使服务器今天进行所有会议。这是我的代码

样品申请

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/04/secext" xmlns:urn="urn:ebx-schemas:dataservices_1.0">
   <soapenv:Header>
  <sec:Security>
     <UsernameToken>
        <Username>***</Username>
        <Password>****</Password>
     </UsernameToken>
  </sec:Security>
  </soapenv:Header>
  <soapenv:Body>
     <urn:select_meeting>        
     <branch>Reference</branch>

     <instance>DFAT_Master_Data</instance>
     <!--Optional:-->
     <predicate></predicate>

<disableRedirectionToLastBroadcast>false</disableRedirectionToLastBroadcast>
  </urn:select_meeting>
 </soapenv:Body>
</soapenv:Envelope>

这是我的样本回复

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <ns1:select_meetingResponse xmlns:ns1="urn:ebx-schemas:dataservices_1.0">
     <data>
        <root>
           <meeting>
              <mdmmeetingID>1</mdmmeetingID>
              <subject>qwertyuio</subject>
              <attendeesExternal>Professor</attendeesExternal>
              <meetingRoom>14</meetingRoom>
              <dateTime>2019-11-05T11:12:13.000</dateTime>
              <attachments>cdvdcgdf</attachments>
           </meeting>

           </root>
           </data>
           </ns1:select_meetingResponse>
        </soapenv:Body>
    </soapenv:Envelope>

理想情况下,我想将今天的日期传递到请求xml中的谓词选项中。 有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

要获取ISO格式的今天的日期,可以使用

${=def now = new Date();now.format("yyyy-MM-dd")}

例如

<predicate>${=def now = new Date();now.format("yyyy-MM-dd")}</predicate>

成为

<predicate>2019-05-09</predicate>

根据需要将字符串参数更改为format