cancel
Showing results for 
Search instead for 
Did you mean: 

oData Service error message Unsupported Media Type Code 415 in post method

naimkhans_babi
Active Participant
0 Kudos

Dear Friend!

Good morning, How are you ?

while using Post method for oData Service : /sap/opu/odata/SAP/ZCRM_SERVICES_SRV/create_bp_prospectSet I am receiving error with status code 415. the error is unsupported media type.

1, I have attached Gateway Client Error message.

2. Payload.

3. EntitySet strucutre.

I have tried multiple ways but not successful. what I have tried are:

1. change typy to entry from feed : but it results in bad request with error code 400

2. I have put " " in all the fields, and numbers , also without it... but it results in status code 415 only.

3. I have debug the process as well and found that token was missing and some connection issues but all the get methods are working perfectly fine.

Please help me to understand where I am making mistake and How to solve this error. I will greatly appreicate your help in this matter

Best Regards

Naim

PayLoad

<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:NameOrg1>Syncronik Construction Services</d:NameOrg1> <d:Isec>"ZCO01"</d:Isec> <d:Kwmeng>7.000</d:Kwmeng> <d:Vrkme>"m3"</d:Vrkme> <d:AddrValidFrom>2019-01-01T00:00:01</d:AddrValidFrom> <d:AddrValidTo>2019-12-31T23:00:00</d:AddrValidTo> <d:Radio>"1"</d:Radio> <d:Rakme>km</d:Rakme> <d:SmtpAddr>xxx.xxx@syncronik.com</d:SmtpAddr> <d:Street>xxxxxx</d:Street> <d:HouseNum1>"Z421"</d:HouseNum1> <d:PostCode1>"560155"</d:PostCode1> <d:City1>Monterrey</d:City1> <d:Region>"06"</d:Region> <d:Country>MX</d:Country> <d:NameFirstOb>XXXX</d:NameFirstOb> <d:NameLastOb>XXXX</d:NameLastOb> <d:TelNumOb>"1234567890"</d:TelNumOb> <d:NameFirstOf>XXXXXX</d:NameFirstOf> <d:NameLastOf>XXXX</d:NameLastOf> <d:TelNumOf>"0987654321"</d:TelNumOf> </m:properties> </content>

Accepted Solutions (1)

Accepted Solutions (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Look at the CORE_SAMPLES in the SAP Gateway Client.

https://blogs.sap.com/2013/06/21/demo-test-cases/

Doing a POST request on

/sap/opu/odata/IWBEP/TEA_TEST_APPLICATION/Drafts

and payload (see belows) works.

Header:

Content-Type application/atom+xml;type=entry; charset=utf-8

Looking at your payload the <entry …> tag seems to be missing.

If you perform a single read, use the "use as request" button and then change the URL so that it points to the entity set you are able to create appropriate payloads.

Best Regards,

Andre

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

<entry xml:base="https://ldai1g1y.wdf.sap.corp:44356/sap/opu/odata/IWBEP/TEA_TEST_APPLICATION/" 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">

 <id>https://ldai1g1y.wdf.sap.corp:44356/sap/opu/odata/IWBEP/TEA_TEST_APPLICATION/Drafts('1')</id>

 <title type="text">Drafts('1')</title>

 <updated>2019-11-05T23:14:32Z</updated>

 <category term="com.sap.TEA.TestApplication.Draft" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

 <link href="Drafts('1')" rel="edit" title="Draft"/>

 <content type="application/xml">

  <m:properties>

   <d:Id>1</d:Id>

   <d:price>-170.59</d:price>

   <d:currency>EUR</d:currency>

   <d:amount>1.1235</d:amount>

   <d:unit>KG</d:unit>

   <d:test_currency>XXX</d:test_currency>

   <d:test_unit>XX</d:test_unit>

   <d:test_id>abcd</d:test_id>

  </m:properties>

 </content>

</entry>

Answers (1)

Answers (1)

naimkhans_babi
Active Participant

Hello Mr Fischer.

Thank you so much for your answer... it helped me alot. I appreciate your help greatly!

Best Regards

Naim