// call remote cfc
HTTPResponse rsp = HTTPEngine.post(url, username, password, -1, 0, "UTF-8", USER_AGENT, proxyData,headers, formfields);
// read result
Header[] rspHeaders = rsp.getAllHeaders();
MimeType mt = getMimeType(rspHeaders,null);
int format = MimeType.toFormat(mt, -1);
if(format==-1) {
if(rsp.getStatusCode()!=200) {
boolean hasMsg=false;
String msg=rsp.getStatusText();
for(int i=0;i<rspHeaders.length;i++){
if(rspHeaders[i].getName().equalsIgnoreCase("exception-message")){
msg=rspHeaders[i].getValue();
hasMsg=true;
}
}
is = rsp.getContentAsStream();
ApplicationException ae = new ApplicationException("remote component throws the following error:"+msg);
if(!hasMsg)ae.setAdditional(KeyImpl.init("respone-body"),IOUtil.toString(is, mt.getCharset()));
throw ae;
}
throw new ApplicationException("cannot convert response with mime type ["+mt+"] to a CFML Object");
}
is = rsp.getContentAsStream();
return ReqRspUtil.toObject(pc,IOUtil.toBytes(is,false),format,mt.getCharset(),null);
}
catch (IOException ioe) {
throw Caster.toPageException(ioe);
}
finally {