0% found this document useful (0 votes)
229 views3 pages

XML Call in Oaf

XML CALL IN OAF

Uploaded by

nagkkkkk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
229 views3 pages

XML Call in Oaf

XML CALL IN OAF

Uploaded by

nagkkkkk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

6/11/2017 Anil'sOracleApplicationFrameworkBlog

Linkstothispost

Sunday,January11,2015

IntegrateXMLPublisherReportwithOAF

InthisexamplewearegoingtointegrateasimpleXMLpublisherreportwithOAF.Thebusinessscenarioissomethinglikethatwe
haveaOAFpageandonclickof"Print"buttonwewanttocallaXMLpublisherreport.

Steps
1.CreateaOAFpagewithtableregionandprintbuttontocallaXMLpublisherreport.

2.DesignedXMLreporttemplate.hereIhavenotmentionedstepstoregistertheXMLreportinOracleapps.

ControllerCode
HerewearehandlingtheprintbuttonactionandcallingtheXMLreport.

publicvoidprocessFormRequest(OAPageContextpageContext,
OAWebBeanwebBean){
super.processFormRequest(pageContext,webBean);
if(pageContext.getParameter("Print")!=null){

System.out.println("PrintButtonclicked");

printReport(pageContext,webBean,"pdf");

https://oracleanil.blogspot.in/ 4/6
6/11/2017 Anil'sOracleApplicationFrameworkBlog
}

publicvoidprintReport(OAPageContextpageContext,OAWebBeanwebBean,
StringoutputType){

OAApplicationModulelo_am=pageContext.getApplicationModule(webBean);

Stringls_extensionType="pdf";//Settingtheoutputextensiontype
bytel_outputType=0;
l_outputType=TemplateHelper.OUTPUT_TYPE_PDF;

DataObjectlo_sessionDictionary=
pageContext.getNamedDataObject("_SessionParameters");
HttpServletResponselo_response=
(HttpServletResponse)lo_sessionDictionary.selectValue(null,
"HttpServletResponse");
try{
ServletOutputStreamlo_outputStream=
lo_response.getOutputStream();

//settingthereportname&outputtype
Stringlo_contentDisposition=
"attachment;filename=OrderDetails."+ls_extensionType;
lo_response.setHeader("ContentDisposition",
lo_contentDisposition);
lo_response.setContentType("application/pdf");

System.out.println("CallingXMLgenerationmethod");

XMLNodexmlNode=
(XMLNode)lo_am.invokeMethod("getOrderReportDetailsXML");
//CallinggetOrderReportDetailsXMLmethodtogettheXMLfortheVOquery

ByteArrayOutputStreamoutputStream=newByteArrayOutputStream();

xmlNode.print(outputStream);
System.out.println("AftercallingXMLgenerationmethod"+
outputStream.toString());
//AbovesopwillreturntheXMLoutputwhichwillhelpyouindesigningthetemplate.

ByteArrayInputStreamlo_inputStream=
newByteArrayInputStream(outputStream.toByteArray());
ByteArrayOutputStreamlo_outputFile=newByteArrayOutputStream();

//PasstheTemplatecodeandApplicationshortname
try{
TemplateHelper.processTemplate(((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransacti
"PA","XX_ORDER_DT",
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransacti
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransacti
lo_inputStream,l_outputType,
null,lo_outputFile);

}catch(XDOExceptionxe){
thrownewOAException("Exception:"+xe.getMessage());

byte[]l_bytes=lo_outputFile.toByteArray();

lo_response.setContentLength(l_bytes.length);
lo_outputStream.write(l_bytes,0,l_bytes.length);
lo_outputStream.flush();
lo_outputStream.close();
}catch(Exceptione){
lo_response.setContentType("text/html");
thrownewOAException(e.getMessage(),OAException.ERROR);
}
pageContext.setDocumentRendered(false);

ApplicationModuleCode

ThismethodwillreturntheXMLoutputoftheVOqueryattachedtothepage.

publicXMLNodegetOrderReportDetailsXML(){
//XMLNodelo_xmlNode;

https://oracleanil.blogspot.in/ 5/6
6/11/2017 Anil'sOracleApplicationFrameworkBlog
System.out.println("InsidetheAMMethod");
OrderReportDetailsVOImplvo=getOrderReportDetailsVO1();
vo.executeQuery();
XMLNodelo_xmlNode=(XMLNode)vo.writeXML(1,0L);

//OLStandsforXMLInterface.XML_OPT_ALL_ROWSwhichmeanstoincludesallrowsintheviewobject'srowsetintheXML.

returnlo_xmlNode;
}

ReportOutput

Thanks,
Anil

PostedbyAnilSharmaat3:04AM 0comments
Reactions: funny (0) interesting (0) cool (0)

Linkstothispost

Home OlderPosts

Subscribeto:Posts(Atom)

CopyRestricted

Copyright2010Anil'sBlog.Allrightsreserved..AwesomeInc.theme.PoweredbyBlogger.

https://oracleanil.blogspot.in/ 6/6

You might also like