1 Reply Latest reply on Apr 27, 2015 10:41 AM by campbrs

    SWIS - How To Execute a Cirrus.SnippetArchive Script using C#

    campbrs

      Ok so I have gotten to the point in my app where I now need to execute a script.  The Script is stored in the Cirrus.SnippetArchive and I am able to work with the script data, etc but I am unable to execute based on the following article (and analysis of the included SDK Powershell example of script execution (NCM.ExecuteScript.ps1)).

       

      How to create array of arguments for Unmanage/Remanage? (C#)

       

      The command I am using to execute the script is:

      result += client.Invoke ("Cirrus.SnippetArchive", "Execute", PrepareArguments ("N:" + oNode.ID, Scripts [sScriptName].Raw));


      The Exception generated is:

      Version:1.0 StartHTML:000000192 EndHTML:000001722 StartFragment:000001466 EndFragment:000001683 StartSelection:000001469 EndSelection:000001683 SourceURL:http://localhost/xxxx/Execute  Exception Details: System.ServiceModel.FaultException`1[[CSClient.SWIS.InformationServiceFaultContract, XXXX, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]: Invoke failed, check fault information.

       

      Version:1.0 StartHTML:000000192 EndHTML:000002146 StartFragment:000001530 EndFragment:000002068 StartSelection:000001530 EndSelection:000002068 SourceURL:http://localhost/ddos/Execute 

      Version:1.0 StartHTML:000000192 EndHTML:000002146 StartFragment:000001530 EndFragment:000002068 StartSelection:000001530 EndSelection:000002068 SourceURL:http://localhost/ddos/Execute 

       

      [FaultException`1: Invoke failed, check fault information.]

         System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14799942

         System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +622

         CSClient.SWIS.InformationService.Invoke(String entity, String verb, ArrayOfXmlElement parameters) +0

         CSClient.SWIS.InformationServiceClient.Invoke(String entity, String verb, ArrayOfXmlElement parameters) +49

         XXXX.Data.ExecuteScripts(String sGroupName) +694

      .

      .

      .

       

      What am I missing?  I have tried inserting a dummy username as a final parameter with no luck.

       

      UPDATE:

       

      I have gotten a little further I believe by changing the Invoke to point to the Cirrus.ConfigArchive for execution as the SnippetArchive doesn't support Execute.

       

      The error I am now getting in the \SolarWinds\InformationService\v3.0\Orion.InformationService.log is:

       

      2015-04-24 16:34:50,540 [47] ERROR SolarWinds.InformationService.Core.InformationService - Exception for Operation: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

        <s:Header>

          <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://localhost:17778/SolarWinds/InformationService/v3/OrionBasic</To>

          <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://schemas.solarwinds.com/2007/08/informationservice/InformationService/Invoke</Action>

        </s:Header>

        <s:Body>

          <Invoke xmlns="http://schemas.solarwinds.com/2007/08/informationservice">

            <entity>Cirrus.ConfigArchive</entity>

            <verb>Execute</verb>

            <parameters xmlns:a="http://schemas.datacontract.org/2004/07/System.Xml" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

              <a:XmlElement>

                <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1b0bd892-e810-4eba-bb67-adfe356fc124</string>

              </a:XmlElement>

              <a:XmlElement>

                <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">SCRIPT</string>

              </a:XmlElement>

              <a:XmlElement>

                <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">USERNAME</string>

              </a:XmlElement>

            </parameters>

          </Invoke>

        </s:Body>

      </s:Envelope>

      2015-04-24 16:34:50,540 [47] ERROR SolarWinds.InformationService.Core.InformationService - Exception caught in method Invoke

      SolarWinds.InformationService.Verb.VerbExecutorException: Verb Cirrus.ConfigArchive.Execute cannot unpackage parameter 0 ---> System.Runtime.Serialization.SerializationException: Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''.

         at ReadArrayOfguidFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )

         at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

         at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

         at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

         at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)

         at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)

         at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)

         at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlReader reader, Boolean verifyObjectName)

         at SolarWinds.InformationService.Verb.VerbExecutorContext.UnpackageParameters(XmlElement[] parameters)

         --- End of inner exception stack trace ---

         at SolarWinds.InformationService.Verb.VerbExecutorContext.UnpackageParameters(XmlElement[] parameters)

         at SolarWinds.InformationService.Core.InformationService.<>c__DisplayClass12.<Invoke>b__e(VerbExecutorContext context)

         at SolarWinds.InformationService.Core.InformationService.InvokeInternal[T](String entity, String verb, Action`1 setupParameters, Func`2 extractReturnValue)

         at SolarWinds.InformationService.Core.InformationService.Invoke(String entity, String verb, XmlElement[] parameters)