A seguir é apresentado um exemplo de cliente de serviços da Web do planejador de longa execução.
public class LRSWebServiceClient{ private static String NS_XSD = "http://www.w3.org/2001/XMLSchema"; public static void main(String[] args) throws Exception { String targetNamespace = "http://longrun.websphere.ibm.com"; String serviceName = "JobSchedulerWebService"; String endPoint = "http://localhost:9080/LongRunningJobSchedulerWebSvcRouter/ services/JobScheduler"; QName QNAME_TYPE_STRING = new QName(NS_XSD, "string"); //obter instância do depósito de informações do provedor do serviço ServiceFactory serviceFactory = ServiceFactory.newInstance(); //criar serviço Service service = serviceFactory.createService(new QName (targetNamespace,serviceName)); //chamadas de serviço Call call = (Call)service.createCall(); call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,""); call.setProperty(Call.OPERATION_STYLE_PROPERTY,"wrapped"); call.setTargetEndpointAddress(endPoint); call.removeAllParameters(); call.setPortTypeName(new QName(targetNamespace,serviceName)); call.setReturnType(XMLType.SOAP_ARRAY); //configurar operação de destino como showAllJobs call.setOperationName(new QName(targetNamespace,"showAllJobs")); call.setReturnType(QNAME_TYPE_STRING); //chamada de serviço System.out.println("Response:\n"); System.out.println(call.invoke(null)); } }