Ir para conteúdo principal

Web Método GetRequests

Web Método GetRequests da Interface SOAP do CAP Workflow

Escrito por Luis Fernando Gushiken

GetRequests

Pesquisa por solicitações de acordo com os parâmetros informados.

Disponível no Web Service CAPRequests.asmx

Parâmetros

  • requestId [Integer]: ID da Solicitação

  • startDate [Date/Time]: Data Inicial da Solicitação

  • endDate [Date/Time]: Data Final da Solicitação

  • issuer [String]: Solicitante

  • servicePath [String]: Caminho do Workflow

  • folderPath [String]: Caminho da Área

  • status [WorkflowStatus]: Estado do Fluxo da Solicitação

  • assignee [String]: Responsável pela Etapa

  • workflowActionName [String]: Nome da Etapa Atual

  • metadataFilters [MetadataValue[]]: Arranjo de Atributos

  • startRecordIndex [Integer]: Índice do primeiro registro retornado

  • recordCount [Integer]: Quantidade de registros a serem retornados

  • orderBy [String]: Campo pelo qual ordenar

  • orderByDirection [String]: Direção de ordenação do campo

  • cultureName [String]: Nome da Cultura (utilizado para identificação do Workflow, Área, localização de Atributos e Etapas e/ou no retorno de valores em um idioma específico)

  • userScope [String]: Escopo do Usuário (somente Administradores do CAP podem informar um escopo diferente do usuário atualmente autenticado)

Exemplo de Solicitação/Resposta SOAP (v1.2)

POST /Services/CAPRequests.asmx HTTP/1.1
Host: nossocap.capworkflow.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetRequests xmlns="http://iteris.cap.webservices">
      <requestId>int</requestId>
      <startDate>dateTime</startDate>
      <endDate>dateTime</endDate>
      <issuer>string</issuer>
      <servicePath>string</servicePath>
      <folderPath>string</folderPath>
      <status>Running or Uninitialized or Completed or Canceled or Interrupted or Errored or Draft</status>
      <assignee>string</assignee>
      <workflowActionName>string</workflowActionName>
      <metadataFilters>
        <MetadataValue>
          <Name>string</Name>
          <Value>string</Value>
          <DisplayValue>string</DisplayValue>
          <DisplayMode>None or ReadOnly or Edit or Required or Hidden</DisplayMode>
          <Attachments>
            <MetadataAttachment xsi:nil="true" />
            <MetadataAttachment xsi:nil="true" />
          </Attachments>
          <Type>None or Text or Number or DateTime or Choice or YesNo or Attachment or ListLookup or Password or People or MultilineText or Hyperlink or Table</Type>
        </MetadataValue>
        <MetadataValue>
          <Name>string</Name>
          <Value>string</Value>
          <DisplayValue>string</DisplayValue>
          <DisplayMode>None or ReadOnly or Edit or Required or Hidden</DisplayMode>
          <Attachments>
            <MetadataAttachment xsi:nil="true" />
            <MetadataAttachment xsi:nil="true" />
          </Attachments>
          <Type>None or Text or Number or DateTime or Choice or YesNo or Attachment or ListLookup or Password or People or MultilineText or Hyperlink or Table</Type>
        </MetadataValue>
      </metadataFilters>
      <startRecordIndex>int</startRecordIndex>
      <recordCount>int</recordCount>
      <orderBy>string</orderBy>
      <orderByDirection>string</orderByDirection>
      <cultureName>string</cultureName>
      <userScope>string</userScope>
    </GetRequests>
  </soap12:Body>
</soap12:Envelope>

