New-WebServiceProxy as way for update information

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 9 years and 1 week 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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: New-WebServiceProxy as way for update information

Post by jvierra »

The other possibility is that the namespace can generate the structure.

$getRecords1=[Incidents]::GetRecords()

This might prevent the object from being wrapped by PowerShell.
User avatar
aalbende
Posts: 30
Last visit: Mon Jul 13, 2015 7:35 am

Re: New-WebServiceProxy as way for update information

Post by aalbende »

Solved


$SNowWS_Incidents = New-WebServiceProxy -Uri $SN_Web -Credential $cred #don't define the namespace here
$type = $SNowWS_Incidents.GetType().Namespace
$records = new-object ($type + '.getRecords')

we cannot use namespace on New-WebServiceProxy because it is now allowed to execute twice times the code if you follow this definition.

thanks for your help :)
Vini Vidi Installi
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: New-WebServiceProxy as way for update information

Post by jvierra »

I thought that the namespace looked odd. It is not normally used.


Yes a type would do it. The service does not want to be changed and it wants the names to be set correctly although I am guessing that it is a bug. You should be able too change the name
This topic is 9 years and 1 week 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