Closed EC2311 closed 2 years ago
Please provide json and xml file. I wonder if the json provided from agent is correct.
here are json and xml files generated on phone (glpi agent) Inventory.zip
Hi @EC2311 Do you get the same error when it's the agent that sends the XML to GLPI ?
when it's XML :
And when it's the agent that sends the XML inventory ?
It's the report from my phone, and I can't connect it to the WIFI of my GLPI server. That's why I use the 'import' option...
OK, problem is the data provided are all incorrect.
First; there are HTML entities in the XML file, It's required to convert them to regular characters in order to import the file. Also, there is an unknown status value of dormant
on a network port (I've replaced with valid down
).
The JSON file is also incorrect, the request
level should not be present.
If I fix the XML and then use GLPI to convert it to JSON, the result is ok.
This may be an agent issue, we will investigate.
for information, it's the glpi agent from playstore 1.1.0 build 39329
Hi @EC2311 , after test
inventory send by agetnthe Agent
works fine
If I get the XML file generated by the agent (in the Download folder) is well formatted
compared to your file
where <![CDATA]]>
are encoded to <![CDATA]]>
how do you get the XML file generated by the agent?
Best regards
Hello
I shared it from my phone using bluetooth and Outlook
I checked in the download folder (with a file USB connected on the phone)
If i open using Edge : If I open using Notepad+
How do you 'open' your file in the download folder ?
Downloaded like you (with USB cable) and from VSCode
/ AndroidStudio
/ bluetooth
Original file have a good encoding each time.
Have you update inventory.xml file with NotePad++
when you send it here ?
Phone connected with USB -> using Explorer on my PC -> I go to download file on the phone Have a look on the screen I see below
I don't know if Explorer decode file before display it. Can you send inventory.xml (not altered)
Best regards
here is the original xml document generated by the phone Inventory.zip Best regards
The format is good
You can use this file to manually import device into GLPI
either on Chrome or Edge
I put a debug in conf.php (which seems to be the script which prompt message)
the var.txt file is well filled with the content of my initial file So I guess about the handles of the inventory_request...
No problem on my side
Can you use latest GLPI nightly build
I just uploaded the last version, : same error :(
to confirm :
I compare with a xml file issued from Fusion inventory (xml) I have no cdata in it. I try to upload it : I have a strange error in php log : JSON does not validate "---" does not match to .... inventory.php line 227
why json although I upload xml ?
Because XML file is converted as JSON from GLPI native inventory to validate data and format with this https://github.com/glpi-project/inventory_format/blob/master/inventory.schema.json
A CDATA section is "a section of element content that is marked for the parser to interpret as only character data, not markup."
The problem here is that the <![CDATA[ ]]>
is converted to <![CDATA[]]>
between the moment you retrieve the file from the phone (where fiel encoding is fine) and the moment you import the file into GLPI
Did you update (with notepad++ ) file before import ?
Hello
I rerun at the moment a new inventory on my phone. I transfer the file (xml) with bluetooth to my computer I upload it without updating it
always Same error.
Can we imagine a problem with php version ? I use 7.4.9 version. and you ?
PHP 7.4.3 but I don't think the problem is PHP
can you test by using the Agent to send XML inventory to GLPI (and not share and manually import) ?
Where GLPI is hosted ? Linux, IIS, Windows ?
Are you using apache2 / Nginx other ?
I can't connect my phone to the wifi network :( I cant' share the connection of my Pc computer (forbidden by admin) : that's why I used the bluetooth (or mail from phone to computer)
I use Windows 10 and a wamp installation with apache
One more information : As i Have 9.5.5 glpi with fusioninveotyr : There is a option to load the xml file here is the result of the import (no error when importing, but strange result)
Pour info : j'ai supprimé tous les lt; les gt; ainsi que les !Cdata[ et ]] l'import (hormis le status dormant -> up) passe et fonctionne.
je peux comprendre que le cdata peut faire partie du xml, mais en l'occurence l'import manuel ne le permet pas àl'heure actuelle
et le telehpone est importé dans ...ordinateur... :( je me suis dit : je vais creer le modele coté téléphone, et refaire l'import (apres avoir supprimé ordi) et non -> l'import ne vérifie pas que le modele existe dans telephone et 'limporte à nouveau dans ordi
Pour information la prochaine version de l'agent inclura une option permettant de choisir la destination Computer
ou Phone
Cette nouvelle option n'est valable que pour l'inventaire natif de GLPI (FusionInventory ne gère pas ce noeud)
Vous pouvez tester en ajoutant le noeud suivant dans le fichier XML
<ITEMTYPE>Phone</ITEMTYPE>
juste après la balise <REQUEST>
en haut du fichier XML.
Concernant le CDATA
ne reproduisant pas localement (même sur nos tests interne) il est difficile pour moi de comprendre ce qu'il se passe.
Bien cordialement
En effet, itemtype : c'est ok : le telephone est bien créé correctement.
dommage pour xml et l'import json egalement n'est pas ok (propriété requise manquante... + erreur avec deviceid (abstractrequest.php)
La priorité manquante à déjà fait l'objet d'un fix ici https://github.com/glpi-project/inventory_format/pull/69
Il sera intégrer prochainement dans GLPI
ok pour "dormant"
mais pour
Could you please use english?
Sorry in summury when removing cdata, lt; and gt; from the initial xml file -> ok to import (as computer, but as said by stonebuzz, the itemtype could be use in the file to split in the right item : ok
but I have still problem if I import using json (it's the screen shots of my last message) thanks
Please only use the XML (agent work with it)
Hi @EC2311 can you try with this version (futur latest of android-inventory-agent)
android-inventory-agent.tar.gz
This version remove all CDATA
from XML file
Reminder: only work with the XML file on GLPI !
You need to update your GLPI to the latest nightly build tomorrow
or apply manually apply this fix -> https://github.com/glpi-project/glpi/pull/11212
Hello
I removed the previous version of android I installed the new one I run it on the phone I transfered the filte using bluetooth to the computer
1- i remark the itemtype line but it contains 'computer' rather 'phone' -> i Updated it to upload as phone 2- when uploading : an error linked to camera
But I didn't update GLPI with the last version. 3- I updated GLPI : it's ok no error with camera
so : Very good ! (unless the itemtype ;) ) Thanks
perhaps still a mismatch in the volumes (drives) -> no name on the volumes (drives) ? (empty in the xml file)
Seems this is now fixed, I close this one.
Code of Conduct
Is there an existing issue for this?
Version
V10 RC3
Bug description
Hello when importing a json file (issue from GLPI agent on phone)
Json not valid, but it contains 'content' data...
Relevant log output
No response
Page URL
No response
Steps To reproduce
No response
Your GLPI setup information
No response
Anything else?
No response