Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .SYNOPSIS
- Submits a SOAP request to Jack Henry.
- .DESCRIPTION
- This function submits SOAP calls to Jack Henry that normally would be done in Enterprise Workflow.
- With this, you're able to perform customer inquries, maintenance, and modifications exteranlly
- from SilverLake/Synapsis/etc.
- .NOTES
- Creating the soapBody:
- I recommend you keep the SOAP call in a separate file in a formatted string format, and use
- Get-Content to load the call into a variable, then load your missing values for the call.
- $rawSoapString = Get-Content -Path "C:\Path\To\XmlCall" -Raw
- [xml] $testSoapBody = [string]::Format($rawSoapString, $val1, $val2, etc.)
- .PARAMETER soapCallId
- The name of the SOAP to be performed. A list of valid options can be found in .LINK
- .PARAMETER soapBody
- The body of the SOAP request. This will need to be created and sent as an XML object.
- .EXAMPLE
- InvokeSoapRequest -soapCallId CRMEventInq -soapBody $testSoapBody
- .LINK
- SilverLake SOAP Calls: https://jackhenry.dev/open-enterprise-api-docs/enterprise-soap-api/api-provider/silverlake/
- Synapsis SOAP Calls: https://jackhenry.dev/open-enterprise-api-docs/enterprise-soap-api/api-provider/synapsys/
- #>
- function InvokeSoapRequest {
- [CmdletBinding()]
- param (
- # The actual tag name for the SOAP call you want to perform.
- [Parameter(Mandatory)]
- [string]
- $soapCallId,
- # The XML SOAP Body of the call you want to perform
- [Parameter(Mandatory)]
- [xml]
- $soapBody
- )
- begin {
- # Set Variables
- $return = [PSCustomObject]@{
- StatusCode = $null
- Content = $null
- ErrorReason = $null
- }
- [PSCustomObject]$headers = @{}
- $headers.Add('SOAPAction', "http://jackhenry.com/ws/$($soapCallId)")
- $urlEndpoint = "https://jxappinternal.jha-sys.com/jxchange/2008/servicegateway/servicegateway.svc"
- }
- process {
- try {
- $wr = Invoke-WebRequest -Uri $urlEndpoint -Headers $headers -Body $soapBody -Method POST `
- -ContentType 'text/xml'
- $return.StatusCode = $wr.StatusCode
- $return.Content = [xml] $wr.Content
- }
- catch {
- $return.StatusCode = 500
- $errContent = [xml] $_
- $errElem = $errContent.Envelope.Body.Fault.detail.HdrFault.FaultRecInfoArray.FaultMsgRec.ErrElem
- $errMsg = $errContent.Envelope.Body.Fault.detail.HdrFault.FaultRecInfoArray.FaultMsgRec.ErrDesc
- $return.ErrorReason = "($errElem): $errMsg"
- }
- }
- end {
- return $return
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment