Compression with Axis 1.3
Apache Axis (1.3) now supports HTTP request / response gzip compression, for services that run over the internet this can be a big win. By default its turned off, the easiest way I know how to turn it on is to sub class your service locator class and override the createCall method. here's an example, lets suppose you've run WSDL2Java on the sforce enterprise WSDL, you'll be left with a SforceServiceLocator class, this is the class you'll subclass, e.g.
import javax.xml.rpc.Call;
import javax.xml.rpc.ServiceException;
import org.apache.axis.transport.http.HTTPConstants;
import com.sforce.soap.enterprise.SforceServiceLocator;
public class SforceService extends SforceServiceLocator {
public Call createCall() throws ServiceException {
Call call = super.createCall();
call.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
call.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
return call;
}
}
Then your client code creates an instance of this subclass rather then SforceServiceLocator directly to get an instance of the Soap proxy.
Soap svc = new SforceService().getSoap();
LoginResult lr = svc.login("user@corp.org", "thePassword");
Your request to the server is gzipped compressed (the MC_GZIP_REQUEST property), and the request advertises (via the Accept-Encoding http header) that it'll accept a gzipped response (the MC_ACCEPPT_GZIP property). In the case of an sforce call like Query which can return very large responses you can see some big decreases in message sizes, a quick test here shows that an uncompressed response of 376426 bytes compresses down to a measly 33617 bytes (approx 9% the original size)
In addition to the above, you have to configure axis to use the vastly superior CommonsHTTPSender class rather than the default HTTPSender class as its transport, this is done by changing the transport entry in the client-config.wsdd file from java:org.apache.axis.transport.http.HTTPSender to java:org.apache.axis.transport.http.CommonsHTTPSender and adding Commons HTTP to the class path.
Note: You need to make sure you've configured it to use CommonsHTTPSender, that's not the default sender class.
Question: It seems that Axis 1.3 is not compatible with the SForce API v6, generates axis fault error indicating:
Must send a concrete entity type.
The Axis 1.3 library is compatible with the SForce API v6 but the way to you call the API is a bit different. In order to resolve this particular problem performing Update and Create, you can do the following:
// Instead of using the base class array (won't work) SObject[] upserts = new SObject[2]; // Use an array of specific objects SObject[] upserts = new Account[2];