You need to sign in to do that
Don't have an account?
System.HttpResponse[Status=Unsupported Media Type , Status Code=415]
Hi All,
i have following apex class. when calling through apex trigger getting following error.
System.HttpResponse[Status=Unsupported Media Type, StatusCode=415]
Can any one suggest what the mistake im doing in below code.
global class CaseRestService2{
@future (callout=true)
global static void sendChangeOwnerid(){
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://dev1sfdc.caremark.com/BenefitBuilderWeb/Notification?wsdl');
req.setMethod('POST');
String name ='Rahul';
String City='Delhi';
req.setHeader('content-type', 'text/html');
//req.setHeader('Accept', 'application/xml');
req.setHeader('Content-Length','1024');
req.setHeader('Host','dev1sfdc.caremark.com');
req.setBody('name='+EncodingUtil.urlEncode(name, 'UTF-8')+'&city='+EncodingUtil.urlEncode(city, 'UTF-8'));
req.setCompressed(true); // otherwise we hit a limit of 32000
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
System.debug(res.toString());
}
// System.debug(res.getBody());
}
}