Quantcast
Channel: THWACK: Discussion List - All Communities
Viewing all articles
Browse latest Browse all 16365

Need help trying to add a node to a group container using Perl

$
0
0

Thanks to some examples you've posted here, I've been able to add a new node and to unmanage a node from a perl script.  But now I want to take a node I've added and place it into a pre-existing group.   A distilled version of my code, which is based on something I found in this forum, is below.  I know  that groupID 42 exists and I know that a new node I created has nodeID 3114.   When I run it, I get "System.NullReferenceException: Object reference not set to an instance of an object." which is not giving me much of a clue.  AFAICT this code is identical to code posted earlier.    Can anyone help?   I don't know how you all have been able to figure out so much when there is no full SDK/API documentation available!  (Or is there some good doc hidden away that I am just not finding?).  

 

#!/usr/bin/perl

use SW::InformationService;

use SOAP::Lite;

use XML::LibXML;

my $username = "xxxxxxxxxx";

my $password = "yyyyyyyyy";

my $nodeID = 3114;

my $groupID = 42;

 

my $endpoint = "https://aaaaa.bbb.ccc:17778/SolarWinds/InformationService/v3/OrionBasic";

my $swis = SW::InformationService->new();

$swis->outputxml("true");

$swis->proxy($endpoint);

$swis->proxy->ssl_opts(verify_hostname => 0);

$swis->proxy->ssl_opts(SSL_verify_mode => SSL_VERIFY_NONE);

$swis->proxy->http_request->authorization_basic($username, $password);

 

my $memberDefinitionInfo = SOAP::Data->type('xml'=>

  "<MemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>

  <Name></Name>

  <Definition>swis://./Orion/Orion.Nodes/NodeID=3114</Definition>

   </MemberDefinitionInfo>");

 

print $swis->Invoke("Orion.Container", "AddDefinition", [$groupID, $memberDefinitionInfo]);

 

$ ./add_node_to_group.pl

 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><log xmlns="http://schemas.solarwinds.com/2007/08/informationservice">2015-05-05 16:31:49,124 [16] ERROR SolarWinds.InformationService.Core.Informa

tionService - (null) &#xD;

Exception for Operation: &lt;soap:Envelope xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsap="http://schemas.x

mlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:swis="http://schemas.solarwinds.com/2007/08/informationservice

" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:msa="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:sys="http://schemas.datacontract.org/20

04/07/System.Xml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:swpb="http://schemas.solarwinds.com/2007/08/informationservice/propertybag" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="ht

tp://www.w3.org/2005/08/addressing" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" x

mlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"&gt;&#xD;

  &lt;s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;&#xD;

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

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

  &lt;/s:Header&gt;&#xD;

  &lt;soap:Body&gt;&#xD;

    &lt;swis:Invoke&gt;&#xD;

      &lt;swis:entity xsi:type="xsd:string"&gt;Orion.Container&lt;/swis:entity&gt;&#xD;

      &lt;swis:verb xsi:type="xsd:string"&gt;AddDefinition&lt;/swis:verb&gt;&#xD;

      &lt;swis:parameters&gt;&#xD;

        &lt;sys:XmlElement&gt;&#xD;

          &lt;arg xsi:type="xsd:int"&gt;42&lt;/arg&gt;&#xD;

        &lt;/sys:XmlElement&gt;&#xD;

        &lt;sys:XmlElement&gt;&#xD;

          &lt;MemberDefinitionInfo xmlns="http://schemas.solarwinds.com/2008/Orion"&gt;

  &lt;Name&gt;&lt;/Name&gt;

  &lt;Definition&gt;swis://./Orion/Orion.Nodes/NodeID=3114&lt;/Definition&gt;

    &lt;/MemberDefinitionInfo&gt;&#xD;

        &lt;/sys:XmlElement&gt;&#xD;

      &lt;/swis:parameters&gt;&#xD;

    &lt;/swis:Invoke&gt;&#xD;

  &lt;/soap:Body&gt;&#xD;

&lt;/soap:Envelope&gt;&#xD;

2015-05-05 16:31:49,124 [16] ERROR SolarWinds.InformationService.Core.InformationService - (null) &#xD;

Exception caught in method Invoke&#xD;

System.NullReferenceException: Object reference not set to an instance of an object.&#xD;

   at SolarWinds.InformationService.Verb.VerbExecutor.Invoke(Object hostInstance, Object[] parameters)&#xD;

   at SolarWinds.InformationService.Verb.VerbExecutorContext.Invoke()&#xD;

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

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

</log></s:Header><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">Invoke 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>Object reference not set to an instance of an object.</Message><ExceptionType>System.NullReferenceException</ExceptionType><Ful

lException>System.NullReferenceException: Object reference not set to an instance of an object.&#xD;

   at SolarWinds.InformationService.Verb.VerbExecutor.Invoke(Object hostInstance, Object[] parameters)&#xD;

   at SolarWinds.InformationService.Verb.VerbExecutorContext.Invoke()&#xD;

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

   at SolarWinds.InformationService.Core.InformationService.Invoke(String entity, String verb, XmlElement[] parameters)</FullException></InformationServiceFaultContract></detail></s:Fault></s


Viewing all articles
Browse latest Browse all 16365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>