cancel
Showing results for 
Search instead for 
Did you mean: 

Unsupported media type status code 415 error.

Former Member
0 Kudos

Hi All,

I am getting an error "The server is refusing to process the request because the entity has a unsupported format" while Executing the URI for POST.

Below are the details:

URI:  /sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/SupplierSplitSet

Request Body:

<?xml version="1.0" encoding="utf-8"?>

<entry xml:base="xxxxxxxxxxxxxxx/sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/"

       xmlns="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">

<content type="application/xml">

  <m:properties>

   <d:Plant>CN03</d:Plant>

   <d:Splittype/>

   <d:Itemcode>0254890</d:Itemcode>

   <d:PeriodTo>2014-09-01T00:00:00</d:PeriodTo>

   <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

   <d:VendorNo/>

   <d:Qunum>0000001383</d:Qunum>

   <d:Qupos>001</d:Qupos>

   <d:Vendor>0000394349</d:Vendor>

   <d:Quota>40</d:Quota>

   <d:StartDate>2014-07-07T00:00:00</d:StartDate>

   <d:EndDate>2014-07-20T00:00:00</d:EndDate>

   <d:StartWeek/>

   <d:EndWeek/>

   <d:MaxQuantity>0.000</d:MaxQuantity>

   <d:Priority>00</d:Priority>

   <d:MCG/>

   <d:Leadtime>0</d:Leadtime>

  </m:properties>

</content>

</entry>

 

I did XML check, its fine. But still getting error. Please help me in resolving this issue.

Thanks,

Venkat Konanki

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Vankat,

The below things u need to change :

1. I see $batch in the URI in the 1st screen shot. Please remove $batch

2. Please change the Content Type to ' application/xml '

Do the above changes and check. It shud work.

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

As suggested, I tried without $batch and changed content type to application/xml still getting same error.

But I want to use Batch concept here, Do I need to have any other thing in the request body for using $batch?

Thanks,

venkat

AshwinDutt
Active Contributor
0 Kudos

Hello Venkat,

Yes. To perform CREATE/POST operation using BATCH, u need to redefine ChangeSet_Begin and ChangeSet_End method in DPC_EXT class and the way u fire the service will be different.

Kindly follow the below blog to accomplish ur scenario and revert if any problems. We can look inot it

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

Thanks for quick help, I have already redefined methods ChangeSet_Begin and ChangeSet_End in extension class.

Seems something wrong with my request body related to Batch, I will work on it and get back to you for any further issues.

Thanks,

Venkat.

AshwinDutt
Active Contributor
0 Kudos

Hello Venkat,

You need to be careful with the spaces between the multiple operations when u create request body when u fire batch operations.

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

Have successfully able to do POST and PUT based on your earlier suggestion.

But for $batch, Seems there is something wrong with my request body, Tried different ways but couldn't succeed.

Could you please check the below details and guide me on this

URI:  /sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/SupplierSplitUpdateSet/?$batch



Below is the request body in Gateway client.

--batch

Content-Type: multipart/mixed; boundary=changeset

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST SupplierSplitUpdateSet HTTP/1.1

Content-Type: application/xml

Content-Length: 1400

<?xml version="1.0" encoding="utf-8"?>

<entry xml:base="xxxxxxxxxxxxxxx/sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/"

       xmlns="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">

<content type="application/xml">

  <m:properties>

   <d:Plant>CN03</d:Plant>

   <d:Splittype/>

   <d:Itemcode>0254890</d:Itemcode>

   <d:PeriodTo>2014-09-01T00:00:00</d:PeriodTo>

   <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

   <d:VendorNo/>

   <d:Qunum>0000001383</d:Qunum>

   <d:Qupos>001</d:Qupos>

   <d:Vendor>0000394349</d:Vendor>

   <d:Quota>40</d:Quota>

   <d:StartDate>2014-07-07T00:00:00</d:StartDate>

   <d:EndDate>2014-07-20T00:00:00</d:EndDate>

   <d:StartWeek/>

   <d:EndWeek/>

   <d:MaxQuantity>0.000</d:MaxQuantity>

   <d:Priority>00</d:Priority>

   <d:MCG/>

   <d:Leadtime>0</d:Leadtime>

  </m:properties>

</content>

</entry>

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST SupplierSplitUpdateSet HTTP/1.1

Content-Type: application/atom+xml

Content-Length: 1400

<?xml version="1.0" encoding="utf-8"?>

<entry xml:base="xxxxxxxxxxxxxxx/sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/"

       xmlns="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">

