function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nikhil Khandare 1Nikhil Khandare 1 

Facing 'Unsupported Media Type 415' error in SOAP request

Hi All,

I am getting below error for SOAP sebservice call

01:26:29.470 (470158466)|USER_DEBUG|[19]|DEBUG|Response**:System.HttpResponse[Status=Unsupported Media Type, StatusCode=415]


Below is the code
String strBody = '<?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/soap/envelope/"><soap12:Body><GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"><listName>FPInventoryTest</listName><viewName></viewName><query><Where><Gt><FieldRef Name="ID" /><Value Type="Counter">0</Value></Gt></Where></query><viewFields><FieldRef Name="ID" /><FieldRef Name="Title" /><FieldRef Name="Property_x0020_Code"/><FieldRef Name="Supplier_x0020_Code" /><FieldRef Name="Property_x0020_Name" /><FieldRef Name="City_x0020_Name" /></viewFields><rowLimit>100</rowLimit><queryOptions></queryOptions><webID></webID></GetListItems></soap12:Body></soap12:Envelope>';

req.setEndpoint('https://teamsitespp.travelport.com/commregion/TravelClick/_vti_bin/lists.asmx?op=GetList');

req.setHeader('Content-Type', 'application/soap+xml; charset=utf-8');
Blob body = Blob.ValueOf(strBody.unescapeHtml4());

//req.setHeader('Content-length','10000');
//req.setheader('SOAPAction','http://schemas.microsoft.com/sharepoint/soap/GetListItems');
req.setheader('HOST','teamsitespp.travelport.com');
req.setMethod('GET');
req.setBodyAsBlob(body);
HttpResponse res = httpObj.send(req);
System.debug('Response**:' + res);
System.debug('Response**:' + res.getBody());

Please let me know whats wrong with the request.
Appreciate help.

Thank You!
Nikhil