Help with wsdl new-webserviceproxy.

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Posts: 709
Joined: Wed Oct 08, 2014 6:02 am

Help with wsdl new-webserviceproxy.

Post by dan.potter » Fri May 12, 2017 1:16 pm

Shot in the dark here because I can't find an exact example of this anywhere. I'm trying to figure out how to format the arguments and I keep getting the 'can't find overload...'

Here is the method and definition, I know it requires basic authentication and the case_ID

OpGet Method string OpGet(Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1yServiceDesk_serviceagent_wsdl.AuthenticationInfo AuthenticationInfo, string Case_ID,

Code: Select all

$uri = 'https://sninstance/RemedyService/RemedyServiceDesk.serviceagent?wsdl'

$SN = New-WebServiceProxy -uri $URI -Credential $sncred

$type = $SN.GetType().Namespace

$get = new-object ($type + '.AuthenticationInfo')

$get.username = $username
$get.password = $password

I get this far.

TypeName: Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1yServiceDesk_serviceagent_wsdl.AuthenticationInfo

Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
password Property string password {get;set;}
userName Property string userName {get;set;}

And here I can't figure out what to do.

$SN.opget($get,'INC2760753') Cannot find an overload for "opget" and the argument count: "2"

This is how I'm doing it without new-webserviceproxy

Code: Select all

$uri = "https://$sninstance/RemedyService/RemedyServiceDesk.serviceagent/RemedyServiceDeskEndpoint"

$xml = [xml]@"
<soapenv:Envelope xmlns:soapenv="" xmlns:urn="urn:TIBCO_ITIL_ServiceDesk">

$header = @{ SOAPAction = "/RemedyService/RemedyServiceDesk.serviceagent/RemedyServiceDeskPortTypeEndpoint/OpGet" }

$post = Invoke-RestMethod -Uri $uri -Headers $header -Method Post -Body $xml -ContentType "text/xml"