Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
WFA Web services are supported using WSDL SOAP bindings with old version of WFA metioned in the TR 4254
In the TR, the URL to calll SOAP API is mentioned as -
Document/literal encoding, which is used most often by Java® applications
http://<WFA_IP address>/wfa-ws/WorkflowService_doc?wsdl
RPC encoding, which is used most often by .Net, Visual C#, and Windows PowerShell™
http://<WFA_IP address>/wfa-ws/WorkflowService_rpc?wsdl
In my case I'm trying to call REST APIs from BMC Atrium Orchestrator from wfa 3.0
I'd like to know how can I call REST APIs from BMC AO for WFA 3.0
We are getting an error when I put the below URL in BMC AO Studio Manager
http://<WFA_IP address>/rest/workflows
Regards
Patil
Solved! See The Solution
Can't help you with BAO.
But if you call the ps1 from it using parameters like .\testing.ps1 wfa_server_IP workflow_name lun_size etc, you can retrieve those parameters passed from BAO with this code :
$parameters = @()
foreach ($parameter in $parameters)
{
Write-Host "Param: $arg";
}
$wfaserver = $args[0]
$workflow_name = $args[1]
$LUNSizeInGB = $args[2]
$PrimaryVolume = $args[3]
$vmware_cluster = $args[4]
$disk_type = $args[5]
Here is an example to try out :
# variables
$username = "bao"
$password = "guess"
$wfaserver = "123.1.1.1"
$uri = "http://$wfaserver/wfa-ws/WorkflowService_rpc?wsdl"
# note : if the ssl certificate is not installed used http, if ssl is installed https will work
$parameters = @()
#$VerbosePreference = "continue"
# create credentials
Write-Verbose "Creating credentials"
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,$password)
# fire up the webservice
Write-Verbose "Connect to webservice $uri"
[System.Net.ServicePointManager]::Expect100Continue = $false
$wfa = New-WebServiceProxy -Uri $uri -Credential $cred
# get list of workflows
Write-Verbose "Get the workflows"
$workflows = $wfa.getAllWorkflows()
# list them up
Write-Output "Pick a workflow"
Write-Output "==============="
$workflowIds = @() # build a valid workflowid array
foreach($workflow in $workflows){
$workflowIds += $workflow.id
Write-Output "$($workflow.id) : $($workflow.name)"
}
# prompt for workflow id with error checking
do{
$workflowId = read-host "Enter a valid Workflow-id you want to start"
}
while($workflowIds -notcontains $workflowId)
# get chosen workflow
Write-Verbose "Get workflow $workflowid"
$workflow = $workflows | where{$_.id -eq $workflowId}
# get user input
Write-Verbose "Extract userput fields"
$userinputFields = $workflow | select -ExpandProperty userinput
foreach($field in $userinputFields){
$input = ""
$validationString = ""
Do{
Write-Output "-----------------------------------"
# description
if($field.description){
Write-Output "Description : $($field.description)"
}
# validation presentation
if($field.value){
$validationString = $field.value
# visualize Enum with "|"
if($field.type -eq "Enum"){
$validationString = "[" + ($field.value -join "|") + "]"
}
Write-Output "Validation : $validationString"
}
# get default value if any
if($field.defaultValue){
$defaultValue = " [$($field.defaultValue)]"
}else{
$defaultValue = ""
}
# read the input
$input = read-host "$($field.name)$defaultValue"
# set the default value
if((-not $input) -and $field.defaultValue){
Write-Verbose "No input given : defaulting the value to $($field.defaultValue)"
$input = $field.defaultValue
}
# validate the input
# default = true
$validation = $true
# only validation if value is given
if($field.value){
# number - scan the range
if($field.type -eq "Number"){
$range = $validationString -split "-"
$input = [Int32]$input
$lowest = [Int32]$range[0].Trim()
$highest = [Int32]$range[1].Trim()
$validation = (($input -ge $lowest) -and ($input -le $highest))
Write-Verbose "Validated number $input as $validation between $lowest and $highest"
}
# enumeration - check the array
if($field.type -eq "Enum"){
$validation = $field.value -contains $input
Write-Verbose "Validated enumeration $input as $validation in array {$($field.value -join ",")}"
}
# string - check the regex
if($field.type -eq "String"){
# we change the regex a bit (^ & $) to get it working
$validation = $input -match "^$validationString$"
Write-Verbose "Validated string $input as $validation against regex /$validationString/"
}
}
}while(-not $validation)
Write-Verbose "Adding parameters : $($field.name)=$input"
$parameters += "$($field.name)=$input"
}
# lauch the workflow
Write-Verbose "Launching the workflow $($workflow.id) with parameters $parameters"
$jobid = $wfa.executeWorkflow($workflow.id,$parameters)
# monitor job status
do{
$status = $wfa.getJobStatus($jobid)
Write-Output "Workflow status : $($status.jobStatus1)..."
Write-Verbose "Sleeping 2 seconds"
Start-Sleep 2
}
while($status.jobStatus1 -ne "COMPLETED")
Write-Verbose "Job completed"
write-output "returning parameters through the job status"
foreach($param in $status.returnParameter){
write-output "$($param.name) = $($param.value)"
}
write-output "returning parameters through webservice"
foreach($param in $workflow.returnParameters){
$returnedParameter = $wfa.getReturnParameters($jobid,$param.name)
write-output "$($returnedParameter[0].name) = $($returnedParameter[0].value)"
}
$stop = Read-Host 'job finished... press enter to stop'
Thank you trentino123,
we have tried below script froom powershell it working fine.
not sure how to add this into BOA.
Regards,
Patil
Can't help you with BAO.
But if you call the ps1 from it using parameters like .\testing.ps1 wfa_server_IP workflow_name lun_size etc, you can retrieve those parameters passed from BAO with this code :
$parameters = @()
foreach ($parameter in $parameters)
{
Write-Host "Param: $arg";
}
$wfaserver = $args[0]
$workflow_name = $args[1]
$LUNSizeInGB = $args[2]
$PrimaryVolume = $args[3]
$vmware_cluster = $args[4]
$disk_type = $args[5]
Thank you trentino123,
Glad it helped BPatil !