I'm trying to learn how to use SOAP to talk to the zimbra server by studying the Tester.java class. I can run it and part of it works, but I get an exception when it tries to upload an attachment around line 668.
The code is:
// add an attachment. XXX hardcoded stuff...
String aid = smr.postAttachment("https://zm.humboldt.edu:7071/service/upload",
session, new File("/home/paj1/zimbra/com/zimbra/cs/client/soap/Tester.java"), ".humboldt.edu", 5000);
System.out.println("got back attachment id " + aid);
lMsg.setAttachmentIDs(new String[] { aid});
System.out.println("got back attachment id 1" );

LmcSendMsgResponse smrResp = (LmcSendMsgResponse) smr.invoke(serverURL);

and the exception is:
got back attachment id tml><head><script language='javascript'>
function doit() { window.parent._uploadManager.loaded(401,'null'); }
</script></head><body onload='doit()
got back attachment id 1
com.zimbra.common.soap.SoapFaultException: invalid request: invalid upload ID: tml><head><script language='javascript'> function doit() { window.parent._uploadManager.loaded(401
ExceptionId:btpool0-65:1211398224679:84d5cd63bcd864fc
Code:service.INVALID_REQUEST
at com.zimbra.common.soap.Soap12Protocol.soapFault(So ap12Protocol.java:88)
at com.zimbra.common.soap.SoapTransport.extractBodyEl ement(SoapTransport.java:245)
at com.zimbra.common.soap.SoapTransport.parseSoapResp onse(SoapTransport.java:221)
at com.zimbra.common.soap.SoapHttpTransport.invoke(So apHttpTransport.java:251)
at com.zimbra.common.soap.SoapTransport.invoke(SoapTr ansport.java:297)
at com.zimbra.common.soap.SoapTransport.invoke(SoapTr ansport.java:261)
at com.zimbra.cs.client.soap.LmcSoapRequest.invoke(Lm cSoapRequest.java:142)
at com.zimbra.cs.client.soap.Tester.main(Tester.java: 620)


clearly, the postAttachment method is not returning a valid attachment id so the invoke method is failing. I'm assuming my parameters to the postAttachment method are incorrect but can't find any documentation on it. I've tried many variations on the parameters with no luck. Any help or suggestions would be appreciated.

Also, can anyone suggest a better way to learn this stuff, maybe a tutorial or additional examples?

thanks