Business Intelligence – Oracle

Oracle BI Publisher 10.1.3.3.1 – Creating Applications using JDeveloper 11g and Web Service SOAP APIs

Posted by Venkatakrishnan J on January 4, 2008

I had some time today to see how easy it is to create a sample application that would basically call a BI Publisher web service and then run a report. Well if you had seen my previous blog entry on this here, i would have mentioned that i was not able to get the sample code provided in the documentation to work. Well, so far still i could not figure out the additional jars required. So we would be using a different approach here to test out these web services. Before going further, let me first list out the components and their versions that i would be using for this

1.    JDeveloper Tech Preview 3 – Yes this is a new year gift(though released by the end of December). JDev has never been any better. So many changes in UI and features and many more are coming in the 11g release.
2.    BI Publisher 10.1.3.3.1 (without the latest patchset).

Now, the first thing that we need to do for testing this to see whether we are able to access the WSDL of the BIP web services. To check this just open a browser and enter the below URL.

      http://localhost:9704/xmlpserver/services/PublicReportService?WSDL

      

Once this is done open up the JDev Tech Preview 3 Console and start with creating a new application (without any template). In my case the application and all the project names would be bipsoap.

      

Now create a new web service proxy. Here we would be entering all the details regarding the BIP WSDL.

      

Use JAX-RPC as the Web Service Client type and enter the WSDL URL that we used above. Do not make any changes to the port end points (every other step will be having the default values. No changes required).

      

Now this would automatically create a java file containing the relevant code. Now go to the main method of this java file and in the Try block enter the below piece of code

// @GeneratedBlockBegin (value={“oracle.j2ee.ws”} );
samplesoap.proxy.PublicReportServiceClient myPort = new samplesoap.proxy.PublicReportServiceClient();
// @GeneratedBlockEnd (value={“oracle.j2ee.ws”} );
String userName = “Administrator”;
String passWord = “Administrator”;

System.out.println(“calling ” + myPort.getEndpoint());
System.out.println(myPort.validateLogin(userName,passWord));

ReportRequest repReq = new ReportRequest();
ReportResponse repRes = new ReportResponse();

repReq.setAttributeFormat(“pdf”);
repReq.setAttributeLocale(“en-US”);
repReq.setAttributeTemplate(“World Sales”);
repReq.setReportAbsolutePath(“/Sales Manager/World Sales/World Sales.xdo”);

repRes = myPort.runReport(repReq,userName,passWord);
System.out.println(repRes.getReportContentType());

byte[] binaryBytes = repRes.getReportBytes();
OutputStream out = new FileOutputStream(“D:\\out.pdf”);
out.write(binaryBytes);
out.close();
System.out.println(“Success for Run Report”);

What this code does it runs the World Sales report (present under Sales Manager -> World Sales) and exports it into PDF format in the local D drive. Lets try to understand the code above.

   samplesoap.proxy.PublicReportServiceClient myPort = new samplesoap.proxy.PublicReportServiceClient();

The above instantiation opens up myPort which would your service handle. So, in JDeveloper if you type myPort. and press Ctrl+Space you can find all the methods that have been exposed in the BIP webservice.

      

Now compile this report and run it. If you get Success for Run Report in the output window, then go to your D drive. You would find out.pdf which would contain the report in a PDF format.

      

      

Very simple but again can be very useful when you are doing custom integration. You dont have to have any more of xdo related jar files in your code (Java APIs). All you need is the service handle!!!

Advertisements

