You need to sign in to do that
Don't have an account?

Content is not allowed in prolog
In the following SF class code:
//2. make webservice call to create Rally Attachment
req.setEndpoint(RallyURL+':443/slm/webservice/1.26/attachmentcontent/create');
req.setMethod('POST');
req.setHeader('Authorization', authorizationHeader);
req.setHeader('Content-Type','text/xml');
String body;
body = '{"Content":"'+EncodingUtil.base64Encode(att.Body)+'"}';
req.setBody(body);
//send the request
res = http.send(req);
System.debug('***res1: ' + res.getBody());
I am getting the following error on response:
09:49:09.411 (1411487000)|USER_DEBUG|[79]|DEBUG|***res1: <?xml version="1.0" encoding="UTF-8"?>
<CreateResult rallyAPIMajor="1" rallyAPIMinor="26">
<Errors>
<OperationResultError>Cannot parse input stream as XML document: Error on line 1: Content is not allowed in prolog.</OperationResultError>
</Errors>
<Warnings />
</CreateResult>
Can you please assist me?
Your content-type header says its xml, and given the error message, the server appears to be expecting xml, but your request body is not xml.
Thanks Simon. I altered the code little bit:
req.setEndpoint(RallyURL+':443/slm/webservice/1.26/attachmentcontent/create');
req.setMethod('POST');
req.setHeader('Authorization', authorizationHeader);
System.debug('***contenttype: ' + att.ContentType);
req.setHeader('Content-Type', att.ContentType+'; charset=UTF-8');
String body;
body = '{"Content":"'+EncodingUtil.base64Encode(att.Body)+'"}';
req.setBody(body);
//send the request
res = http.send(req);
System.debug('***res1: ' + res.getBody());
I am still getting the same error.
You are still not sending xml, i susgest yo go find some example payloads for the service you're trying to call.
gogoanime (https://gogoanimepro.net/)& gogoanime (http://gogoanimefy.com)