Custom Search

Friday, April 17, 2009



Hello there,

I decided to write this post based on Webservices for Data Integrator for Business Objects version 11.7 and how hard it was to find any information on the functionality Data Integrator offered with regards to webservices and the lack of any step by step instructions on how to set up a basic aspx page with a button that launches a BODI job of any sort.

For those who don't know,
Data Integrator (BODI in short) is an ETL application sold by Business Objects, which has now been bought out by the software group SAP.

The Webservices option of the application provides a more viable solution, to allow end users (the client), to have a bit more control over the Batch / Realtime jobs that are developed.

This can be acheieved useing aspx / html (or other code) with embedded SOAP calls, to interact with the Webservices and hence with BODI. Realtime services should be the option of choice if this scenario were to be used, but for this post I will go through the basics of getting a webpage in ASPX configured to run a Data Integrator (BODI) batch job.

If you seek any other information on the application or to find help using the product you can use the following links which should point you in the right direction.

BOB – Business Objects Forum
Data Integrator – SAP

How to Set up BODI Batch job for Webservices call.

  1. Login to the Data Integrator Administration panel and select WebServices



  2. Select the WSDL button on the right side. This will show you the WSDL XML page. Write down and take note of the WSDL link in the pages window title bar. Note: As an example below take note of everything from and including http:// through to and including wsdlxml. Then close the window.



  3. Select the Webservice tab and select Add Batch Job


  4. From the drop down menu select your repo in this case Test. Tick the option on for your batch job and then click on Add


  5. This will then return you to the Web Services section. You should then see your job available.


  6. There are a number of options available to you on this screen, the main option that you may want to enable is the Enable Job Attributes. This will allow you to call Job Attributes through Webservices to enable you to choose things such as which Jobserver to use and types of logging to use.
This ends the section on enabling your Batch job for WebServices.

Calling Enabled Batch Job using SOAP

In order to invoke the Batch Job using Data Integrator Webservices you should use Soapui to test that the WSDL has taken the Batch Job you have just added. You can obtain the freeware version of the application here
http://www.soapui.org/


  1. When you have downloaded soapui start up a new project in soapui





  2. Add the details of the wsdl that you took down earlier in the earlier section and click on OK.




  3. When you have clicked on OK soapui will then interrogate the WSDL and pull back all elements for the WSDL and batch jobs that the WSDL has had added to it (from the Admin Console earlier)If you then expand through the tree through BatchJobs you should locate your test Batch Job. When you expand your test batch job and select Request, you will see the type of request that the Webservice WSDL is expecting to launch your job. You can then use this to add to your custom ASPX page




Setting up the basic ASPX page


In order to develop the ASPX page I have used yet another free application, this time from Microsoft called WebMatrix.

WebMatrix is a handy little tool that enables you to create aspx pages and to use the language of your choice to code with. In this instance C#, check out Visual Web Developer Express edition as this is free as well but more powerful (I think it has replaced WebMatrix at the time of writing this.)

NOTE: I am not a web developer or ASP.NET developer and would strongly suggest visiting the WebMatrix and ASP.NET communities if you have any questions with regards to enhancing the code below and using it with different methods.

The code below provieds you with a simple button that when clicked launches the Batch job that you have updated the code with. When the button is clicked, it should invoke the Batch Job and also provide you with a UNIQUE PID of the process that the Job Server generates when processing your batch job. To find out more about the PID, this information should be available in the Business Objects Data Integrator help files.

The idea of this blog is to get you started and Googling (as I did) the best code snippets and solutions for your own deployment.

Below is the code for the ASPX page, where I have added comments relevant to where certain elements etc need to be changed according to your own Jobserver WSDL configurations.


I would strongly suggest that you talk to your IIS Administrator to ensure that he is happy to run the code and to also give you a hand with any possible issues that come up as he will have more experience setting up a Website to run such kinds of ASP.NET scripts.
I would advise setting this all up in a test environment to start with.

Be safe be sensible!
Remember if at first you dont succeed try try again!
Good luck - PHATZ


ASPX Template to call a Business Objects Data Integrator (BODI) Batch Job.
Copy and paste the below script in to notepad and adjust accordingly. Make sure to save with a .aspx extension

<%@ Page Language="C#" Debug="true" %>

<%@ import Namespace="System" %>
<%@ import Namespace="System.Xml" %>
<%@ import Namespace="System.Text" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Net" %>
<script runat="server">

void Button1_Click(object sender, EventArgs e)


