Sunday, 19 April 2009

ODI Series - Web Services Part 2

Last time I went through setting up axis2 web services with ODI and how to execute services using a SOAP utility, if you are ever considering developing your own application and there is a requirement to execute ODI scenarios then you could either do this directly by using the Java invocation API but this relies on there being availability of a tcp/ip connectivity to the ODI agent, this is not always going a viable solution so using a web service can be a more appealing option.

You can obviously handle SOAP requests with one of the multitude of programming languages out there but I am going to show how this can be done with Java, mainly because I am a convert to Java, I am trying to improve my skills in this area and it fits in well with the Oracle EPM APIs.

Firstly the standard distribution of Axis 2 is required, in the previous blog I downloaded the war file but this doesn’t contain all the required Java packages.



Once the distribution files have been downloaded and extracted then what we need is some method in which a Java API can interact with the ODIinvoke web service, luckily included with axis2 is a useful utility that converts a WSDL to Java, aptly named WSDL2Java.

The utility will create what is known as a client stub, which is basically a Java class that contains all the information to communicate with the web service and its operations.

The syntax to create the stub is :- WSDL2Java -uri <wsdl location> -p <name-of-package-to-create-stub-in> -d adb –s –o <location-of-output>

The –d adb parameter specifies to use the ADB data binding method to create the client (if you want to understand more about the different methods information is available in the axis2 documentation, it certainly goes into far more depth than I can handle today)

The –s parameter stands for synchronous method so the client will wait for a response from the web service before continuing.



Running the utility outputs three files to the directory specified and creates the package structure.



Each file represents a different type of protocol that can be used; I am going to use the SOAP1.2 just because it is the latest and probably more robust, I wouldn’t be too concerned about what is in the java files unless you are a Java guru and wish to reach enlightenment.

Now we can move on to writing some simple Java, depending on what Java IDE you are using you will need to add the axis2 jar files and include the include the generated stub.

If you followed the blog where I used the Java ODI invocation API then using this client follows pretty much the same concept.



What I am going to do first is to retrieve a list of available scenarios that can be executed.

When creating a new instance of the OdiInvokeOdiInvokeSOAP12Port_httpStub class it requires one String variable in the constructor and that is the URL of the web service that is going to be invoked.



Once you have created the instance, you can view the methods that are available.



listScenario is the method to retrieve the available scenarios though this requires an instance of ListScenarioRequest to be passed into it.

ListScenarioRequest has a method call setListScenarioRequest that requires an instance of RepositoryConnectionType3 to be passed into it.

I am not sure why it is done like this or it a fault of the conversion of the WSDL but there are three different classes of RepositoryConnectionType, to use the ListScenarioRequest you need to use 2 and 3.



RepositoryConnectionType2 has a number of methods to set items such as the ODI username/password, JDBC connection details.



RepositoryConnectionType3 you can set the work repository.



Basically what we are doing the same details as when I set up the SOAP request in the previous blog.



The only difference is that we are using the various methods of the class to populate this information.



Once all the information has been passed into the methods, the web service can be invoked and the response dealt with.



The request is sent by using the listScenario method and a response is returned with an object type of ListScenarioResponse, this contains a method to retrieve an array of Scenario Types, then all I do is iterate through each scenario type and output the Scenario name and version.



You can easily convert this to say a jsp script that displays the scenarios in a drop down box ready to be executed from a web page.



Running a scenario follows the same concept and is exactly the same as using the invocation API, to run a scenario you could put something like this together.



Combining the listing of scenarios and executing a scenario you could update the jsp script to execute a scenario based on the selection from the dropdown, I am not going to show that because I feel I am done for today and hopefully it has given you an insight into how you can work with Java and the ODI web services.

Next time I am going to take you through Data Services in ODI and go through step by step on setting it up.

8 comments:

Deca said...

hi

this image

http://1.bp.blogspot.com/__2AaArK5lW8/SetvVC4rkSI/AAAAAAAABU4/bt36GtodXqU/s1600-h/5.png

has got the wrong import. You don't need final .*

