简体   繁体   中英

How do I send TimeSpan parameter on SoapUI request?

I'm trying to send a TimeSpan parameter with value 01:00:00 and getting the following error:

There was an error when deserializing the object of type MyObject. The value '01:00:00' can't be parsed as type 'TimeSpan'.

How do I write this parameter for success on deserialization ?

Here's my request (Look at parameter 'Time'):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tel="http://service.example/" xmlns:ent="http://schemas.datacontract.org/2004/07/Service.Contract">
   <soapenv:Header/>
   <soapenv:Body>
      <tel:InsertObject>
         <!--Optional:-->
         <tel:object>
            <!--Optional:-->
            <ent:Date>2018-02-15T11:05:00</ent:Date>
            <!--Optional:-->
            <ent:Time>01:00:00</ent:Time>
            <!--Optional:-->
            <ent:ID>0</ent:ID>
            <!--Optional:-->
            <ent:Name>TestName</ent:Name>
         </tel:object>
      </tel:InsertObject>
   </soapenv:Body>
</soapenv:Envelope>

Thanks!

I've found the solution.

For 01:00:00 ->

<ent:Time>PT1H</ent:Time>

For 01:20:00 ->

<ent:Time>PT1H20M</ent:Time>

For 00:02:45 ->

<ent:Time>PT2M45S</ent:Time>

For 01:20:45 ->

<ent:Time>PT1H20M45S</ent:Time>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM