cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How To define a remote service in Java SDK

rtoraskar
1-Newbie

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.



5 REPLIES 5
paic
1-Newbie
(To:rtoraskar)

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

alexe1
1-Newbie
(To:paic)

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?

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

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

billrei
5-Regular Member
(To:rtoraskar)

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);

}

Top Tags