Using the code samples in Java

After you install and configure your development environment, you can use the code samples in the BlackBerry® Administration API Development Guide to start building your applications. All of the Java code samples in this guide use Apache CXF™ as the web service framework. Other frameworks might package requests differently.

Many code samples in the BlackBerry Administration API Development Guide use a string named locale. This string represents the region and language that you want your API request to apply to. For example, the string "en_US" represents the United States and the English language. To view all the locales available on your BlackBerry® Enterprise Server, you can use the findLocales() method in the utilws web service.

The code samples provided use the following web service instances:
  • coreWebService
  • dispatcherWebService
  • emailDominoWebService
  • emailExchangeWebService
  • utilWebService

You can create instances only of the web services that you included when you generated the client proxy. You should not have multiple email web services. However, the methods in the email web services can be used interchangeably in most cases .

Code sample: Creating a web service instance

The following code sample creates the coreWebService instance.

public static BAAServiceCore serviceCoreWebService;
public static BAACore coreWebService;
URL coreUrl = null;
try 
{
   coreUrl = new URL("https://" + strBASURL + "/baaws/core/ws?wsdl");
} 
catch (MalformedURLException e) 
{
   System.err.println("Cannot initialize the wsdl");
   return false;
}
serviceCoreWebService = new BAAServiceCore(coreUrl);
coreWebService= serviceCoreWebService.getCore();

Was this information helpful? Send us your comments.