on 10-24-2013 10:51 AM
Hello Experts,
I am sending Date and Time during Create Operation.
For 'Date' the data type used is 'DATS' and the date format sent from rest cilent is '2013-10-23T00:00:00'
With the above date format i am able to do POST operation.
But the issue is with the TIME field.
For 'Time' the data type used is 'TIMS'. I am not able to find the correct format in which 'Time' has to be sent to GW from Rest Client.
I tried sending in the below format but i get 'Error while parsing an XML stream'
2013-10-23T23:59:59
Kindly suggest the correct format as i am unable to find anywhere and guide me if anything is wrong.
Regards,
Ashwin
Hi,
Refer this link on working with odata dates andf times at http://mysapgw.wordpress.com/2013/04/28/working-with-odata-dates-and-times/
This might be useful to solve your issue.
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ron,
With the below body i am able to do 'Create Operation'.
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST post_order1 HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<atom:content type="application/xml">
<m:properties>
<d:REQUEST_NO>CHG00003</d:REQUEST_NO>
<d:SEND_DATE>2013-10-23T00:00:00</d:SEND_DATE>
<d:REQUESTER>Ash_m_1</d:REQUESTER>
<d:COMP_CODE>0100</d:COMP_CODE>
<d:PLANT>1021</d:PLANT>
<d:REMARK>Test m 1</d:REMARK>
<d:REQUEST_ITMNO>0001</d:REQUEST_ITMNO>
<d:FROM_MATNO>Z10D777CNW0025P</d:FROM_MATNO>
<d:FROM_BATCH>6MA01006</d:FROM_BATCH>
<d:TO_MATNO>Z10D777CNW0025P</d:TO_MATNO>
<d:TO_BATCH>6MA01006</d:TO_BATCH>
<d:QUANTITY>5.000</d:QUANTITY>
<d:WEIGHT_UNIT>TON</d:WEIGHT_UNIT>
<d:EST_FDATE>2013-10-23T00:00:00</d:EST_FDATE>
</m:properties>
</atom:content>
</atom:entry>
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST post_order1 HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<atom:content type="application/xml">
<m:properties>
<d:REQUEST_NO>CHG00003</d:REQUEST_NO>
<d:SEND_DATE>2013-10-23T00:00:00</d:SEND_DATE>
<d:REQUESTER>Ash_m_2</d:REQUESTER>
<d:COMP_CODE>0100</d:COMP_CODE>
<d:PLANT>1021</d:PLANT>
<d:REMARK>Test m 2</d:REMARK>
<d:REQUEST_ITMNO>0002</d:REQUEST_ITMNO>
<d:FROM_MATNO>Z10D777CNW0025P</d:FROM_MATNO>
<d:FROM_BATCH>6MA01006</d:FROM_BATCH>
<d:TO_MATNO>Z10D777CNW0025P</d:TO_MATNO>
<d:TO_BATCH>6MA01006</d:TO_BATCH>
<d:QUANTITY>5.000</d:QUANTITY>
<d:WEIGHT_UNIT>TON</d:WEIGHT_UNIT>
<d:EST_FDATE>2013-10-23T00:00:00</d:EST_FDATE>
</m:properties>
</atom:content>
</atom:entry>
--changeset--
--batch--
When i add the time field in the body (Which is highlighted below ) i get the error 'Error while parsing an XML stream'
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST post_order1 HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<atom:content type="application/xml">
<m:properties>
<d:REQUEST_NO>CHG00003</d:REQUEST_NO>
<d:SEND_DATE>2013-10-23T00:00:00</d:SEND_DATE>
<d:SEND_TIME>2013-10-23T23:59:59</d:SEND_TIME>
<d:REQUESTER>Ash_m_1</d:REQUESTER>
<d:COMP_CODE>0100</d:COMP_CODE>
<d:PLANT>1021</d:PLANT>
<d:REMARK>Test m 1</d:REMARK>
<d:REQUEST_ITMNO>0001</d:REQUEST_ITMNO>
<d:FROM_MATNO>Z10D777CNW0025P</d:FROM_MATNO>
<d:FROM_BATCH>6MA01006</d:FROM_BATCH>
<d:TO_MATNO>Z10D777CNW0025P</d:TO_MATNO>
<d:TO_BATCH>6MA01006</d:TO_BATCH>
<d:QUANTITY>5.000</d:QUANTITY>
<d:WEIGHT_UNIT>TON</d:WEIGHT_UNIT>
<d:EST_FDATE>2013-10-23T00:00:00</d:EST_FDATE>
</m:properties>
</atom:content>
</atom:entry>
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST post_order1 HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<atom:content type="application/xml">
<m:properties>
<d:REQUEST_NO>CHG00003</d:REQUEST_NO>
<d:SEND_DATE>2013-10-23T00:00:00</d:SEND_DATE>
<d:SEND_TIME>2013-10-23T23:59:59</d:SEND_TIME>
<d:REQUESTER>Ash_m_2</d:REQUESTER>
<d:COMP_CODE>0100</d:COMP_CODE>
<d:PLANT>1021</d:PLANT>
<d:REMARK>Test m 2</d:REMARK>
<d:REQUEST_ITMNO>0002</d:REQUEST_ITMNO>
<d:FROM_MATNO>Z10D777CNW0025P</d:FROM_MATNO>
<d:FROM_BATCH>6MA01006</d:FROM_BATCH>
<d:TO_MATNO>Z10D777CNW0025P</d:TO_MATNO>
<d:TO_BATCH>6MA01006</d:TO_BATCH>
<d:QUANTITY>5.000</d:QUANTITY>
<d:WEIGHT_UNIT>TON</d:WEIGHT_UNIT>
<d:EST_FDATE>2013-10-23T00:00:00</d:EST_FDATE>
</m:properties>
</atom:content>
</atom:entry>
--changeset--
--batch--
So i strongly suspect the error is because of TIME field.
Seems like the format is wrong and i am unable to find the correct format so need help in finding correct format to be sent to GW.
Regards,
Ashwin
Hi Ashwin,
check in your metadata if SEND_TIME is of type Edm.Time.
If it is so check the correct format of Edm.Time in http://www.odata.org/documentation/odata-v2-documentation/overview/. The format that you are passing is Edm.Datetime.
I would suggest you to fire a READ entity call and check the response. The format you get against property SEND_TIME should be send in POST.
Regards,
Atanu
Hello Atanu,
In my model i have defined Time property as shown below.
The below shows the Structure and the Data type of the Time field which is bound to my model.
This is how i have defined Time Property in my model.
I am sending as <d:SEND_TIME>23:00:00</d:SEND_TIME> in my body like you suggested but service is still failing.
I tried sending as <d:SEND_TIME>230000</d:SEND_TIME> n my body. But no use. Service is failing.
I am unable to find the correct format which GW is expecting for the Time field.
Need Help here.
Regards,
Ashwin
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.