---

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetRequestsResponse xmlns="http://iteris.cap.webservices">
      <GetRequestsResult>
        <RequestInfo>
          <RequestId>int</RequestId>
          <ParentRequestId>int</ParentRequestId>
          <RequestLink>string</RequestLink>
          <ParentRequestLink>string</ParentRequestLink>
          <RequestTimestamp>dateTime</RequestTimestamp>
          <RequestTimestampFormatted>string</RequestTimestampFormatted>
          <RequestCompletedTimestamp>dateTime</RequestCompletedTimestamp>
          <RequestCompletedTimestampFormatted>string</RequestCompletedTimestampFormatted>
          <TaskStartedTimestamp>dateTime</TaskStartedTimestamp>
          <IssuerLogOnName>string</IssuerLogOnName>
          <IssuerName>string</IssuerName>
          <ServiceId>int</ServiceId>
          <ServiceName>string</ServiceName>
          <FolderPath>string</FolderPath>
          <FolderName>string</FolderName>
          <FolderPermissionTypes>VisibleNotSelectable or None or Administrator or Manager or User or Reader or All</FolderPermissionTypes>
          <WorkflowStatus>Running or Uninitialized or Completed or Canceled or Interrupted or Errored or Draft</WorkflowStatus>
          <Assignees>
            <string>string</string>
            <string>string</string>
          </Assignees>
          <CurrentAction>string</CurrentAction>
          <CurrentActionId>int</CurrentActionId>
          <ActionType>None or Approval or Notification or Integration or Interruption or Finalization</ActionType>
          <MetadataValues>
            <MetadataValue xsi:nil="true" />
            <MetadataValue xsi:nil="true" />
          </MetadataValues>
          <SLAStatus>int</SLAStatus>
          <ExpirationDate>dateTime</ExpirationDate>
          <Outcomes>
            <TupleOfOutcomeTypeStringCollectionOfTupleOfInt32String xsi:nil="true" />
            <TupleOfOutcomeTypeStringCollectionOfTupleOfInt32String xsi:nil="true" />
          </Outcomes>
          <CanCurrentUserTakeActions>boolean</CanCurrentUserTakeActions>
          <CanCurrentUserDelegateTask>boolean</CanCurrentUserDelegateTask>
          <CanCurrentUserRestartWorkflow>boolean</CanCurrentUserRestartWorkflow>
          <CanCurrentUserCancel>boolean</CanCurrentUserCancel>
          <IsLocked>boolean</IsLocked>
          <CanCurrentUserLockTask>boolean</CanCurrentUserLockTask>
          <CanCurrentUserUnlockTask>boolean</CanCurrentUserUnlockTask>
          <CanCurrentUserUseAsTemplate>boolean</CanCurrentUserUseAsTemplate>
          <LockMessage>string</LockMessage>
          <WorkflowProcessingLocked>boolean</WorkflowProcessingLocked>
          <RequestComment>string</RequestComment>
          <TaskComment>string</TaskComment>
          <SLATimeSpan>string</SLATimeSpan>
          <WorkflowTaskSLATimeSpan>string</WorkflowTaskSLATimeSpan>
          <SLADueDate>string</SLADueDate>
          <SLAAvailability>string</SLAAvailability>
          <RequestSLAPercentage>double</RequestSLAPercentage>
          <RequestExpirateDateFormatted>string</RequestExpirateDateFormatted>
          <RequestSLAStatus>int</RequestSLAStatus>
        </RequestInfo>
        <RequestInfo>
          <RequestId>int</RequestId>
          <ParentRequestId>int</ParentRequestId>
          <RequestLink>string</RequestLink>
          <ParentRequestLink>string</ParentRequestLink>
          <RequestTimestamp>dateTime</RequestTimestamp>
          <RequestTimestampFormatted>string</RequestTimestampFormatted>
          <RequestCompletedTimestamp>dateTime</RequestCompletedTimestamp>
          <RequestCompletedTimestampFormatted>string</RequestCompletedTimestampFormatted>
          <TaskStartedTimestamp>dateTime</TaskStartedTimestamp>
          <IssuerLogOnName>string</IssuerLogOnName>
          <IssuerName>string</IssuerName>
          <ServiceId>int</ServiceId>
          <ServiceName>string</ServiceName>
          <FolderPath>string</FolderPath>
          <FolderName>string</FolderName>
          <FolderPermissionTypes>VisibleNotSelectable or None or Administrator or Manager or User or Reader or All</FolderPermissionTypes>
          <WorkflowStatus>Running or Uninitialized or Completed or Canceled or Interrupted or Errored or Draft</WorkflowStatus>
          <Assignees>
            <string>string</string>
            <string>string</string>
          </Assignees>
          <CurrentAction>string</CurrentAction>
          <CurrentActionId>int</CurrentActionId>
          <ActionType>None or Approval or Notification or Integration or Interruption or Finalization</ActionType>
          <MetadataValues>
            <MetadataValue xsi:nil="true" />
            <MetadataValue xsi:nil="true" />
          </MetadataValues>
          <SLAStatus>int</SLAStatus>
          <ExpirationDate>dateTime</ExpirationDate>
          <Outcomes>
            <TupleOfOutcomeTypeStringCollectionOfTupleOfInt32String xsi:nil="true" />
            <TupleOfOutcomeTypeStringCollectionOfTupleOfInt32String xsi:nil="true" />
          </Outcomes>
          <CanCurrentUserTakeActions>boolean</CanCurrentUserTakeActions>
          <CanCurrentUserDelegateTask>boolean</CanCurrentUserDelegateTask>
          <CanCurrentUserRestartWorkflow>boolean</CanCurrentUserRestartWorkflow>
          <CanCurrentUserCancel>boolean</CanCurrentUserCancel>
          <IsLocked>boolean</IsLocked>
          <CanCurrentUserLockTask>boolean</CanCurrentUserLockTask>
          <CanCurrentUserUnlockTask>boolean</CanCurrentUserUnlockTask>
          <CanCurrentUserUseAsTemplate>boolean</CanCurrentUserUseAsTemplate>
          <LockMessage>string</LockMessage>
          <WorkflowProcessingLocked>boolean</WorkflowProcessingLocked>
          <RequestComment>string</RequestComment>
          <TaskComment>string</TaskComment>
          <SLATimeSpan>string</SLATimeSpan>
          <WorkflowTaskSLATimeSpan>string</WorkflowTaskSLATimeSpan>
          <SLADueDate>string</SLADueDate>
          <SLAAvailability>string</SLAAvailability>
          <RequestSLAPercentage>double</RequestSLAPercentage>
          <RequestExpirateDateFormatted>string</RequestExpirateDateFormatted>
          <RequestSLAStatus>int</RequestSLAStatus>
        </RequestInfo>
      </GetRequestsResult>
    </GetRequestsResponse>
  </soap12:Body>
</soap12:Envelope>

Exemplo de Utilização em PowerShell via New-WebServiceProxy

$baseUrl = "https://env.capworkflow.com";
$userName = "test.user@capworkflow.com";
$password = "MyVeryStrongPassword@123";
# Cria o proxy para o serviço de autenticação do CAP.
$wsAuth = New-WebServiceProxy -Uri "$baseUrl/Services/CAPAuthentication.asmx" -Namespace "CAP.Services";
# Atribui um Cookie Container ao proxy para armazenar o cookie de autorização a ser retornado.
$wsAuth.CookieContainer = New-Object System.Net.CookieContainer;
# Realiza a autenticação do usuário.
$wsAuth.Login($userName, $password);
# Como o proxy do PowerShell não suporta passar as informações de autenticação no momento da sua criação,
# é necessário baixar a definição do serviço em um etapa anterior, passando o cookie de autorização através
# de uma nova sessão web.
$authSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession;
$authSession.Cookies = $wsAuth.CookieContainer;
$wsReqWsdl = Invoke-WebRequest -Uri "$baseUrl/Services/CAPRequests.asmx?wsdl" -Method Get -WebSession $authSession;
$wsReqWsdl.Content | Out-File -FilePath "D:\temp\wsReq.wsdl" -Encoding utf8;
# Cria o proxy para o serviço de configuração do CAP.
$wsReq = New-WebServiceProxy -Uri "D:\temp\wsReq.wsdl" -Namespace "CAP.Services";
# Atribui o Cookie Container com o cookie de autorização ao proxy.
$wsReq.CookieContainer = $wsAuth.CookieContainer;
# Obtém a solicitação 2226:
$wsReq.GetRequests(2226, $null, $null, $null, $null, $null, $null, $null, $null, $null, $null, $null, $null, $null, $null, $null)
# Obtém as 10 primeiras solicitações entre 01-Jan-2019 e 10-Jan-2019, ordenado pelo ID da solicitação de forma decrescente:
$wsReq.GetRequests(
    $null,
    [DateTime]::Parse("01-Jan-2019"),
    [DateTime]::Parse("01-Jan-2019"),
    $null,
    $null,
    $null,
    $null,
    $null,
    $null,
    $null,
    0,
    10,
    "RequestId",
    "DESC",
    "pt-BR",
    $null
);

