Consume web services within a Job

Follow

JAMS can consume web services through PowerShell. 

For example:

Invoke-RestMethod -Uri http://blogs.msdn.com/powershell/rss.aspx | Format-Table -Property Title

Creates the following output:

title
-----
Azure DSC Extension v2.4 released
Windows Management Framework 5.0 Production Preview is now available
Development builds for DSC Resources are available
Azure DSC Extension v2.3 released
PowerShell Gallery – New Security Scan
Azure DSC Extension 2.2 & Updates to Publish-AzureVMDscConfiguration cmdlet for ASM & ARM in Azure PowerShell SDK ve...
Windows Management Framework (WMF) 5.0 Roadmap
What's new in DSC Resource Kit
Windows Management Framework (WMF) 4.0 Update is coming your way …
Azure DSC Extension v2.1 released
Welcoming the new home of PowerShell
Introducing Azure Resource Manager cmdlets for Azure PowerShell DSC Extension
Validate PowerShell DSC Debug
Validate PowerShell DSC WaitFor
Validate PowerShell DSC Partial Configurations
Registration is Now Open to Publish on PowerShell Gallery
Validate PowerShell DSC Node Status
Validate PowerShell DSC RunAsCredential
Validate features of PowerShell DSC
Use DSC to manage WMI namespace security
DSC Resource Kit flourishes as open source
Want to write a DSC resource where only a single instance can be configured?
Azure DSC Extension v2.0 released
PowerShell ♥ the Blue Team
Looking Forward: Microsoft Support for Secure Shell (SSH)

More information about the use of this cmdlet can be found here, or simply using 'Help Invoke-RestMethod' at a Powershell command prompt.  Note that this cmdlet is only available in Powershell V3 and above.

SOAP web services can be consumed using PowerShell as well.  Here is an example.

 
  • Build a sample SOAP request and save it on a text file, called “soap.txt”.
  • Save it on a temporary folder “C:\Temp”.
  • Afterwards, open a PowerShell command prompt window and type this in:

     

$ws = "http://[your web service endpoint address]"Invoke-WebRequest $ws -Method Post -ContentType "text/xml" -InFile C:\Temp\soap.txt -OutFile c:\Temp\soapResults.txt  

      

After execution, the resulting SOAP response is saved on the temporary folder under the name “soapResult.txt”.

Have more questions? Submit a request

Comments