<content type="application/xml">

  <m:properties>

   <d:Plant>CN03</d:Plant>

   <d:Splittype/>

   <d:Itemcode>0254891</d:Itemcode>

   <d:PeriodTo>2014-09-01T00:00:00</d:PeriodTo>

   <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

   <d:VendorNo/>

   <d:Qunum>0000001383</d:Qunum>

   <d:Qupos>001</d:Qupos>

   <d:Vendor>0000394349</d:Vendor>

   <d:Quota>40</d:Quota>

   <d:StartDate>2014-07-07T00:00:00</d:StartDate>

   <d:EndDate>2014-07-20T00:00:00</d:EndDate>

   <d:StartWeek/>

   <d:EndWeek/>

   <d:MaxQuantity>0.000</d:MaxQuantity>

   <d:Priority>00</d:Priority>

   <d:MCG/>

   <d:Leadtime>0</d:Leadtime>

  </m:properties>

</content>

</entry>

--changeset--

--batch--

I have also tried with atom+xml, and having <atom> tags still the same above error is coming.

Also seems only XML and Json can be validated? Is it not possible to validate if other than XML content exist in request body?

Please guide me on this.

Thanks,

Venkat

AshwinDutt
Active Contributor
0 Kudos

Hello Venkat,

1. Please correct the URL.

U r using URL - /sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/SupplierSplitUpdateSet/?$batch which is not correct.

Correct URL - U need to address BATCH as below.

/sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/$batch


2. U need to be really careful regarding the spaces between operations.


Use the below body -


In Header use Content-Type - multipart/mixed; boundary=batch


Method - POST


__________________________________________________________________________________


--batch

Content-Type: multipart/mixed; boundary=changeset

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST SupplierSplitUpdateSet HTTP/1.1

Content-Type: application/xml

Content-Length: 1400

<?xml version="1.0" encoding="utf-8"?>

<entry xml:base="xxxxxxxxxxxxxxx/sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/"

       xmlns="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">

<content type="application/xml">

  <m:properties>

   <d:Plant>CN03</d:Plant>

   <d:Splittype/>

   <d:Itemcode>0254890</d:Itemcode>

   <d:PeriodTo>2014-09-01T00:00:00</d:PeriodTo>

   <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

   <d:VendorNo/>

   <d:Qunum>0000001383</d:Qunum>

   <d:Qupos>001</d:Qupos>

   <d:Vendor>0000394349</d:Vendor>

   <d:Quota>40</d:Quota>

   <d:StartDate>2014-07-07T00:00:00</d:StartDate>

   <d:EndDate>2014-07-20T00:00:00</d:EndDate>

   <d:StartWeek/>

   <d:EndWeek/>

   <d:MaxQuantity>0.000</d:MaxQuantity>

   <d:Priority>00</d:Priority>

   <d:MCG/>

   <d:Leadtime>0</d:Leadtime>

  </m:properties>

</content>

</entry>

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST SupplierSplitUpdateSet HTTP/1.1

Content-Type: application/atom+xml

Content-Length: 1400

<?xml version="1.0" encoding="utf-8"?>

<entry xml:base="xxxxxxxxxxxxxxx/sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/"

       xmlns="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">

<content type="application/xml">

  <m:properties>

   <d:Plant>CN03</d:Plant>

   <d:Splittype/>

   <d:Itemcode>0254891</d:Itemcode>

   <d:PeriodTo>2014-09-01T00:00:00</d:PeriodTo>

   <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

   <d:VendorNo/>

   <d:Qunum>0000001383</d:Qunum>

   <d:Qupos>001</d:Qupos>

   <d:Vendor>0000394349</d:Vendor>

   <d:Quota>40</d:Quota>

   <d:StartDate>2014-07-07T00:00:00</d:StartDate>

   <d:EndDate>2014-07-20T00:00:00</d:EndDate>

   <d:StartWeek/>

   <d:EndWeek/>

   <d:MaxQuantity>0.000</d:MaxQuantity>

   <d:Priority>00</d:Priority>

   <d:MCG/>

   <d:Leadtime>0</d:Leadtime>

  </m:properties>

</content>

</entry>

--changeset--

--batch--


__________________________________________________________________________________


With this u shud be able to perform POST using BATCH mode.

Revert if any issues.


Regards,

Ashwin



Former Member
0 Kudos

Hi Ashwin,

Thanks, Now I could able to do batch.

One Scenario here: Currently in create_entity method

                             call method io_data_provider->read_entry_data

                              Importing es_data = ls_data, will bring each entry data of batch input and from this it is letting me to call RFC FM for only one record at a time.

Is there any way to Pass all the records at one go to RFC FM? Since I think it will improve the performance.

Could you please guide me on this.

Thanks,

Venkat Konanki.

AshwinDutt
Active Contributor
0 Kudos

Hello Venkat,

In that case, I would suggest you to implement Create_Deep_Entity so that you can send all the table of data as input inside a payload in a single operation. The same table of data can be sent directly to FM in DPC level. This way you can accomplish your scenario.

You need to create association & navigation between the same entity i.e., SupplierSplitUpdateSet with cardinality 1 to N and implement Create_Deep_Entity method.

Please have a look at the blog by Syam for technical details. This if for the reference. Change as per your needs.

Revert if any issues or question, We can look into it.

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

Thanks!

One issue, header level data is coming but not getting item level data ie, table data in deep structure.

Could you please check the below details and let me know if anything missed.

URI:/sap/opu/odata/sap/YMM7G_UMP_CON_SUPPLIER_SRV/SupplierSplitSet

Below is the Payload:

<?xml version="1.0" encoding="UTF-8"?>

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<atom:content type="application/xml">

  <m:properties>

   <d:Plant>CN03</d:Plant>

   <d:Splittype/>

   <d:Itemcode>0254890</d:Itemcode>

   <d:PeriodTo>9999-01-01T00:00:00</d:PeriodTo>

   <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

   <d:VendorNo/>

   <d:Qunum>0000001383</d:Qunum>

   <d:Qupos>001</d:Qupos>

   <d:Vendor>0000394349</d:Vendor>

   <d:Quota>40</d:Quota>

   <d:StartDate>2014-07-07T00:00:00</d:StartDate>

   <d:EndDate>2014-07-20T00:00:00</d:EndDate>

   <d:StartWeek/>

   <d:EndWeek/>

   <d:MaxQuantity>0.000</d:MaxQuantity>

   <d:Priority>00</d:Priority>

   <d:MCG/>

   <d:Leadtime>0</d:Leadtime>

  </m:properties>

</atom:content>

<atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier_list" type="application/atom+xml;type=feed" title="YMM7G_UMP_CON_SUPPLIER_SRV.Split_list">

  <m:inline>

   <atom:feed>

    <atom:entry>

     <atom:content type="application/xml">

      <m:properties>

       <d:Plant>CN03</d:Plant>

       <d:Splittype/>

       <d:Itemcode>0254891</d:Itemcode>

       <d:PeriodTo>9999-01-01T00:00:00</d:PeriodTo>

       <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

       <d:VendorNo/>

       <d:Qunum>0000001383</d:Qunum>

       <d:Qupos>001</d:Qupos>

       <d:vendor>0000394349</d:vendor>

       <d:Quota>40</d:Quota>

       <d:StartDate>2014-07-07T00:00:00</d:StartDate>

       <d:EndDate>2014-07-20T00:00:00</d:EndDate>

       <d:StartWeek/>

       <d:EndWeek/>

       <d:MaxQuantity>0.000</d:MaxQuantity>

       <d:Priority>00</d:Priority>

       <d:MCG/>

       <d:LeadTime>0</d:LeadTime>

      </m:properties>

     </atom:content>

    </atom:entry>

    <atom:entry>

     <atom:content type="application/xml">

      <m:properties>

       <d:Plant>CN03</d:Plant>

       <d:Splittype/>

       <d:Itemcode>0254892</d:Itemcode>

       <d:PeriodTo>9999-01-01T00:00:00</d:PeriodTo>

       <d:PeriodFrom>2014-01-01T00:00:00</d:PeriodFrom>

       <d:VendorNo/>

       <d:Qunum>0000001383</d:Qunum>

       <d:Qupos>001</d:Qupos>

       <d:vendor>0000394349</d:vendor>

       <d:Quota>40</d:Quota>

       <d:StartDate>2014-07-07T00:00:00</d:StartDate>

       <d:EndDate>2014-07-20T00:00:00</d:EndDate>

       <d:StartWeek/>

       <d:EndWeek/>

       <d:MaxQuantity>0.000</d:MaxQuantity>

       <d:Priority>00</d:Priority>

       <d:MCG/>

       <d:LeadTime>0</d:LeadTime>

      </m:properties>

     </atom:content>

    </atom:entry>

   </atom:feed>

  </m:inline>

</atom:link>

</atom:entry>

Thanks and Regards,

Venkat Konanki.

AshwinDutt
Active Contributor
0 Kudos

Hello Venkat,

In the deep structure which u have created, the name used to define item table type shud be same as the navigation property used in SEGW.

