Error Calling Web Service Method

Welcome Forums General PowerShell Q&A Error Calling Web Service Method

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

5 years, 7 months ago.

  • Author
  • #9915

    Topics: 1
    Replies: 0
    Points: 0
    Rank: Member

    Hello all,

    I'm trying to work with a vendor-supplied web service. I'm able to consume it easily enough from C#, but I'm struggling from powershell.

    I'm by no means an expert with web services or the XML that defines them.


    I can connect easily enough:

    $docman = New-WebServiceProxy -Uri "http://server/webservices/DocumentManagement.svc?wsdl" -namespace ""
    $auth = New-WebServiceProxy -Uri "http://server/webservices/Authentication.svc?wsdl" -namespace "";

    and use some methods:

    $token = $auth.AuthenticateUser("username", "password");

    But when I'm trying to run an actual useful function as described:

    $method = $docman | Get-Member -Name "AddVersion";
    namespace AddVersion(int ID, namespace.Metadata metadata, namespace.Attachm
    ent attach)

    By calling something like:

    $docman.AddVersion(69988, $metadata, $newattach);

    I get:

    Exception calling "AddVersion" with "3" argument(s): ""
    At C:\Users\username\Documents\code\sqlpowershell.ps1:46 char:19
    + $docman.AddVersion < <<< (69988, $metadata, $newattach);
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    And here is the XML operation as defined:


    Any suggestions, or more information needed? Thank you.

  • #9916

    Topics: 0
    Replies: 669
    Points: 0
    Rank: Member

    My first question would have to be have you got the type correct for the parameters you are passing in?

    Do you have a call that works in C# that doesn't in PowerShell?

The topic ‘Error Calling Web Service Method’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort