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.
Locked
User avatar
dan.potter
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,
  1. $uri = 'https://sninstance/RemedyService/RemedyServiceDesk.serviceagent?wsdl'
  2.  
  3.  
  4.  
  5. $SN = New-WebServiceProxy -uri $URI -Credential $sncred
  6.  
  7.  
  8.  
  9. $type = $SN.GetType().Namespace
  10.  
  11.  
  12.  
  13. $get = new-object ($type + '.AuthenticationInfo')
  14.  
  15.  
  16.  
  17. $get.username = $username
  18.  
  19. $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
  1. $uri = "https://$sninstance/RemedyService/RemedyServiceDesk.serviceagent/RemedyServiceDeskEndpoint"
  2.  
  3.    
  4.  
  5.     $xml = [xml]@"
  6.  
  7. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:TIBCO_ITIL_ServiceDesk">
  8.  
  9.   <soapenv:Header/>
  10.  
  11.   <soapenv:Body>
  12.  
  13.      <urn:OpGet>
  14.  
  15.         <urn:AuthenticationInfo>
  16.  
  17.            <urn:userName>user</urn:userName>
  18.  
  19.            <urn:password>pass</urn:password>
  20.  
  21.         </urn:AuthenticationInfo>
  22.  
  23.         <urn:Case_ID>$case_id</urn:Case_ID>
  24.  
  25.      </urn:OpGet>
  26.  
  27.   </soapenv:Body>
  28.  
  29. </soapenv:Envelope>
  30.  
  31. "@
  32.  
  33.    
  34.  
  35.    
  36.  
  37.     $header = @{ SOAPAction = "/RemedyService/RemedyServiceDesk.serviceagent/RemedyServiceDeskPortTypeEndpoint/OpGet" }
  38.  
  39.    
  40.  
  41.     $post = Invoke-RestMethod -Uri $uri -Headers $header -Method Post -Body $xml -ContentType "text/xml"
  42.  
  43.    
  44.  
  45.     $post.envelope.body.opgetresponse

Locked