xml SOAPUI 日期格式错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27109802/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 12:05:56  来源:igfitidea点击:

SOAPUI DateFormat error

xmlweb-servicessoapsoapuidate-format

提问by Benjamin Campos

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.

我是新来的,对不起,如果我在发布我的问题时犯了任何错误。我正在使用 SOAPUI 来测试 Web 服务。在 Soap 消息中,我需要添加一个 StartDate 和 EndDate,但我收到了一个错误(输入字符串的格式不正确)

Here you have the SOAPUI parameters.

这里有 SOAPUI 参数。

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>

回答by Zack

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

尝试可排序的日期/时间模式,它对我有用

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

IN XML

以 XML 格式输入

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

回答by Siddhant Fulzele

You have to provide a date in the format that web-service expect. i.e 2008-10-26

您必须以 Web 服务期望的格式提供日期。即 2008-10-26