Error Calling Web Service Method

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Richard Siddaway Richard Siddaway 3 years, 7 months ago.

  • Author
    Posts
  • #9915
    Profile photo of Adam Daunais
    Adam Daunais
    Participant

    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.

    Anyway,

    I can connect easily enough:

    $docman = New-WebServiceProxy -Uri "http://server/webservices/DocumentManagement.svc?wsdl" -namespace "Core.service.livelink.opentext.com"
    $auth = New-WebServiceProxy -Uri "http://server/webservices/Authentication.svc?wsdl" -namespace "api.ecm.opentext.com";

    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";
    $method.Definition:
    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
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    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?

You must be logged in to reply to this topic.