About
The aim of this article is to show how with WTP, the Web Tools Platform Plugin of Eclipse, you can consume a web service. All the details about the Web Service Subproject can be found on this page.
For this purpose, we will use the Web Service that offer OBIEE.
Articles Related
How to
Install / Download WTP
First, you need to install WTP:
or you can just download a complete bundle.
You will find for instance in WTP:
- The Jst Server: J2EE Server Tools framework and adapters for selected popular J2EE servers such as Apache Tomcat and OC4J
Creation of a project
First, we need to create project that support the web service. If you go to the preference (Menu/Window/Preference), you can see in the Project Toplology of the web service, that you can use three type of client :
- Dynamic Web Project
- JPA Project
- Java Utility Project
Therefore, we start by creating a java utility project : Menu / File / New Project / Java EE / Utility Project
I use the OC4J server of OBIEE. If you don't know how to configure OBIEE to use OC4J, you can have a look to this article : Eclipse - How to add OC4J as an Eclipse server
Web service client wizard
Then, we have to consume the web service by launching the new web service client wizard and giving it the WSDL file location. For OBIEE, the web service URL is in the form :
http://obiee_host:port/analytics/saw.dll?WSDL
The WSDL contain the complete definition of all class and function that provide the Web Service. More about WSDL ….
Right click on your project, New / Others / Web Service / Web Service Client
Next, we give the web service URL :
http://obiee_host:port/analytics/saw.dll?WSDL
The level must be by default on “Deploy Client”.
Next, check the check box “define custom mapping for …”.
In the next step, you have to enter the namespace of the OBIEE webservice implementation. You can find it in the WSDL file. Just enter the URI, in a browser and you will see in the first line the OBIEE WSDL namespace :
http://obiee_host:port/analytics/saw.dll?WSDL
In the above case, we fina that the namespace is com.siebel.analytics.web/soap/v5.
Then we click on the Add button and enter this values :
- namespace : com.siebel.analytics.web/soap/v5
- package : com.siebel.analytics.web.soap.v5
The name of the package must follow the Java rules. No slash as you can find in the namespace.
The result
When you click on the finish button, WTP will create all class and functions by parsing the WSDL file.
You are now ready to use them !