Exemplo de Utilização em PowerShell via Invoke-WebRequest

$baseUrl = "https://env.capworkflow.com";
$userName = "test.user@capworkflow.com";
$password = "MyVeryStrongPassword@123";
# Montagem da mensagem SOAP com os parâmetros de autenticação.
$soapMessage = @"
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Login xmlns="http://iteris.cap.webservices">
      <userLogOnName>$userName</userLogOnName>
      <password>$password</password>
    </Login>
  </soap12:Body>
</soap12:Envelope>
"@;
# Requisição POST passando a mensagem SOAP e armazenando
# o cookie de autorização na variável de sessão $authSession.
Invoke-WebRequest -Uri "$baseUrl/Services/CAPAuthentication.asmx" -Method Post -ContentType "application/soap+xml; charset=utf-8" -Body $soapMessage -SessionVariable authSession;
# Montagem da mensagem SOAP com os parâmetros necessários.
$reqSoapMessage = @"
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetRequests xmlns="http://iteris.cap.webservices"><requestId xsi:nil="true" /><startDate>2019-01-01T00:00:00</startDate><endDate>2019-01-01T00:00:00</endDate><issuer /><servicePath /><folderPath /><status xsi:nil="true" /><assignee /><workflowActionName /><startRecordIndex>0</startRecordIndex><recordCount>10</recordCount><orderBy>RequestId</orderBy><orderByDirection>DESC</orderByDirection><cultureName>pt-BR</cultureName><userScope /></GetRequests></soap:Body></soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetRequests xmlns="http://iteris.cap.webservices">
        <startDate>2019-01-01T00:00:00</startDate>
        <endDate>2019-01-01T00:00:00</endDate>
        <startRecordIndex>0</startRecordIndex>
        <recordCount>10</recordCount>
        <orderBy>RequestId</orderBy>
        <orderByDirection>DESC</orderByDirection>
        <cultureName>pt-BR</cultureName>
    </GetRequests>
  </soap12:Body>
</soap12:Envelope>
"@;
# Requisição POST passando a mensagem SOAP e a variável
# de sessão $authSession criada no momento da autenticação.
Invoke-WebRequest -Uri "$baseUrl/Services/CAPRequests.asmx" -Method Post -ContentType "application/soap+xml; charset=utf-8" -Body $reqSoapMessage -WebSession $authSession;

Exemplo de Utilização em PowerShell via Invoke-WebRequest e Basic Authentication

$baseUrl = "https://env.capworkflow.com";
$userName = "test.user@capworkflow.com";
$password = "MyVeryStrongPassword@123";
# Montagem da mensagem SOAP com os parâmetros necessários.
$reqSoapMessage = @"
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetRequests xmlns="http://iteris.cap.webservices">
        <startDate>2019-01-01T00:00:00</startDate>
        <endDate>2019-01-01T00:00:00</endDate>
        <startRecordIndex>0</startRecordIndex>
        <recordCount>10</recordCount>
        <orderBy>RequestId</orderBy>
        <orderByDirection>DESC</orderByDirection>
        <cultureName>pt-BR</cultureName>
    </GetRequests>
  </soap12:Body>
</soap12:Envelope>
"@;
# Monta o valor do cabeçalho de autenticação para Basic Authentication.
$credential = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$($userName):$password"));
# Requisição POST passando a mensagem SOAP e o cabeçalho
# de autenticação básica.
Invoke-WebRequest -Uri "$baseUrl/Services/CAPRequests.asmx" -Method Post -ContentType "application/soap+xml; charset=utf-8" -Body $reqSoapMessage -Headers @{ "Authorization" = "Basic $credential" };
Isto respondeu à sua pergunta?