cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot convert /Date(1492098664000)/ to java.util.Calendar

0 Kudos

Hello Experts ,

I am currently experiencing an issue in Posting data to TimeAccountDetail Odata API .

When I try it through Postman it seems to work fine..

postman-timeaccountdetail.png

I get com.sap.gateway.core.ip.component.odata.exception.OsciException when I try posting it through SAP CPI. I believe the issue is with the date format.

error.png

I am passing the below payload

<?xml version="1.0" encoding="UTF-8" standalone="no"?><TimeAccountDetail><TimeAccountDetail><TimeAccount_externalCode>614dbcc89cb843129b5c3be26dbd2a22</TimeAccount_externalCode><externalCode>MyTimeAccountDetail</externalCode><bookingUnit>HOURS</bookingUnit><referenceObject>null</referenceObject><employeeTime>null</employeeTime><bookingAmount>20.0</bookingAmount><comment>This is my test leave</comment><bookingType>MANUAL_ADJUSTMENT</bookingType><bookingDate>/Date(1492098664000)/</bookingDate></TimeAccountDetail></TimeAccountDetail>

I have attached the Odata adapter settings

odata-connection.png

odata-processing.png

Can you please let me know if I have missed something in the set up.

Appreciate your support

Regards

Advit

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Sure,

Please find the below logs attached

Processing exchange ID-vsa6272907-33243-1550696375148-184-63:
StartTime = Wed Mar 06 03:44:01.393 UTC 2019
StopTime = Wed Mar 06 03:44:02.126 UTC 2019
ChildCount = 12
Error = com.sap.gateway.core.ip.component.odata.exception.OsciException: Found : 302 : HTTP/1.0
ModelStepId = MessageFlow_26
StepId = MessageFlow_26
Activities [
{Activity=convertBodyTo[java.lang.String], StartTime=Wed Mar 06 03:44:01.393 UTC 2019, StopTime=Wed Mar 06 03:44:01.394 UTC 2019}
{Activity=odata:CREATE_ENTRY?serviceUri=http://****###.com/odata/v2/TimeAccountDetail&resourcePath=RAW(TimeAccountDetail)&alias=RAW(APJ)&authenticationType=Basic&retrieveAllPages=true&clientSidePageSize=200&oDataMethod=CREATE_ENTRY&contentType=application/json∁onentContentType=xml&receiveTimeOut=60000≺oxyType=default&retryOnFailure=false&allowRequestHeaders=false&setErrorResponseBody=true&isKeyAutoGenerated=true&allowResponseHeaders=false&isCSRFEnabled=true&serviceType=HCIOData, StartTime=Wed Mar 06 03:44:01.394 UTC 2019, StopTime=Wed Mar 06 03:44:02.126 UTC 2019}

HTTP request and response from OData V2 adapter::
StartTime = Wed Mar 06 03:44:02.077 UTC 2019
ChildCount = 14
HTTP Status Line = HTTP/1.0 302 Found
ModelStepId = MessageFlow_26
Request URI = POST http://****###.com/odata/v2/TimeAccountDetail/TimeAccountDetail HTTP/1.1
StepId = MessageFlow_26#1551843842077
Activities [
{Activity=logAdapterProcessing, StartTime=Wed Mar 06 03:44:02.077 UTC 2019}
]
Attachments [
{AttachmentName=ODataV2_Adapter_Request_Headers, AttachmentURI=sap-it-res:msg:c5d7043a8:ce833690-64e2-4f33-b72f-2c6214c7ab36}
{AttachmentName=ODataV2_Adapter_Response_Headers, AttachmentURI=sap-it-res:msg:c5d7043a8:542514d5-d0e4-4f1c-bb64-35884769acc4}
{AttachmentName=ODataV2_Adapter_Response_Body, AttachmentURI=sap-it-res:msg:c5d7043a8:1b19e3e2-b491-4a14-a57c-a9266b805b46}
]

Exchange ID-vsa6272907-33243-1550696375148-184-63 failed:
StartTime = Wed Mar 06 03:44:02.133 UTC 2019
Status = FAILED
ChildCount = 15
ModelStepId = MessageFlow_26

iflow.png

Regards

Appreciate your support

Advit

engswee
Active Contributor
0 Kudos

HTTP 302 means a redirection - no idea why you are getting that which is causing the error.

You might want to try using the SFSF adapter with OData V2 protocol to see if it behaves the same way.

0 Kudos

Thanks for getting back

I used SFSF adapter with OData V2 protocol and surprisingly I get

org.apache.olingo.odata2.api.uri.UriNotMatchingException: Could not find an entity set or function import for 'TimeAccountDetail'.

I followed all the resolution steps mentioned in the below URL , but no luck

https://apps.support.sap.com/sap/support/knowledge/public/en/2538166

sf-adapter-connection.png

sfadapter-processing.png

I am thinking of converting the XML to JSON using Groovy and POST that with Http adapter. I am open for any other approaches as well.

Appreciate your support

Regards

Advit

engswee
Active Contributor
0 Kudos

When you post via Postman, you are using JSON, so the date is specified in JSON format, e.g. /Date(1492098664000)/.

When you are using CPI's OData/SFSF adapter, you are dealing with the payload in CPI's internal XML format, and the adapter does the necessary conversion to JSON or Atom-XML when posting to the OData service. (From my own experience, I've noticed that the JSON option in the adapter does not work that well). When the payload is in XML format, you need to specify the date in the yyyy-MM-dd'T'HH:mm:ss format, example:- 2017-11-06T02:24:35

0 Kudos

Thank you for your response.

I did make the change and now I get the below error

com.sap.gateway.core.ip.component.odata.exception.OsciException: Found : 302 : HTTP/1.0

engswee
Active Contributor
0 Kudos

No idea what the error means unless you can provide more details.

0 Kudos

hi engswee.yeoh,

We are facing the same issue but from SAP Data Services to Successfactors using the Data Services' OData adapter(v2). Is there any way we can change the JSON option to XML. Highly appreciate any help on this.