3 Replies Latest reply on Sep 18, 2013 8:23 AM by Daniel Miller

    Need Help with Update through SOAP via VBScript

    Daniel Miller

      I want to write a GPO to apply to all of our server.  I plan for this GPO to run a vbscript to update/create (if Needed) Node Properties In Orion, including Custom Properties.
      I am able to get the QueryXML SOAP Method to Work, but I am Not able To figure out how to get the Update/Create methods to work Over SOAP.

      I'm not a total expert on VBScript, so there may be some issues with some of my approaches.   So, basically I wrote a SOAP Class in vbscript to take a wsdl link and find all the soap Methods.  It stores these Methods in a Dictionary.

      I have created another Class for NPM, that is basically Orion Specific stuff, Like Server/Port Information, and a couple Generic functions to pass to the SOAP class.

       

      So basically This Soap works for Querying:

      <?xml version="1.0"?>

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inf="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:prop="http://schemas.solarwinds.com/2007/08/informationservice/propertybag"><soapenv:Header/><soapenv:Body><inf:QueryXml><inf:query>SELECT Caption, NodeID, IP_Address FROM Orion.Nodes WHERE NodeID &gt; 479</inf:query><inf:parameters></inf:parameters></inf:QueryXml></soapenv:Body></soapenv:Envelope>

       

      But When I try to Update:

       

      <?xml version="1.0"?>

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inf="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:prop="http://schemas.solarwinds.com/2007/08/informationservice/propertybag"><soapenv:Header/><soapenv:Body><inf:Update><inf:query>swis://dtsfkoriont2/Orion/Orion.Nodes/NodeID=2/CustomProperties</inf:query><inf:parameters>ScriptVerify=Yes</inf:parameters></inf:Update></soapenv:Body></soapenv:Envelope>

       

      I get the following Error:

      9/16/2013 1:37:14 PM --> DEBUG -- (3) - CSOAP::Send() --> Status: 500

      9/16/2013 1:37:14 PM --> DEBUG -- (3) - CSOAP::Send() --> Status Txt: Internal Server Error

      9/16/2013 1:37:14 PM --> DEBUG -- (3) - CSOAP::Send() --> Receiving XML:

      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><log xmlns="http://schemas.solarwinds.com/2007/08/informationservice">2013-09-16 13:37:14,664 [18] ERROR SolarWinds.InformationService.Core.InformationService - Exception for Operation: &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inf="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:prop="http://schemas.solarwinds.com/2007/08/informationservice/propertybag"&gt;

        &lt;soapenv:Header&gt;

          &lt;To soapenv:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none"&gt;https://dtsfkoriont2:17778/SolarWinds/InformationService/v3/OrionBasic</To>

          &lt;Action soapenv:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none"&gt;http://schemas.solarwinds.com/2007/08/informationservice/InformationService/Update</Action>

        &lt;/soapenv:Header&gt;

        &lt;soapenv:Body&gt;

          &lt;inf:Update&gt;

            &lt;inf:query&gt;swis://dtsfkoriont2/Orion/Orion.Nodes/NodeID=2/CustomProperties&lt;/inf:query&gt;

            &lt;inf:parameters&gt;ScriptVerify=Yes&lt;/inf:parameters&gt;

          &lt;/inf:Update&gt;

        &lt;/soapenv:Body&gt;

      &lt;/soapenv:Envelope&gt;

      2013-09-16 13:37:14,664 [18] ERROR SolarWinds.InformationService.Core.InformationService - Exception caught in method Update

      System.ArgumentNullException: Value cannot be null.

      Parameter name: uri

         at SolarWinds.InformationService.Core.InformationService.Update(String uri, IDictionary`2 propertiesToUpdate)

      </log></s:Header><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">Update failed, check fault information.</faultstring><detail><InformationServiceFaultContract xmlns="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Message>Value cannot be null.

      Parameter name: uri</Message></InformationServiceFaultContract></detail></s:Fault></s:Body></s:Envelope>

       

       

      Thanks in advance for the help.  I can share my scripts when I get it completed.

        • Re: Need Help with Update through SOAP via VBScript
          Daniel Miller

          Ok, I've changed the SOAP Call Elements To the Following:

          <?xml version="1.0"?>

          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inf="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:prop="http://schemas.solarwinds.com/2007/08/informationservice/propertybag">

          <soapenv:Header/>

          <soapenv:Body>

          <inf:Update>

          <inf:uri>https://dtsfkoriont2:17778/Orion/Orion.Nodes/NodeId=2/CustomProperties</inf:uri>

          <inf:propertiesToUpdate>

          <prop:item>

          <prop:key>ScriptVerify</prop:key>

          <prop:type>Yes/No</prop:type>

          <prop:value>Yes</prop:value>

          </prop:item>

          </inf:propertiesToUpdate>

          </inf:Update>

          </soapenv:Body>

          </soapenv:Envelope>

           

          But now my error is:

          <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

             <s:Header>

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

             </s:Header>

             <s:Body>

                <s:Fault>

                   <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>

                   <faultstring xml:lang="en-US">Object reference not set to an instance of an object.</faultstring>

                   <detail>

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

                         <HelpLink i:nil="true"/>

                         <InnerException i:nil="true"/>

                         <Message>Object reference not set to an instance of an object.</Message>

                         <StackTrace><![CDATA[at SolarWinds.InformationService.Serialization.XmlStrippedSerializerCache.GetSerializer(Type type)

             at SolarWinds.InformationService.Serialization.SerializationHelper.Deserialize(String value, String typename)

             at SolarWinds.InformationService.Addons.PropertyBag.ReadXml(XmlReader reader)

             at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadIXmlSerializable(XmlSerializableReader xmlSerializableReader, XmlReaderDelegator xmlReader, XmlDataContract xmlDataContract, Boolean isMemberType)

             at System.Runtime.Serialization.XmlDataContract.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(XmlDictionaryReader reader, Boolean verifyObjectName)

             at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)

             at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)

             at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)

             at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)

             at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)

             at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)

             at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)

             at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)]]></StackTrace>

                         <Type>System.NullReferenceException</Type>

                      </ExceptionDetail>

                   </detail>

                </s:Fault>

             </s:Body>

          </s:Envelope>

           

          Thanks,

          • Re: Need Help with Update through SOAP via VBScript
            Daniel Miller

            Thanks tdanner

              I was able to get it to work.  the prop:type and prop:value was only part of it.  Property fields are case sensitive, so I needed a 'D' instead of a 'd' in NodeID. and the uri has to have swis:// instead of https://.

            So the following worked:

             

            <?xml version="1.0"?>

            <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inf="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:prop="http://schemas.solarwinds.com/2007/08/informationservice/propertybag">

            <soapenv:Header/>

            <soapenv:Body>

            <inf:Update>

            <inf:uri>swis://dtsfkoriont2/Orion/Orion.Nodes/NodeID=2/CustomProperties</inf:uri>

            <inf:propertiesToUpdate>

            <prop:item>

            <prop:key>ScriptVerify</prop:key>

            <prop:type>System.Boolean</prop:type>

            <prop:value>True</prop:value>

            </prop:item>

            </inf:propertiesToUpdate>

            </inf:Update>

            </soapenv:Body>

            </soapenv:Envelope>

             

             

            Thank you for your help.