Sto scrivendo uno script PowerShell che eseguirà un ping di un servizio web di sapone ogni 10 minuti per mantenerlo caldo e attivo, in modo che le prestazioni aumentino. Abbiamo provato numerose tecniche in IIS con il timeout di inattività del pool di applicazioni e facendo semplicemente http req per wsdl. Ma sembra che dobbiamo fare una richiesta reale che scende al server SQL altrimenti un inattivo per 90 minuti lo farà rallentare per i requisiti.In Powershell per consumare un complesso di saponeTipo per mantenere un servizio Soap hot
Devo costruire un oggetto di ricerca piuttosto complesso per poter effettuare una ricerca intelligente che manterrà il servicelayer memorizzato nella cache e caldo. Il Sapone richiesta dovrebbe essere simile a questo:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fund="http://www.example.com/cmw/fff/fund" xmlns:tcm="http://www.example.com/cmw/fff/">
<soapenv:Body>
<fund:Get>
<!--Optional:-->
<fund:inputDTO>
<fund:Fund>
<fund:Identity>
<fund:Isin>SE9900558666</fund:Isin>
<fund:FundBaseCurrencyId>SEK</fund:FundBaseCurrencyId>
</fund:Identity>
</fund:Fund>
<fund:InputContext>
<tcm:ExtChannelId>Channelman</tcm:ExtChannelId>
<tcm:ExtId>Rubberduck</tcm:ExtId>
<tcm:ExtPosReference>Rubberduck</tcm:ExtPosReference>
<tcm:ExtUser>Rubberduck</tcm:ExtUser>
<tcm:LanguageId>809</tcm:LanguageId>
</fund:InputContext>
</fund:inputDTO>
</fund:Get>
</soapenv:Body>
</soapenv:Envelope>`
cerco di usare il New-WebServiceProxy che funzionano così elegantemente in this example by powershellguy. Costruisco my own Objects as this example from technet.
Il codice PowerShell ho provato finora è questo:
$fundSrvc = New-WebServiceProxy -uri http://myColdServer:82/WSFund.svc?wsdl -NameSpace "tcm"
# all the type are now defined since we called New-WebServiceProxy they are prefixed
# with ns tcm
[tcm.FundInput] $myFundGoofer = new-object tcm.FundInput
[tcm.Fund] $myFund = new-object tcm.Fund
[tcm.Context] $myInputContext = new-object tcm.Context
[tcm.FundIdentity] $myFundIdentity = New-Object tcm.FundIdentity
# Use these commands to get member of the objects you want to investigat
# $myFundGoofer |Get-Member
# $myFund |Get-Member
# $myInputContext |Get-Member
# $myFundIdentity |Get-Member
$myFundIdentity.Isin="SE9900558666"
$myFundIdentity.FundBaseCurrencyId="SEK"
$myInputContext.ExtChannelId="ChannelMan"
$myInputContext.ExtId="RubberDuck"
$myInputContext.ExtPosReference="RubberDuck"
$myInputContext.ExtUser="RubberDuck"
$myInputContext.LanguageId="809"
$myFund.Identity=$myFundIdentity
$myFundGoofer.Fund = $myFund
$myFundGoofer.InputContext = $myInputContext
#Tada
$fundSrvc.Get($myFundGoofer)
Messaggio L'errore non ha senso per me. I suoi suoni come: Cannot convert the "tcm.FundInput" value of type "tcm.FundInput" to type "tcm.FundInput"
Cannot convert argument "0", with value: "tcm.FundInput", for "Get" to type "tcm.FundInput": "Cannot convert the "tcm.FundInput" value of type "tcm.FundInput" to type "tcm.FundInput"."
At C:\scripts\Service-TestTCM6.ps1:31 char:14
+ $fundSrvc.Get <<<< ($myFundGoofer)
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
Hai provato questo? http://www.sqlmusings.com/2012/02/04/resolving-ssrs-and-powershell-new-webserviceproxy-namespace-issue/ –
No, ma ora mi sembra di avere questo problema che è descritto nel tuo link può essere eseguito una volta e quindi devo cambiare lo spazio dei nomi o riavviare PowerShell. Funziona dopo ogni riavvio. Grazie –
Non mettere lo spazio dei nomi tra virgolette. '$ fundSrvc = New-WebServiceProxy -uri http: // myColdServer: 82/WSFund.svc? wsdl -NameSpace tcm' –