SOAPUI DateFormat error

…衆ロ難τιáo~ 提交于 2020-01-24 09:55:06

问题


I am new here, sorry if I make any mistake posting my question. I am using SOAPUI to test a web service. Inside the Soap message, I need to add an StartDate and EndDate but I am getting as a error (Input string was not in a correct format) I been trying several DateFormat that I found over the internet by I still getting the same error.

Here you have the SOAPUI parameters.

Thanks

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header>
      <tem:Message>
         <!--Optional:-->
         <tem:Value>?</tem:Value>
      </tem:Message>
      <tem:APIKeyHeader>
         <!--Optional:-->
         <tem:Value>cbe40420</tem:Value>
      </tem:APIKeyHeader>
   </soapenv:Header>
   <soapenv:Body>
      <tem:GetTasks>
         <!--Optional:-->
         <tem:PIDs>
            <!--Zero or more repetitions:-->
            <tem:string>2857fd7c-a720</tem:string>
         </tem:PIDs>
         <!--Optional:-->
         <tem:UserID>blue</tem:UserID>
         <!--Optional:-->
         <tem:IDs>
            <!--Zero or more repetitions:-->
            <tem:string>?</tem:string>
         </tem:IDs>
         <!--Optional:-->
         <tem:TaskStatus>true</tem:TaskStatus>
         <tem:StartDate>2008-10-26T21:32:52.12679</tem:StartDate>
         <tem:EndDate>2014-10-26T21:32:52.12679</tem:EndDate>
         <tem:ExtentionDays>true</tem:ExtentionDays>
         <tem:ShowNotReady>false</tem:ShowNotReady>
      </tem:GetTasks>
   </soapenv:Body>
</soapenv:Envelope>

回答1:


Try the Sortable Date/Time Pattern, it works for me

Console.WriteLine(date1.ToString("S", CultureInfo.CreateSpecificCulture("en-US"))); 

IN XML

 <tem:StartDate>2014-01-10T15:51:24</tem:StartDate>
 <tem:EndDate>2018-01-10T15:51:24</tem:EndDate>


来源:https://stackoverflow.com/questions/27109802/soapui-dateformat-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!