25 Responses to “Oracle BI Publisher 10.1.3.3.1 – Creating Applications using JDeveloper 11g and Web Service SOAP APIs”

  1. Tapasvi said

    Is it possible to render a BI Publisher report inside HTML DB (APEX) application ?

    I am trying to achieve this by creating a web service based form and report page but not successful so far 😦

    I could successfully test only “validateLogin” and “hasReportAccess” method. runReport method gives ORA-20001: soapenv:Server.userExceptionjava.lang.NullPointerException error..

  2. edhig said

    Hi Venkatakrishnan J,

    Another very interesting and innovative blog feature, thank you. I am an BIEE developer but I am a JDev newbie, so thought I would try this out, I have installed the same version of JDeveloper as you but I am getting errors in the Extensions log when the project is created,

    Oracle.sqldeveloper – Error:’update-hook’in namespace ‘http:77xmls.oracle.com/ide/update-hook’ is not a recognized hook.
    oracle.bpm.workflow – Warning: Classpath entry c:\JDEV\BC4J\jilib\adfmtl.jar not found.

    I have no idea what the first error means, as fôr the missing .jar file, does this mean I have messed up the installation somehow?

    Any help appreciated, thanks
    Ed

  3. Venkatakrishnan J said

    Ed – How did you install JDev(it is a plain normal extract)? Did you make any changes to the jars? Looks like a jar file is missing in your jdev environment.

  4. edhig said

    I followed the installation guide precisely (I thought)using the zipped up download extracted into my folder C:\JDEV, I haven’t modified anything, perhaps I should just remove it and try again?
    thanks
    Ed

  5. edhig said

    I have just found another document at http://www.oracle.com/technology/products/jdev/htdocs/11tp/readme
    that says these are known issues, I’ve often wondered why they call those docs read me……
    sorry

  6. kpb said

    Hi,
    I’ve download file
    http://localhost:9704/xmlpserver/services/PublicReportService?WSDL
    during proxy creation I’ve got ex.:

    The WSDL document contains the following errors:
    Operation “validateLogin” and “getReportMetaData” have conflicting SOAPAction values. Don’t overload any operation or give unique SOAPAction value to each operation binding.

    If I try to generate from server (using url http://localhost:9704/xmlpserver/services/PublicReportService?WSDL) –
    just nothing happens, when I press “Next >”

  7. Venkatakrishnan J said

    @Kpd- Are you on a dhcp? Also, do you see the WSDL in IE on your server? Do you get the error only in JDev or even while accessing the WSDL directly?

  8. kpb said

    just from jdev. I’ve solved my problem by configuring proxy settings in jdev

  9. cc said

    Does everyone try to generate from server (using url http://localhost:9704/xmlpserver/services/ReportService?WSDL) ,when I do it,The WSDL document contains the following errors:
    Operation “validateLogin” and “getReportMetaData” have conflicting SOAPAction values. Don’t overload any operation or give unique SOAPAction value to each operation binding.

  10. Venkatakrishnan J said

    Which version of BIP are you using? Is it by any chance on 10.1.3.3.1? I think this release had some issues with ip conflicts and web services. Upgrade to 10.1.3.3.2 and it should work.

  11. KB Prasad said

    Hi, Can you show the example of some program in JDeveloper that invokes the deployed webservice without using Apache Axis.

  12. Pooja said

    Hi Venkatakrishna,

    I have a requirement of calling a BIP report through an iBot in OBIEE. I followed the steps mentioned by you above for creating a web service and it works fine when i exceute it in Jdeveloper (i.e., my local system). But when i register the same java program which calls the web service as an iBot in OBIEE, it errors with the error “Provider oracle.j2ee.ws.client.ServiceFactoryImpl not found”. Am not sure where am missing or doing wrong.

    Can you please help me in resolving this issue as this is highly urgent for me to deliver it to the client.

    Thanks for your help in advance…

    Pooja.

  13. Matthias said

    Hello allltogether,

    nice sample. http://localhost:9704/xmlpserver/services/ReportService?WSDL) doesn’t work for me.
    Getting the error:

    AXIS error

    Sorry, something seems to have gone wrong… here are the details:

    Fault – ; nested exception is:
    oracle.xml.parser.v2.XMLDOMException: Implementation does not support the object requested.

    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: oracle.xml.parser.v2.XMLDOMException: Implementation does not support the object requested.
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname:localhost

    that may mean to register by wsdl config file. After adding most available jar files to my classpath the following objects remain unresolved:

    com.oracle.xmlns.oxp.service.PublicReportService.*
    oracle.xdo.server.*

    Any ideas ?

    Thanks in advance.

    Mats

  14. Paulo Domingues said

    Hi Venkatakrishnan J,

    I am a newbie to Jdev in particular and to Java in general 🙂

    I am having a problem using your example both in JDev 11g TP4 and in JDev 11g Production.

    This is my Try block that I just rearranged to my needs

    // @GeneratedBlockBegin (value={"oracle.j2ee.ws"} );
    sisvendas.proxy.PublicReportServiceClient myPort =
    new sisvendas.proxy.PublicReportServiceClient();
    // @GeneratedBlockEnd (value={"oracle.j2ee.ws"} );
    String userName = "Administrator";
    String passWord = "Administrator";

    System.out.println("calling " + myPort.getEndpoint());

    System.out.println(myPort.validateLogin(userName, passWord));

    ReportRequest repReq = new ReportRequest();
    ReportResponse repRes = new ReportResponse();

    repReq.setAttributeFormat("PDF");
    repReq.setAttributeLocale("en-US");
    repReq.setAttributeTemplate("OperadoresTable");
    repReq.setReportAbsolutePath("/~Administrator/SisVendas/Operadores/Operadores.xdo");

    repRes = myPort.runReport(repReq, userName, passWord);
    System.out.println(repRes.getReportContentType());

    byte[] binaryBytes = repRes.getReportBytes();
    OutputStream out = new FileOutputStream("C:\\Operadores.pdf");
    out.write(binaryBytes);
    out.close();
    System.out.println("Success for Run Report");

    In JDev TP4 it runs ok but the pdf file is 0 bytes length although it runs just fine in my BI Publisher

    In Jdev 11g Production I am having trouble in creating the proxy! 😦
    It does not generate the PublicReportServiceClient.java.

    In both cases I am using JAX-RPC as my client.

    I realized that there is a difference between TP4 and Production:
    When I get to specify the package name TP4 gives access to all the options in the page as with Production it just gives me access to put the package name.

    any ideas?

    TIA
    Paulo Domingues

  15. Last week Microsoft posted useful documentations on technet. Title Description Logical Architecture Sample Design: Corporate Deployment ( Illustrates a generic corporate deployment of Office SharePoint Server 2007. The model applies nearly all of the logical architecture components and illustrates how these are incorporated into the overall design. Use this model with the following article: Logical architecture model: Corporate deployment. Architecture Design Example: Twynham School (U. K.) ( Illustrates the…

  16. Cory Max said

    Paulo Domingues: You mentioned that you were getting a 0 bytes file. I also had the same problem. Found another example on the net (they are sparce) and found that they were setting this property as well. After setting this property, it worked for me:

    reportRequest.setSizeOfDataChunkDownload(-1);

    Cheers,

    Cory

  17. Cory Max said

    BTW, I found that this parameter was needed here:

    http://www.oracle.com/technology/products/xml-publisher/docs/Forms_BIP_v22.pdf?bcsi_scan_1DDFD0EA4EE68C93=rbLUmRJlMaTVZ/WpnsMyantQYi0ZAAAAZWqkAQ==&bcsi_scan_filename=Forms_BIP_v22.pdf

    Here is an exerpt:

    Starting with BI Publisher 10.1.3.4 there is a new and important parameter in the type ReportRequest –
    SizeOfDataChunkDownload. According to the documentation it should be set to -1 if you don’t want
    to chunk the resulting data. Otherwise BI Publisher will produce a correct outfile but you will never
    seen anything from it in your resulting document. If you use an earlier version of BI Publisher you can
    skip this parameter.

    Hope this helps!

    Cheers,

    Cory

  18. Paulo Domingues said

    Hi Cory,

    Great tip! Thanks a lot 🙂

    In my Jdeveloper 10g app I have my reports up and running! 🙂

    I’m still in trouble with JDeveloper 11g though.
    All manuals indicate that there should be a PublicReportServiceClient.java file but the wizard in JDeveloper 11g (v.11.1.1.0.1) does not create that file.
    Will it be because my BI Publisher is running on OC4J while my app is running on Weblogic?
    Do the web services proxies work in a different way with Weblogic?

    Again, thanks in advance
    Paulo Domingues

    • Dan Hildreth said

      I have the same issue with JDeveloper 11g (v.11.1.1.0.1). I am not able to create either a JAX-RPC or a JAX-WS that is capable of returning the bytes in the ReportRequest class. Doesn’t appear that the WebService proxy wizard is doing something right.

      I can schedule reports and access a lot of other information via the web service. It just doesnt handle the ReportResponse properly. Anyone have any ideas or had success with 11g and BI Publisher Web Service calls?

  19. shattered said

    Hi
    Is there any possibility to run/schedule report through bursting using java code as above. i need to run report and want to be able to select values from LOV’s created in the report just like i can do through BI Publisher using bursting and scheduling?

    Is there any possibility?

  20. Abhishek said

    code compiled. executed successfully. out.pdf created but it is of size 0 bytes. why??

  21. Anupam said

    Hi Venkat,

    Your blog was really helpful.
    I have one question though. If I have already enabled bursting in Bi Publisher, how will it get affected if I am using it with J developer?
    Will the path over ride the one given in the bursting in the BI publisher?

    Regards,

    Anupam

  22. Srinath Rao said

    Venkat,

    Thanks for POST.

    We have a issue in our server.

    When we launch http://my_server:9704/xmlpserver/services/ReportService?WSDL

    getting following error instead of the xml page.

    We using

    Oracle BI Publisher 10.1.3.3.2

    Please help us what went wrong in our installation…

    Thanks in advance
    Srinath Rao

    AXIS error
    Sorry, something seems to have gone wrong… here are the details:

    Fault – ; nested exception is:
    oracle.xml.parser.v2.XMLDOMException: Implementation does not support the object requested.
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: oracle.xml.parser.v2.XMLDOMException: Implementation does not support the object requested.
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname:bsflxas1

  23. Srinath Rao said

    Above problem resolved.

    I just upgraded to 10.1.3.4.1

    Regards
    Srinath Rao

  24. Raj said

    Im facing problem with getreportparameters method.It is returning NULL.

    Kindly help.

    Thanks in ADvance.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: