private static String getTasks()
			throws Exception {

		QName serviceName = null;
		QName portName = null;
		Service service = null;
		Dispatch<SOAPMessage> dispatch = null;
		BindingProvider provider = null;
		SOAPElement operation = null;
		SOAPMessage response = null;
		SOAPMessage request = null;
		SOAPPart part = null;
		SOAPEnvelope env = null;
		SOAPBody body = null;
		SOAPElement simplequeryinput = null;
		SOAPElement simplequery = null;
		Map<String, Object> headers = null;
		Map<String, List<String>> reqHeaders = null;
		List<String> cookieList = null;

		SOAPElement remoteAddr = null;

		serviceName = new QName(
				"http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803",
				"HumanTaskClientAPIAdmin");
		portName = new QName(
				"http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803",
				"taskOperationsSOAP");

		service = Service.create(serviceName);
		service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
				HUMAN_TASK_EPR);

		dispatch = service.createDispatch(portName, SOAPMessage.class,
				Service.Mode.MESSAGE);

		provider = (BindingProvider) dispatch;

		MessageFactory mf = MessageFactory
				.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);

		request = mf.createMessage();
		part = request.getSOAPPart();

		env = part.getEnvelope();
		body = env.getBody();

		 operation = body .addChildElement("simpleQuery", "ns","http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803");
		  
		 simplequeryinput = operation .addChildElement("simpleQueryInput");
		 
		 simplequery = simplequeryinput.addChildElement("simpleQueryCategory");
		 
		 simplequery.setValue("ALL_TASKS");

		request.saveChanges();

		
		// We can't just invoke the above method - since it belongs to an
		// admin service. First
		// we need to authenticate with AuthenticationAdmin and get the
		// authenticated cookie.
		// Then we need to add that cookie to the HTTP header of the
		// request.
		headers = provider.getRequestContext();
		reqHeaders = (Map) headers.get(MessageContext.HTTP_REQUEST_HEADERS);
		if (reqHeaders == null) {
			reqHeaders = new HashMap<String, List<String>>();
		}

		cookieList = new ArrayList<String>();
		String Cookiee = getCookie("admin", "admin");
		String cookie = Cookiee.split(";")[0];

		// Let's authenticate as admin/admin and get the cookie.
		// cookieList.add(getCookie("admin", "admin"));
		cookieList.add(cookie);

		// // Need to set this http header as Cookie

		reqHeaders.put("Cookie", cookieList);

		//reqHeaders.put("Cookie", cookie);

		System.out.println("------header----" + reqHeaders.toString());
		//
		headers.put(MessageContext.HTTP_REQUEST_HEADERS, reqHeaders);
		System.out.println(request.getContentDescription());
		response = dispatch.invoke(request);
		//
		System.out.println(response.getSOAPBody().getFirstChild()
				.getTextContent());
		/*} else {
			return null;
		}

	}
}*/		return response.getSOAPBody().getFirstChild()
		.getTextContent();
	}