private VappClient createVApp(IControllerServices controllerServices, String vCloudUrl, String username, String password, String orgName, String vdcName, String vAppName, String catalogName, String templateName, String network) throws ConnectorException
	{
		VappClient vCloudApp = new VappClient(controllerServices);
		
		try {
			// logging in
			String loginResponse = vCloudApp.login(vCloudUrl, username, orgName, password);
			
			// getting org links
			Document doc = RestClient.stringToXmlDocument(loginResponse);	
			String allOrgsLink = doc.getElementsByTagName(Constants.LINK).item(0).getAttributes().getNamedItem(Constants.HREF).getTextContent().trim();
			
			//
			//needs to be removed in case createVdc needs to be removed
			String adminLink = doc.getElementsByTagName(Constants.LINK).item(1).getAttributes().getNamedItem(Constants.HREF).getTextContent().trim();
			
			String orgLink = vCloudApp.retrieveOrg(allOrgsLink, orgName);
			
			// To instantiate a vApp template you need the vDc on which the vApp is going to be deployed and the object 
			// references for the catalog in which the vApp template will be entered.
			
			String vdcLink = vCloudApp.findVdc(orgLink, vdcName);
			String catalogLink = vCloudApp.findCatalog(orgLink, catalogName);
			String templateLink = vCloudApp.retrieveTemplate(catalogLink, templateName);
			
			String response = vCloudApp.newvAppFromTemplate(vAppName, templateLink, catalogLink, vdcLink, network);
			String vAppLink = vCloudApp.retrieveVappLink(response);
			vCloudApp.setvAppLink(vAppLink);
		}
		catch (Exception e) {
			throw new ConnectorException(e);
		}
		return vCloudApp;
	}