//******************CREATED BY PHATZ*****************

//*********************COMMENTS********************

//This process kicks off when clicking on the button on the main page.
//In the script below make sure to change the references accordingly in ref to your job name
//Change MYJOB in the script to your job name. Once done then place this file in to the
//web directory you want to test this from. In this case create a folder in the wwwroot folder on your IIS server
//relevant to your project name and place it in there. Then from your local web browser browse to the file and run



//************************************START OF CREATE XML SOAP ENVELOPE STRING*************************
{

string xmltosend;
xmltosend=Request.Params["xmltosend"];


//************************************START OF XML SOAP ENVELOPE HEADER CODE DO NOT CHANGE*************************

xmltosend = "<?xml version='1.0' encoding='utf-8'?>";
xmltosend += "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";
xmltosend += "xmlns:xsd='http://www.w3.org/2001/XMLSchema' ";
xmltosend += "xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>";
xmltosend += "<soap:Body><SDC_Process xmlns='http://www.businessobjects.com/DataIntegrator/ServerX.xsd' />";

//************************************END OF XML SOAP ENVELOPE HEADER CODE DO NOT CHANGE*************************


//Place your chopped up XML here appending with Variable xmltosend += Basically to
//build yor XML strcuture up in the xmltosend variable
//remember you got this from soapui, The example below shows the call that would
// be made if the Job had its Attributes enabled, however just
//to test you can comment these all out including the GLobal variables just to see if it can at least initiaite the call
// This example shows how to use the Job Parameters which you must enable in BODI Admin on the Batch Job
// in Webservices by selecting Enable Job Attributes for your job
// It is recommended that you use SOAPUI to get the exact SOAP message inputs to feed to your batchjob
//Change MYSYSTEMPROFILE to the system config you use in your batch job, do the same for MYJOBSERVER

xmltosend += "<job_parameters>";
xmltosend += "<!--Optional:-->";
xmltosend += "<job_system_profile>MYSYSTEMPROFILE</job_system_profile>";
xmltosend += "<!--Optional:-->";
xmltosend += "<sampling_rate>?</sampling_rate>";
xmltosend += "<!--Optional:-->";
xmltosend += "<auditing>?</auditing>";
xmltosend += "<!--Optional:-->";
xmltosend += "<recovery>?</recovery>";
xmltosend += "<!--Optional:-->";
xmltosend += "<job_server>MYJOBSERVER</job_server>";
xmltosend += "<!--Zero or more repetitions:-->";
xmltosend += "<trace>?</trace>";
xmltosend += "</job_parameters>";

//If you are using Global Variables append these to the xmltosend variable here - as you would see in soapui

xmltosend += "<MYJOB_GlobalVariables>";
xmltosend += "<G_VAR1>MYVARIABLETEXT</G_VAR1>";
xmltosend += "<G_VAR2>MYVARIAbletext2</G_VAR2>";
xmltosend +="</MYJOB_GlobalVariables>";


//***********START OF XML SOAP ENVELOPE FOOTER DO NOT CHANGE STRING*************************
xmltosend += "</soap:Body></soap:Envelope>";
//************ENDOF XML SOAP ENVELOPE FOOTER DO NOT CHANGE STRING*************************

HttpSOAPRequest(xmltosend,null);
}

//************************************END OF XML SOAP ENVELOPE STRING*************************

//*****************************************************************************************************

//************************************CREATE POST OBJECT & POST XMLSTRING HERE*************************

void HttpSOAPRequest(String xmltosend, string proxy)
{
XmlDocument doc = new XmlDocument();

doc.LoadXml(xmltosend);

//This is where you put the WSDl ref address from BODI Admin from the WSDL titlebar as described earlier in the blog.
//Remeber to change this relevant to your correct WSDL address - note the variable xmltosend is added to the end of the address

HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://webservi:28080/diAdmin/servlet/webservices?ver=1.1&xmltosend");

if (proxy != null) req.Proxy = new WebProxy(proxy,true);

//Change the job ref MYJOB here to your job ref name
req.Headers.Add("SOAPAction","job=MYJOB");

req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";

Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);

Response.Write(r.ReadToEnd());


}

//*************************************************************

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:Label id="Label1" runat="server" text="Add Comments" width="264px"></asp:Label>
</p>
<p>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Run MY JOB NAME"></asp:Button>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
</form>
</body>
</html>














DISCLAIMER








All data and information provided on this site is for informational purposes only. http://bodiwebservices.blogspot.com/ makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.