Yahoo! Search Marketing

Sample Code: Java Client Application

To access Enterprise Web Services (EWS) using the sample Java client application, follow these instructions.

Environment

To set up your Java environment, install these packages according to the directions on their respective web sites:

We recommend that you use Java 1.5. We also recommend that you use Axis 1.4 to ensure that the sample client application compiles correctly.

Note: Contact your system administrator if you need help setting up your Java environment.

Source Code and Sample Data

For Java, the source code and sample data includes:

Build and Run

To build and run the Java client application:

1. Download the WSDLs for these Marketing API services to your local directory:

  • LocationService
  • CampaignService
  • AdGroupService
  • AdService
  • KeywordService
  • ExcludedWordsService

You may want to download all of the WSDLs if you plan to expand the sample client application to use more services.

2. Create the Axis client stub classes using Axis' wsdl2java with these arguments:

  • --NStoPkg http://marketing.ews.yahooapis.com/V4=com.yahoo.sm.ws.client
  • -o <dir you want to put the generated stubs>
  • -T 1.3
  • <location of WSDL file>

3. Download YahooEWSClient.java, MinBidJavaCode.java and sample data properties files (sample_data_*.properties), and save them to your local directory.

4. Make sure YahooEWSClient.java, MinBidJavaCode.java, the generated Axis stubs, and Axis are in your classpath.

5. Edit YahooEWSClient.java to contain your EWS credentials, which are defined near the top of the file:

  • USERNAME
  • PASSWORD
  • LICENSE
  • MASTER_ACCOUNT_ID
  • ACCOUNT_ID
  • MARKET
  • LOCALE

6. Compile YahooEWSClient.java and generated stubs.

7. Run the sample program using this command:

prompt> java com.yahoo.sm.ws.client.demo.YahooEWSClient

prompt> java com.yahoo.sm.ws.client.demo.MinBidJavaCode

Known Issues

There are no known issues at this time.