2 import biz.freeside.SelfService;
3 import org.apache.commons.logging.impl.SimpleLog; // included in apache xmlrpc
4 import java.util.HashMap;
5 import java.util.Vector;
7 public class freeside_signup_example {
8 private static SimpleLog logger = new SimpleLog("SelfService");
10 public static void main( String args[] ) throws Exception {
12 new SelfService( "http://192.168.1.221:8081/xmlrpc.cgi" );
14 Vector params = new Vector();
15 params.addElement( "first" );
16 params.addElement( "Test" );
17 params.addElement( "last" );
18 params.addElement( "User" );
19 params.addElement( "address1");
20 params.addElement( "123 Test Street" );
21 params.addElement( "address2");
22 params.addElement( "Suite A" );
23 params.addElement( "city");
24 params.addElement( "Testville" );
25 params.addElement( "state");
26 params.addElement( "OH" );
27 params.addElement( "zip");
28 params.addElement( "44632" );
29 params.addElement( "country");
30 params.addElement( "US" );
31 params.addElement( "daytime" );
32 params.addElement( "216-412-1234" );
33 params.addElement( "fax" );
34 params.addElement( "216-412-1235" );
35 params.addElement( "payby" );
36 params.addElement( "BILL" );
37 params.addElement( "invoicing_list" );
38 params.addElement( "test@test.example.com" );
39 params.addElement( "pkgpart" );
40 params.addElement( "101" );
41 params.addElement( "popnum" );
42 params.addElement( "4018" );
43 params.addElement( "username" );
44 params.addElement( "testy" );
45 params.addElement( "_password" );
46 params.addElement( "tester" );
47 HashMap result = client.execute( "new_customer", params );
49 String error = (String) result.get("error");
51 if (error.length() < 1) {
55 String custnum = (String) result.get("custnum");
57 logger.trace("[new_customer] signup with custnum "+custnum);
61 // unsuccessful signup
63 logger.warn("[new_customer] signup error: "+error);
65 // display error message to user