5 Replies Latest reply on Jun 18, 2015 1:12 PM by billrei RSS
    Explorer

    How To define a remote service in Java SDK

    Hi,


    I want to call a remote service. Please can any one help in how to define a remote service or service in JAVA SDK and the link to download the JAVA SDK Document.



      • How To define a remote service in Java SDK
        paic Collaborator

        If you download the latest SDKs you'll find a Java SDK Doc PDF file packaged within it

         

          • Re: How To define a remote service in Java SDK
            alexe Apprentice

            I found this to not be the case. I downloaded the most recent Java SDK and it did not include any documentation whatsoever. The closest I could find therein was the Steam Sensor example files, which do show how to define a remote service and is somewhat useful, but is lacking in terms of full fledged documentation.

             

            Beyond the ptc support page and the Steam Sensor example I've found very little Java documentation. Is there truly a PDF or doc similar to what is provided for the C SDK? Are there javadocs I am missing?

              • Re: How To define a remote service in Java SDK
                Newbie

                Hi Alex and Rahul

                Can you try to find your answer in the ThingWorx Help Center? http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.0_hc/

                This help center definitely provides documentation for the Java SDK. In the very near future there will be a PDF available with the Java SDK download. In addition, there will be separate Help Center(s) for Edge documentation. However, at this time you can find all Java SDK documentation within the ThingWorx Help Center.

                Hope this helps

                  • Re: How To define a remote service in Java SDK
                    alexe Apprentice

                    Hi Linda,

                    Thanks for the response. I am familiar with the ThingWorx Help Center link you provided.

                     

                    However you have answered MY question, which is "Does additional documentation exist?" and it seems it doesn't, but is coming soon. I am looking forward to that. At least I won't be hunting down documentation that doesn't exist in the meantime.

                     

                    Additionally, Rahul's original question is answered there as well. I can say first hand that the method for defining a remote service is detailed fairly well at that link, and in the Steam Sensor example as well, which is also available at that link.

                     

                    Thank you very much!

                     

                    Alex

              • Re: How To define a remote service in Java SDK
                billrei Creator

                Here is an example that might help.

                 

                protected int remoteTimeout=20000;

                .....

                /**
                * This service does a simple thing.
                * <b>Note:</b> This is a remote call to the server
                * @param testValue
                * @param name
                * @throws Exception
                */
                public Double testService(Double testValue, String name) throws Exception {

                  ValueCollection paramValues = new ValueCollection();

                 

                   // Loop Through Setting parameters
                   paramValues.setValue("testValue",new NumberPrimitive(testValue));

                  paramValues.setValue("name",new StringPrimitive(name));

                  InfoTable infoTable = getClient().invokeService(RelationshipTypes.ThingworxEntityTypes.Things, getName(), "testService", paramValues, remoteTimeout);

                   if(infoTable!=null){

                   if(infoTable.getRowCount()>0){

                   return (Double)infoTable.getRow(0).getPrimitive("result").getValue();

                  }

                  }

                   return new Double(0);

                }