Charles (charles_ormsby@isaconsulting.com) said...

Hi,

We are using Axis2 in between a .Net web app to pass four parameters to an ODI scenario. I am using SOAPUI to remove the web app from the testing process. Everything is working well except for the fact that only the last variable in the XML is ever read and stored in the ODI scenario execution. Below is a sample of our XML variable setup. In the ODI scenario we declare each of the four variables in the first four steps of the package (which I read somewhere was the proper setup). Regardless, if I remove the last two variable in the XML then only the second variable "v_HFMI_Fiscal_Year" is stored properly and the first is ignored. Furthermore, if I remove the last variable then the third is stored properly and the first two are ignored. Can anyone help?

Mike said...

What is the proper procedure for stopping a running scenario on a production server where ODI developer is not installed other than restarting the ODI agent service on the server and closing the DOS window?

Thank you very much for this blog! Much appreciated!

123 said...

喇叭網 金屬擴張網Plastic injection Mold developmentInjection Mold Plastic injection molding Injection molding ISO9001認證 射出成形 塑膠製成品塑膠模具設計 模具開發 精密射出 縫衣機塑件Industrial PCB Heavy Copper PCB Microwave PCB Medical PCB 膠框創業 加盟 早餐店加盟 meat processing equipment food processing mixers 化糞池 通馬桶
導光板 化妝品盒 藥盒 燈具 禮盒 印刷供應商 彩色盒 禮盒 設計 網版印刷 紙盒工廠 印刷公司

123 said...

宜蘭民宿 宜蘭住宿 網路訂房 宜蘭飯店 新娘祕書 清潔公司 植牙 裝潢 室內設計 油漆粉刷 油漆工 油漆工程 洗鞋加盟 洗包包加盟 洗包包 創業加盟店 早餐店加盟 開店創業 創業開店 結婚金飾 鑽石婚戒 通水管 通水管 通馬桶 抽水肥 包通 馬桶不通 通馬桶 通水管 清水溝 沙發 室內設計公司 室內設計 室內裝潢設計 裝潢設計 澳門自由行 搬家公司 搬家公司 台北搬家公司 新竹搬家公司 桃園搬家公司 香港自由行太陽能熱水器 三久 櫻花牌熱水器

123 said...

seo 網站設計 超耐磨地板 店面出租 乳癌 全身健康檢查 自由行 三久 太陽能 三久太陽能 太陽能熱水器 環保袋 慈善基金會 慈善機構 租辦公室 租店面 買辦公室電波拉皮 hand dryer 電波拉皮 雷射溶脂 肉毒桿菌 系統家具 台中漆彈場 漆彈 團體服 團體服 團體服 T恤 圍裙 網路行銷 中古車 涼麵 POLO衫 班服 團體服創意 熱轉印 團體服訂做 宜蘭民宿 關鍵字廣告 seo seo 線上客服 seo 網頁設計 seo 網頁設計公司

123 said...

熱水器 省電熱水器 衛浴設備 節能減碳 電熱水器 中古車 義賣 義賣活動 二手車 環保袋 環保袋 環保袋 十分瀑布 台北旅遊網 月子餐 飛梭雷射 太陽能熱水器 太陽能 三久太陽能 三久 身體檢查 健康檢查 台北民宿 平溪 景觀餐廳 薰衣草花園 花園餐廳 螢火蟲 渡假村 鐵道之旅 團體服 滷味 滷味加盟 滷味批發 滷味食材 滷味宅配 滷雞翅 滷雞腳 健康滷味 魯味 加盟創業 慈善慈善機構 公益彩券

123 said...

房屋貸款 剖腹生產 姓名配對 星座 星座運勢 算命 素食料理 素食水餃 開運印章 風水 外遇 徵信 壁癌 屋頂防水 屋頂隔熱 抓漏 油漆 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 外遇 徵信 徵信社 清潔公司浴室 漏水 舊屋翻新 裝潢 防水工程 壁癌 健康飲食 台北素食餐廳 吃素 團購美食 水餃 素食素食食譜