I mean , in the reference what i have suggested , in the below code the highlighted names are same as defined in the SEGW navigation properties.

TYPES :
BEGIN OF ts_deep_entity,
id TYPE char10,
name
TYPE char30,
name2
TYPE char30,
headitemo
TYPE STANDARD TABLE OF ts_itemo WITH DEFAULT KEY,
headitemt
TYPE STANDARD TABLE OF ts_itemt WITH DEFAULT KEY,
END OF ts_deep_entity.


I see that in the DPC, when u create a deep structure, u have used name SPLIT_ITEM to define the table type.

But in the service builder u have used Supplier_List .

U need to have same names as i have described in the starting with an example.

In the DPC, use the name Supplier_List instead of SPLIT_ITEM.

This shud resolve the issue if your payload is correct.

For now do the changes as above and check and revert if any issue.

Regards,

Ashwin




Former Member
0 Kudos

Hi Ashwin,

Thanks a lot for all the help

Seems lot of tricky things in gateway, Starting from URI, Payload and using same name of navigation property.

Thanks and Regards,

Venkat.

iamjaredm021
Participant
0 Kudos

Hi Venkat,

Please help on how did you able to perform batch post operation. I have already redefined methods /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_BEGIN and /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_END and implemented logic in the related CREATE_ENTITY method of the entity to handle each post operation but still I am encountering error "The server is refusing to process the request because the entity
has an unsupported format".

Here are the details of my request.

Request URI:

/sap/opu/odata/SAP/YGLOPD_GPA_IDP_DOCUMENTS_SRV/$batch

HTTP Request Header:

Content-Type: multipart/mixed; boundary=batch

HTTP Request Body:

--batch

Content-Type: multipart/mixed; boundary=changeset

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST IDPAllEmployeesSet HTTP/1.1

Content Type: application/atom+xml

Content-Length: 975

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
  <atom:content type="application/xml">
    <m:properties
      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
      xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
      <d:ViewID>ZZLTVSR</d:ViewID>
      <d:EmployeeName>No data maintained</d:EmployeeName>
      <d:FirstName />
      <d:LastName>No data maintained</d:LastName>
      <d:PersonnelNo>82001225</d:PersonnelNo>
      <d:OrgID>12003777</d:OrgID>
      <d:StatusID>0</d:StatusID>
      <d:StatusName>Not Started</d:StatusName>
      <d:NotApplicable>false</d:NotApplicable>
      <d:LastChangedBy />
      <d:LastChangedOn>00000000</d:LastChangedOn>
      <d:AvailableOn />
      <d:NextJob />
      <d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
      <d:Manager>false</d:Manager>
      <d:Supervisor>false</d:Supervisor>
      <d:StartDate>20030807</d:StartDate>
      <d:EndDate>99991231</d:EndDate>
    </m:properties>
  </atom:content>
</atom:entry>

--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary

POST IDPAllEmployeesSet HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
  <atom:content type="application/xml">
    <m:properties
      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
      xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
      <d:ViewID>ZZLTVSR</d:ViewID>
      <d:EmployeeName>No data maintained</d:EmployeeName>
      <d:FirstName />
      <d:LastName>No data maintained</d:LastName>
      <d:PersonnelNo>00003703</d:PersonnelNo>
      <d:OrgID>12001726</d:OrgID>
      <d:StatusID>0</d:StatusID>
      <d:StatusName>Draft</d:StatusName>
      <d:NotApplicable>false</d:NotApplicable>
      <d:LastChangedBy />
      <d:LastChangedOn>00000000</d:LastChangedOn>
      <d:AvailableOn />
      <d:NextJob />
      <d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
      <d:Manager>false</d:Manager>
      <d:Supervisor>false</d:Supervisor>
      <d:StartDate>20030801</d:StartDate>
      <d:EndDate>99991231</d:EndDate>
    </m:properties>
  </atom:content>
</atom:entry>


--changeset--
--batch--

Thanks,

Jay

AshwinDutt
Active Contributor
0 Kudos

Hello Jay,

You are passing an extra ' Content-Type' in the value of 'Content-Type' Header.

As per your screen shot have a look at highlighted one : This is not required

Value to be passed for the Header ' Content-Type ' is

'multipart/mixed; boundary=batch'

Regards,

Ashwin

Answers (1)

Answers (1)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Discussion on 'Already closed' thread is violating SCN RoE. Please raise a new discussion, you may provide the reference of the blogs/docs/threads you are following.

<<Locking this thread>>

Regards,

JK (Moderator)