Help with wsdl new-webserviceproxy.

Ask your 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.
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
dan.potter
Posts: 709
Last visit: Wed Nov 14, 2018 11:39 am

Help with wsdl new-webserviceproxy.

Post by dan.potter »

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. $SN = New-WebServiceProxy -uri $URI -Credential $sncred
  4.  
  5. $type = $SN.GetType().Namespace
  6.  
  7. $get = new-object ($type + '.AuthenticationInfo')
  8.  
  9. $get.username = $username
  10. $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.     $xml = [xml]@"
  4. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:TIBCO_ITIL_ServiceDesk">
  5.   <soapenv:Header/>
  6.   <soapenv:Body>
  7.      <urn:OpGet>
  8.         <urn:AuthenticationInfo>
  9.            <urn:userName>user</urn:userName>
  10.            <urn:password>pass</urn:password>
  11.         </urn:AuthenticationInfo>
  12.         <urn:Case_ID>$case_id</urn:Case_ID>
  13.      </urn:OpGet>
  14.   </soapenv:Body>
  15. </soapenv:Envelope>
  16. "@
  17.    
  18.    
  19.     $header = @{ SOAPAction = "/RemedyService/RemedyServiceDesk.serviceagent/RemedyServiceDeskPortTypeEndpoint/OpGet" }
  20.    
  21.     $post = Invoke-RestMethod -Uri $uri -Headers $header -Method Post -Body $xml -ContentType "text/xml"
  22.    
  23.     $post.envelope.body.opgetresponse
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked