Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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:
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
Solved! Go to Solution.
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.
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.
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!
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