Samples for Java (SOAP) v1
Preparing your environment
To set up your environment, install the following packages:
-
Java 1.5 or higher http://java.sun.com/javase/downloads/index_jdk5.jsp
-
Axis2 1.4.1 or higher http://www.apache.org/dyn/closer.cgi/ws/axis2/1_4_1
Generating Client-Side Stub Classes for Urchin Data API Services
To access Urchin Data API services, you need to invoke a remote call on SOAP or HTTP. To perform this, the client must have the Web Service endpoint location and a handle to the Web Services interface. These remote interfaces, client side service locators, and stubs are generated by the WSDL2Java tool that is provided by Axis.
To generate the Client-Side stub classes:
1. Navigate to "%AXIS_HOME%\bin" directory
2. Run the following command for generating AdminService client-side stub class:
wsdl2java -uri http://server[:port]/services/v1/adminservice?wsdl -d adb -p com.google.urchin.dataapi.soap -s -S .
3. Copy the generated AdminserviceStub.java and ApiFaultException0.java into the project folder and add it to the project.
4. Run the following command for generating the ReportService client-side stub class:
wsdl2java -uri http://server[:port]/services/v1/reportservice?wsdl -d adb -p com.google.urchin.dataapi.soap -s -S .
5. Copy the generated ReportserviceStub.java and ApiFaultException0.java into the project folder and add it to the project.
The following stub class sample code files are generated by the WSDL2Java tool for the Urchin Data APIs services:
-
AdminServiceStub.java – Java stub class for AdminService API.
-
ReportServiceStub.java – Java stub class for ReportService API.
-
ApiFaultException0.java - API Fault class for Data API Services.
Java Client Examples
After generating the client-side stub classes, you can create an application.
-
SOAP Example 1 (v1): Retrieving the list of accounts for an authenticated user
-
SOAP Example 2 (v1): Retrieving the list of profiles for a specified account
-
SOAP Example 3 (v1): Getting a list of tables for a profile and the supported dimensions/metrics
-
SOAP Example 4 (v1): Retrieving data for specified dimensions and metrics