Call BI Publisher web service with ReportRawData

百般思念 提交于 2019-12-12 04:15:29

问题


Target: Supply XML data for BI Publisher report within SOAP request to it's RunReport() method.

Environment:
Oracle BI Publisher 11.1.1.7.0 (build:20130303.1415)

Client - SoapUI 5.0.0.0 or custom PL/SQL code (Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production) callling service with use of http_util which works fine with other reports on the same BI Publisher server by passing parameters through parameterNameValues node.

Research:
After spending many hours I found only this topic on OTN(requires registration) which explains by the way how to use reportRawData parameter. I tried to use this recommendations but with no success.

Question:
Is it possible to supply XML data directly in SOAP request while calling RunReport() without uploading/creating a temporary file and without using JDBC data source?
There are a big probability that I missed something obvious, so please review example setup below and structure of SOAP request.

I already know at least one possible workaround in my situation (e.g. organize temporary JDBC data source to take data from it) but wondering if there are any clear and working way to implement this task.

Example setup:
1. Create example XML data file test_ds_example.xml :

  `<?xml version="1.0" encoding="utf-8"?>`  
  `<test> <field_val>AAAAA</field_val></test>`
  1. Create data source test_ds

  2. Add test_ds XML file dataset and supply test_ds_example.xml as local file:

  3. Test data and save it as sample:

  4. Create report based on test_ds :

  5. Create a basic template with phrase "Field Val:" and field filled from /test/field_val

  6. Test report in BI Publisher GUI and got text "Field Val: AAAAA"

  7. Make SOAP request with field value changed to B-B-B-B-B:

Data:

  `<?xml version="1.0" encoding="utf-8"?>`  
  `<test> <field_val>B-B-B-B-B</field_val></test>`

Request with data in reportRawData node:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
   <soapenv:Header/>
   <soapenv:Body>
      <pub:runReport>
         <pub:reportRequest>
            <pub:attributeFormat>html</pub:attributeFormat>
            <pub:attributeTemplate>claimnotification_xml</pub:attributeTemplate>
            <pub:byPassCache>True</pub:byPassCache>
            <pub:dynamicDataSource>
               <pub:fileDataSource>
                  <pub:dynamicDataSourcePath/>
                  <pub:temporaryDataSource>True</pub:temporaryDataSource>
               </pub:fileDataSource>
            </pub:dynamicDataSource>
            <pub:parameterNameValues/>
            <pub:reportAbsolutePath>/a_test/test_xml_report.xdo</pub:reportAbsolutePath>
            <pub:sizeOfDataChunkDownload>-1</pub:sizeOfDataChunkDownload>
         </pub:reportRequest>
         <pub:saveDataOption>False</pub:saveDataOption>
         <pub:reportRawData>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;test&gt; &lt;field_val&gt;B-B-B-B-B&lt;/field_val&gt;&lt;/test&gt;</pub:reportRawData>
         <pub:userID>weblogic_user</pub:userID>
         <pub:password>weblogic_user_password</pub:password>
      </pub:runReport>
   </soapenv:Body>
</soapenv:Envelope>
  1. Execute request but it returns "Field Val: AAAAA" instead of expected "Field Val:B-B-B-B-B" :(

回答1:


After lots of experiments I decided to pass same XML data through reportData tag in base64-encoded form, so final form of SOAP request looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
   <soapenv:Header/>
   <soapenv:Body>
      <pub:runReport>
         <pub:reportRequest>
            <pub:attributeFormat>html</pub:attributeFormat>
            <pub:attributeTemplate>claimnotification_xml</pub:attributeTemplate>
            <pub:byPassCache>True</pub:byPassCache>
            <pub:dynamicDataSource>
               <pub:fileDataSource>
                  <pub:dynamicDataSourcePath/>
                  <pub:temporaryDataSource>True</pub:temporaryDataSource>
               </pub:fileDataSource>
            </pub:dynamicDataSource>
            <pub:parameterNameValues/>
            <pub:reportAbsolutePath>/a_test/test_xml_report.xdo</pub:reportAbsolutePath>
            <pub:sizeOfDataChunkDownload>-1</pub:sizeOfDataChunkDownload>
         </pub:reportRequest>
         <pub:saveDataOption>False</pub:saveDataOption>
         <pub:reportData>PD94bWwgdmVyc21vbj0iMS4wIiB1bmNvZG1uZz0iVVRGLTgiPz48dGVzdD48ZmllbGRfdmFsPkItQi1CLUItQjwvZmllbGRfdmFsPjwvdGVzdD4=</pub:reportData>
         <pub:userID>weblogic_user</pub:userID>
         <pub:password>weblogic_user_password</pub:password>
      </pub:runReport>
   </soapenv:Body>
</soapenv:Envelope>

This solution did not match exactly with initial target but allows me to avoid external data sources in case of rendering of simple documents.



来源:https://stackoverflow.com/questions/27558070/call-bi-publisher-web-service-with-reportrawdata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!