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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Unity - Transfer Values Infotable via Thingworx Service

PeterS
3-Newcomer

Unity - Transfer Values Infotable via Thingworx Service

Hello Community,

 

I hope my English is sufficient to explain my Problem.

 

I developed an App in Unity to transfer Data/Information about Test Parts for my Masterthesis and I am nearly finished.

I have only one Problem to transfer Data from my Unity App to our ThingWorx Server.

 

I wrote an Service to transfer my Data to my Info Table:

 

ServiceCode:

 

var koorDaten = new Object();
koorDaten.Koordinaten = objektkoor;
koorDaten.Betreff = objektbetreff;
var tablereference = me.Koor;
tablereference.AddRow(koorDaten);

Code in Unity

                string myPostData = "{\"objektKoor\":\"" + 444545 + "\", \"objektBetreff\":\"" + 1333 + "\"}";
byte[] pData = Encoding.ASCII.GetBytes(myPostData.ToCharArray()); Debug.Log(pData); string auswertung = Encoding.ASCII.GetString(pData); Debug.Log(auswertung); Debug.Log(System.BitConverter.ToString(pData).Replace("-", string.Empty).ToLower()); Dictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("cache-control", "no-cache"); dictionary.Add("appkey", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); dictionary.Add("content-type", "application/json"); dictionary.Add("accept", "application/json"); WWW call = new WWW("http:/xxxxxxxxxxxxxxxxxxxxxxxxxxx.de/Thingworx/Things/Koordinaten/Services/UnityDaten", pData, dictionary);

 

Now I have only one small Problem, my rows are all blanc, the rows are created but no values are in them

 

Screenshot:

TW.PNG

 

I cant seem to the Problem, I am stuck, looking into my Code, but cant find the Problem.

 

I hope someone could help me out, thank you very much

 

 

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:PeterS)

BeIs your code complete in the top?

I would've expected a

me.Koor = tablereference;

at the end

 

Also did you make sure to match the cases you are using in the DataShape?

Betreff vs. betreff (double check just in case)

 

I would add some logging in your Thingworx service just to make sure that the input parameters are indeed populated.

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:PeterS)

BeIs your code complete in the top?

I would've expected a

me.Koor = tablereference;

at the end

 

Also did you make sure to match the cases you are using in the DataShape?

Betreff vs. betreff (double check just in case)

 

I would add some logging in your Thingworx service just to make sure that the input parameters are indeed populated.

PeterS
3-Newcomer
(To:PaiChung)

I did find my Problem, thank you Mr. PaiChung.

 

I had a Problem with the Cases.

 

I did write my Variable with a big letter:

 

string myPostData = "{\"objektKoor\":\"" + 444545 + "\", \"objektBetreff\":\"" + 1333 + "\"}";

objektKoor had to be writen with a lower case for K: objektkoor

objektBetreff hat to be writen with a lower case for B: objektbetreff

 

Now everything works like it should.

 

Thank you very much, I did appriciate your Help !!! Thank you again!

 

slangley
23-Emerald II
(To:PeterS)

Hi @PeterS.

 

Since you have found the solution to your problem, please mark it as the Accepted Solution for the benefit of other users with the same issue.

 

Thank you for using our Community!

 

Regards.

 

--Sharon

Announcements


Top Tags