<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Help with Java API]]></title><description><![CDATA[<p dir="auto">Hello, I am trying write a simple Java program to help automate some tasks, and I am having some difficulty working with the API.  I wrote this test program:</p>
<p dir="auto">// NetXMS API Version 2.0.4</p>
<p dir="auto">import org.netxms.client.*;<br />
import org.netxms.base.*;<br />
import org.netxms.client.objects.*;</p>
<p dir="auto">public class xmstool<br />
{<br />
    public static void main(String[] args)<br />
    {<br />
        <br />
        try<br />
        {<br />
            NXCSession s = new NXCSession("NetXMS server");<br />
            s.connect();<br />
            s.login("user", "password");<br />
            <br />
            if(s.isConnected())<br />
            {<br />
                System.out.println("Connected");<br />
            }<br />
            else<br />
            {<br />
                System.out.println("Not connected");<br />
            }<br />
            <br />
            AbstractObject node = s.findObjectByName("name of node");<br />
            <br />
            if(node == null)<br />
            {<br />
                System.out.printf("Did not find node\n");<br />
            }<br />
                        <br />
        } catch(Exception e)<br />
        {<br />
            System.out.println("Fail");<br />
            <br />
        }<br />
    }<br />
}</p>
<p dir="auto">I the program runs, and connects to the server, but I am not able to get a valid node object no matter what name I search for.  Am I missing something? Andrew</p>
]]></description><link>https://forum.netxms.org/topic/4632/help-with-java-api</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 12:28:25 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4632.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Aug 2016 21:33:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help with Java API on Wed, 10 Aug 2016 16:42:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tomaskir" aria-label="Profile: tomaskir">@<bdi>tomaskir</bdi></a> said in <a href="/post/20583">Help with Java API</a>:</p>
<blockquote>
<p dir="auto">Just a side note:<br />
If you just need to modify GeoLocation data, consider using just a NXSL script, the &quot;Node&quot; object in NXSL has methods for GeoLocation retrieval and manipulation.</p>
<p dir="auto"><a href="https://wiki.netxms.org/wiki/NXSL:Node" rel="nofollow ugc">https://wiki.netxms.org/wiki/NXSL:Node</a></p>
</blockquote>
<p dir="auto">The 'setGeoLocation' method doesn't seem to work in NXSL, but I was able to successfully use a simple Java program to export the node names with their latitude and longitude from an older NetXMS server to a newer one.  Thank you for all your help!  Andrew</p>
]]></description><link>https://forum.netxms.org/post/20601</link><guid isPermaLink="true">https://forum.netxms.org/post/20601</guid><dc:creator><![CDATA[Andrew]]></dc:creator><pubDate>Wed, 10 Aug 2016 16:42:57 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Java API on Tue, 09 Aug 2016 11:41:33 GMT]]></title><description><![CDATA[<p dir="auto">Just a side note:<br />
If you just need to modify GeoLocation data, consider using just a NXSL script, the &quot;Node&quot; object in NXSL has methods for GeoLocation retrieval and manipulation.</p>
<p dir="auto"><a href="https://wiki.netxms.org/wiki/NXSL:Node" rel="nofollow ugc">https://wiki.netxms.org/wiki/NXSL:Node</a></p>
]]></description><link>https://forum.netxms.org/post/20583</link><guid isPermaLink="true">https://forum.netxms.org/post/20583</guid><dc:creator><![CDATA[tomaskir]]></dc:creator><pubDate>Tue, 09 Aug 2016 11:41:33 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Java API on Tue, 09 Aug 2016 11:26:31 GMT]]></title><description><![CDATA[<p dir="auto">Something like this:</p>
<pre><code>final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
GeoLocation location = GeoLocation.parseGeoLocation(latitude.getText(), longitude.getText());
md.setGeolocation(location);

final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
session.modifyObject(md);
</code></pre>
]]></description><link>https://forum.netxms.org/post/20582</link><guid isPermaLink="true">https://forum.netxms.org/post/20582</guid><dc:creator><![CDATA[alk]]></dc:creator><pubDate>Tue, 09 Aug 2016 11:26:31 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Java API on Tue, 09 Aug 2016 00:00:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tomaskir" aria-label="Profile: tomaskir">@<bdi>tomaskir</bdi></a> said in <a href="/post/20579">Help with Java API</a>:</p>
<blockquote>
<p dir="auto">You need to call "s.syncObjects();" after login, so it syncs server objects to the local client.</p>
<p dir="auto">Also, please use <strong>[code]</strong> tags when pasting code next time <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
</blockquote>
<p dir="auto">THANK YOU!!! that was the pierce to the puzzle I was looking for, and I will use the code tag in the future.</p>
<p dir="auto">Second question, I see a getGeolocation() method for getting the geolocation, but how does one go about setting the geolocation?  Andrew</p>
]]></description><link>https://forum.netxms.org/post/20580</link><guid isPermaLink="true">https://forum.netxms.org/post/20580</guid><dc:creator><![CDATA[Andrew]]></dc:creator><pubDate>Tue, 09 Aug 2016 00:00:20 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Java API on Mon, 08 Aug 2016 23:33:56 GMT]]></title><description><![CDATA[<p dir="auto">You need to call "s.syncObjects();" after login, so it syncs server objects to the local client.</p>
<p dir="auto">Also, please use <strong>[code]</strong> tags when pasting code next time <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://forum.netxms.org/post/20579</link><guid isPermaLink="true">https://forum.netxms.org/post/20579</guid><dc:creator><![CDATA[tomaskir]]></dc:creator><pubDate>Mon, 08 Aug 2016 23:33:56 GMT</pubDate></item></channel></rss>