Getting 400 Bad requestion while connecting to RQM via API
the request body is an xml, and the xml is converted and given as input stream.attached the code below. Kindly help in solving the issue.
for the connection.doPost(fis, l, "xml"); i have tried all the combinations for content type like application/xml, XML, .xml and text/xml. while debugging inside the api methods i found the response of execute method is given 400 . till that the execution and the URI receiving happens correctly.
try {
connection = rawRestServiceClient.getConnection(uri);
connection.addRequestHeader("Slug", "49");
connection.addRequestHeader("Referer", "https://rb-alm-05-d.de.bosch.com/qm");
connection.addRequestHeader("Content-Type", "application/xml");
connection.addRequestHeader("Accept", "application/xml");
InputStream fis = null;
ByteArrayOutputStream os = new ByteArrayOutputStream();
int b;
try {
fis = new FileInputStream(
new File("C:\\temp\\vid3cob\\workspace\\orion\\8.0.1\\workspace\\com.bosch.almmig.reqone\\Testplan.xml"));
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
LOGGER.error("Rqone query prefix is not encoded properly", e);
}
try {
if (fis != null) {
while ((b = fis.read()) != -1) {
os.write(b);
}
// connection.doGet();
Long l = new Long(os.size());
// connection.doPost(fis, l, "xml");
connection.doPost(fis, l, "xml");
}
Comments
Donald Nong
Nov 08 '16, 12:45 a.m.Vidhya Venkatesan
Nov 08 '16, 1:04 a.m.Donald Nong
Nov 08 '16, 1:10 a.m.