Using SES web services in Eclipse/Workshop for WebLogic

A customer wanted to know how to expose functionality from Oracle's Secure Enterprise Search in WebLogic Portal. A simple solution would be to simply iFrame up the standard SES search page but it is nice to be able to have a more integrated solution using custom code. Turning down the web services road I built some simple JSP pages to demonstrate functionality from SES. However my initial attempt was to try and create valid Java stubs using Axis/Axis2 libraries. The WSDL exposed from SES wasn't easily consumed in Workshop for WebLogic (basically Eclipse with a LOT of Oracle WebLogic and Portal plugins). SES has a hosted page with all the service descriptions and there is a pre-built jar referenced from this page. Always the way isn't it? You spend hours trying the difficult route for a simple solution to be right under your nose.

So the challenge was to get a JSP page running in WebLogic server, exposed via WebLogic Portal communicating with Oracle's Secure Enterprise Search. Once I had actually got the right way to do it sorted, the process was pretty simple. First a few useful URLs;

This is the end point for all web service requests and also exposes some nice test pages and links to the client jar.

http://ses.server.com:7777/search/query/OracleSearch

From here you can get access to the WSDL by clicking on the Service Description link, e.g.

http://ses.server.com:7777/search/query/OracleSearch?WSDL

Preparing your project with the right libraries


I started with a blank Dynamic Web Project in Workshop. I needed to collect the right jar files for me to be able to communicate to the SES server. The following files are found on the SES server, the main set of jars are located in;


%ORACLE_HOME$\ses1\oc4j\webservices\lib
-rw-rw-r-- 1 oracle oinstall 38015 Oct 21 2008 commons-logging.jar
-rw-rw-r-- 1 oracle oinstall 4033 Oct 21 2008 futils.jar
-rw-rw-r-- 1 oracle oinstall 30154 Oct 21 2008 jaxr-api.jar
-rw-rw-r-- 1 oracle oinstall 28655 Oct 21 2008 jaxrpc-api.jar
-rw-rw-r-- 1 oracle oinstall 28288 Oct 21 2008 JMXSoapAdapterShared.jar
-rw-rw-r-- 1 oracle oinstall 8521 Oct 21 2008 jws-api.jar
-rw-rw-r-- 1 oracle oinstall 166913 Oct 21 2008 mdds.jar
-rw-rw-r-- 1 oracle oinstall 837178 Oct 21 2008 orajaxr.jar
-rw-rw-r-- 1 oracle oinstall 240434 Oct 21 2008 orasaaj.jar
-rw-rw-r-- 1 oracle oinstall 314362 Oct 21 2008 orawsdl.jar
-rw-rw-r-- 1 oracle oinstall 53448 Oct 21 2008 orawsmetadata.jar
-rw-rw-r-- 1 oracle oinstall 187083 Oct 21 2008 orawsrm.jar
-rw-rw-r-- 1 oracle oinstall 19255 Oct 21 2008 relaxngDatatype.jar
-rw-rw-r-- 1 oracle oinstall 16691 Oct 21 2008 saaj-api.jar
-rw-rw-r-- 1 oracle oinstall 345421 Oct 21 2008 soap.jar
-rw-rw-r-- 1 oracle oinstall 174290 Oct 21 2008 testpage.jar
-rw-rw-r-- 1 oracle oinstall 66659 Oct 21 2008 WebServicesAssembler.jar
-rw-rw-r-- 1 oracle oinstall 797326 Oct 21 2008 wsa.jar
-rw-rw-r-- 1 oracle oinstall 2337820 Oct 21 2008 wsclient.jar
-rw-rw-r-- 1 oracle oinstall 594 Oct 21 2008 wsdl2ejb.jar
-rw-rw-r-- 1 oracle oinstall 143102 Oct 21 2008 wsdl.jar
-rw-rw-r-- 1 oracle oinstall 404222 Oct 21 2008 wsif.jar
-rw-rw-r-- 1 oracle oinstall 2233 Oct 21 2008 wsil-ias.ear
-rw-rw-r-- 1 oracle oinstall 2053 Oct 21 2008 wsil-ias_jsso.ear
-rw-rw-r-- 1 oracle oinstall 2618 Oct 21 2008 wsil-install.xml
-rw-rw-r-- 1 oracle oinstall 1414 Oct 21 2008 wsil-standalone.ear
-rw-rw-r-- 1 oracle oinstall 4662 Oct 21 2008 ws-jaxrpc-shlib-patch.xml
-rw-rw-r-- 1 oracle oinstall 7870 Oct 21 2008 wsm-handler.jar
-rw-rw-r-- 1 oracle oinstall 310377 Oct 21 2008 wssecurity.jar
-rw-rw-r-- 1 oracle oinstall 866934 Oct 21 2008 wsserver.jar
-rw-rw-r-- 1 oracle oinstall 242055 Oct 21 2008 xsdlib.jar

There is one more file I need for the project, http_client.jar located in;

/oracle/ses1/oc4j/j2ee/home/lib
-rw-rw-r-- 1 oracle oinstall 336666 Oct 21 2008 http_client.jar

I was working purely in a project that was for SES and so I was able to copy all the above jars into my WebContent\WEB-INF\lib folder. You might need to hand pick specifically some of the Oracle libs if you have some of these libraries already.

The last jar we need is the OracleSearch.jar client itself. You access this from the service descriptions page described above, the URL would be;

http://ses.server.com:7777/search/query/OracleSearch?proxy_jar

Simple SES search using web services


Now that we have all the libraries in the project, we can write a little bit of code to do a search. I ripped some code from the SES documentation and then made appropriate JSP changes.

The main piece of code of interest is;

//
// Create the Oracle SES Web Services client proxy
//
OracleSearchServiceProxy proxy = new OracleSearchServiceProxy();
proxy._setSoapURL("http://ses.server.com:7777/search/query/OracleSearch");

//
// Get the search result by calling OracleSearchService.doOracleSearch()
//
OracleSearchResult result = proxy.doOracleSearch(searchTerm,
new Integer(1),
new Integer(10),
Boolean.TRUE,
Boolean.TRUE,
null,
"en",
"en",
Boolean.TRUE,
null,
null,
null);
//
// Get the estimated hit count by calling OracleSearchResult.getEstimatedHitCount()
//
estimatedHitCount = result.getEstimatedHitCount();

// Get the search results
resElemArray = result.getResultElements();

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Simon Thorpe, senior consultant at Oracle, blogs about simple and useful tips when working with Oracle technology.

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today