Simon Fell > Its just code > Axis 2.0 with SForce

Monday, October 3, 2005

The codegen / compile problems in Axis 2 with the SForce WSDL are fixed in SVN (quick turnaround!). I didn't think they'd manage it, but somehow they managed to make using an Axis 2.0 client even more long winded than Indigo, perhaps I'm doing something wrong ?

public static void main(String[] args) throws Exception {
	SoapStub stub = new SoapStub();
	CallOptionsDocument od = CallOptionsDocument.Factory.newInstance();
	CallOptions options = CallOptions.Factory.newInstance();
	Login l = Login.Factory.newInstance();
	LoginDocument ld = LoginDocument.Factory.newInstance();
	LoginResult lr = stub.login(ld, od).getLoginResponse().getResult();
	System.out.println("new SessionId is " + lr.getSessionId());
	System.out.println("new ServerUrl is " + lr.getServerUrl());
	stub = new SoapStub(null, lr.getServerUrl());
	SessionHeaderDocument sd = SessionHeaderDocument.Factory.newInstance();
	SessionHeader session = SessionHeader.Factory.newInstance();
	QueryOptionsDocument qod = QueryOptionsDocument.Factory.newInstance();
	QueryOptions qo = QueryOptions.Factory.newInstance();
	QueryDocument queryD = QueryDocument.Factory.newInstance();
	Query query = Query.Factory.newInstance();
	query.setQueryString("select id, name, accountNumber from Account");
	QueryResult qres = stub.query(queryD, sd, od, qod).getQueryResponse().getResult();
	System.out.println("total query size is " + qres.getSize());

I must of missed the Gartner report that said the programming model for WS stacks needed to be more verbose, both Axis 2.0 & Indigo have programming models that require heaps more boiler plate code than their previous counterparts.