public SecurityToken logon( String anEndpointReference, String aUserName, String aPassword, String anApplicationID) throws LogonManagerException, SOAPException, IOException { SecurityToken result; SOAPMessage message; SOAPConnection conn = null; try { result = null; String request = REQUEST_FORMAT.format( ((Object) (new Object[] {fURL, aUserName, aPassword, anEndpointReference}))); message = MessageFactory.newInstance() .createMessage(new MimeHeaders(), new ByteArrayInputStream(request.getBytes())); conn = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage response = conn.call(message, fURL); SOAPBody body = response.getSOAPBody(); if (body.hasFault()) throw new LogonManagerException(body.getFault()); result = new SecurityToken(); result.setSOAPBody(body); for (Iterator it = body.getChildElements(); it.hasNext(); fill(result, (Node) it.next())) ; return result; } finally { if (conn != null) conn.close(); } }