Auto generated policy for SOAP to REST converson in APIM using WSDL Import option changes the DateTime value formats in the incoming payload while building the SOAP request. Is there any configuration to not parse dates in the set-body policy?
Errors seen on the SOAP service:
The string '10/14/2022 5:44:27 PM' is not a valid AllXsd value
at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)\n at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)\n at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIDDMSListener.Read6_DDMSListenerModel(Boolean isNullable, Boolean checkType)\n at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIDDMSListener.Read7_SubmitDocument()\n at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
"data": {
"message": "Context variable was successfully set.",
"name": "jsonreqbody",
"value": "{\r\n \"EventCode\": \"ddms.document.createfilecontent.completed\",\r\n \"CreatedDate\": \"2022-10-14T17:44:27.854821Z\",\r\n \"SourceSystem\": \"ddmsdocument\",\r\n \"Payload\": {\r\n \"TenantId\": \"xxx-298c-4282-b0c8-9b4f42489d07\",\r\n \"DocumentId\": \"xxx-3133-4429-938d-b095fbb11e20\",\r\n \"FileId\": \"9eae690f-413f-4955-8398-0d90539e4434\",\r\n \"FileName\": \"OAO 2.0 Flow 1.16.20.pdf\",\r\n \"ContentType\": \"application/pdf\",\r\n \"Document\": {\r\n \"DocumentId\": \"xx-3133-4429-938d-b095fbb11e20\",\r\n \"ActiveVersion\": 1,\r\n \"Name\": \"OAO 2.0 Flow 1.16.20.pdf\",\r\n \"ExpirationDate\": \"0001-01-01T00:00:00\",\r\n \"Tags\": [],\r\n \"TenantId\": \"xxxx-298c-4282-b0c8-9b4f42489d07\",\r\n \"IsDeleted\": false,\r\n \"Status\": \"Uploaded\",\r\n \"LastModified\": \"2022-10-14T17:44:27.8539898Z\",\r\n \"ReferenceId\": \"32411354\",\r\n \"TemplateCode\": \"DefaultStipulation\",\r\n \"ReceivedDate\": \"2022-10-14T17:44:27.8539901Z\",\r\n \"IsAnnotated\": false,\r\n \"ContentMimeType\": \"application/pdf\",\r\n \"CustomFields\": [\r\n {\r\n \"Code\": \"source\",\r\n \"Value\": \"ConsumerPortal\"\r\n },\r\n {\r\n \"Code\": \"stipulationId\",\r\n \"Value\": \"101086\"\r\n },\r\n {\r\n \"Code\": \"stipulationDesc\",\r\n \"Value\": \"Stipulation 1\"\r\n }\r\n ],\r\n \"IsCompression\": false,\r\n \"IsEncryptionEnabled\": false,\r\n \"ConvertToPDF\": false,\r\n \"DBDocType\": \"Document\",\r\n \"IsActive\": true,\r\n \"CreatedDate\": \"2022-10-14T17:44:27.4421811Z\",\r\n \"ModifiedDate\": \"2022-10-14T17:44:25.4052175Z\"\r\n },\r\n \"Description\": \"File content stored successfully with document\"\r\n },\r\n \"TenantId\": \"xxxx-298c-4282-b0c8-9b4f42489d07\"\r\n}"
}
Post execution of the set-body policy below
<set-body template="liquid">
{% if body.CreatedDate %}
<CreatedDate xmlns="http://schemas.datacontract.org/2004/07/CUDL.LOS.Models.DDMS">{{body.CreatedDate}}</CreatedDate>
{% else %}
<CreatedDate xmlns="http://schemas.datacontract.org/2004/07/CUDL.LOS.Models.DDMS" xsi:nil="true" />
{% endif %}
Tried using DateTime format as well:
{% if body.CreatedDate %}
<CreatedDate xmlns="http://schemas.datacontract.org/2004/07/CUDL.LOS.Models.DDMS">{{body.CreatedDate | DateTime: yyyy-MM-ddTHH:mm:ss.fffffffZ}}</CreatedDate>
In both cases the date format value from the incoming payload is not retained
the SOAP request payload has
<CreatedDate xmlns=\"http://schemas.datacontract.org/2004/07/CUDL.LOS.Models.DDMS\">10/14/2022 5:44:27 PM</CreatedDate>\n \n \n <Name xmlns=\"http://schemas.datacontract.org/2004/07/CUDL.LOS.Models.DDMS\">OAO 2.0 Flow 1.16.20.pdf</Name>\n \n \n <Description xmlns=\"http://schemas.datacontract.org/2004/07/CUDL.LOS.Models.DDMS\" xsi:nil=\"true\" />\n \n \n <ExpirationDate xmlns=\"http://schemas.datacontract.org/2004/07/CUDL.LOS.Models.DDMS\">1/1/0001 12:00:00 AM</ExpirationDate>