Java SOAP Quickstart Guide
Examples of how to use ListManager's functions with Java are available in your ListManager's soap directory:
http://yourlistmanagerurl/soap
These instructions show how to use a Java toolkit, Ant, with ListManager.
1. Install Ant:
http://ant.apache.org/
2. Make sure ant is in your path.
3. Install the following software from Sun:
SOAP with Attachments API for Java (SAAJ)
Java Architecture for XML Binding (JAXB)
Java API for XML-based RPC (JAX-RPC)
Java API for XML Processing (JAXP)
Java API for XML Registries (JAXR)
4. Install Apache Axis.
5. Create a directory (e.g., c:\temp\lmapiTests).
6. Copy the file build.xml from your ListManager server to your lmapiTests directory. This file is available at:
http://yourlistmanagerserver/soap/java/build.xml)
Modify the URL above so yourlistmanagerserver points to the URL for your ListManager installation.
7. Modify build.xml to reflect where you installed the Java libraries in step 3.
8. In your directory (c:\temp\lmapiTests) run:
java org.apache.axis.wsdl.WSDL2Java http://yourlistmanagerserver/soap/wsdl/ -plmapi
Modify the URL above so yourlistmanagerserver points to the URL for your ListManager installation.
9. wsdl2Java creates a directory named lmapi. In lmapi/, create a file named Client.java.
10. build.xml is already set up to use Client.java as the program entry point.
11) In your directory (c:\temp\lmapiTest) type "ant" to run the program.
The following is the minimal client script for Java:
----JAVA-----
package lmapi;
import java.util.*;
import org.apache.axis.client.Stub;
public class Client {
// static means class global variables, it does not change between instances.
public static String userName ="admin";
public static String password = "lyris";
public static String apiVersion = "1.0 Beta";
public static void main (String [] args) throws Exception
{
// Make a service
service = new LmapiLocator();
try
{
// Get a stub that implements the service operations
lm = service.getlmapiSoap();
// Lyris Api uses authorization
((Stub)lm).setUsername(userName);
((Stub)lm).setPassword(password);
// make sure we are using the right version
if ( apiVersion.compareTo(lm.apiVersion()) == 0 )
{
// run code here
} else {
System.out.println("Bad API version!! Expected '" + apiVersion
+ "', but got: '" + lm.apiVersion() + "'");
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
----END JAVA-----
![]() ![]() |