How to use powershell to call a WCF service

Welcome Forums General PowerShell Q&A How to use powershell to call a WCF service

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 10 months ago.

  • Author
    Posts
  • #33261

    Participant
    Points: 0
    Rank: Member

    I am attempting to new-webserviceproxy to use an internal web service to update a ticket in our SeviceNow instance. I can read the new proxy as I can run get-member from it. However, when I try to pass info to it that I want it to update I get an error: "SOAP header action was not understood". I've done some extensive checking online and can't seem to find a relevant answer. Is it possible to use powershell like this?

  • #33265

    Member
    Points: 0
    Rank: Member

    Tricky to answer without more details. As long as ServiceNow is providing a proper SOAP endpoint, then it should be possible to do whatever you need to do starting with New-WebServiceProxy, but the steps after that may be tricky.

  • #33268

    Participant
    Points: 0
    Rank: Member

    From what I understand, this is all I should need:

    $SN = New-WebServiceProxy –Uri 'https://mysite.domain.com/ServiceNow/IntegrationService/SNIntegration.svc?wsdl' -UseDefaultCredential

    $SN.UpdateCatalogTask($null,$null,$null,$null,$null) # order of items to update (number,state,description,work_notes,assigned to)

    but get:

    Exception calling "UpdateCatalogTask" with "5" argument(s): "SOAP header Action was not understood."
    At line:7 char:1
    + $SNInt.UpdateCatalogTask($null,$null,$null,$null,$null)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SoapHeaderException

    Thank you for the help!!

The topic ‘How to use powershell to call a WCF service’ is closed to new replies.