Bonsoir![]()
Voilà, je dois parser un POST reçu, qui contient du SOAP :
Donc j'ai suivi le tuto de developpez.com (http://cynober.developpez.com/tutori...a/xml/jdom/#L3 , donc avec jdom / sax ) pour le parsing XML, ça marche impeccable.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> <soapenv:Header> <cwmp:ID soapenv:mustUnderstand="1">7_THOM_TR69_ID</cwmp:ID> </soapenv:Header> <soapenv:Body> <cwmp:Inform> <DeviceId> ...
Mais pour le SOAP, rien ne passe. Je ne peux rien récupérer !
Voire les commentaires de ce code :
Donc voilà, et en plus y'a vraiment pas grand chose '(voire rien) d'exploitable sur le net... Je suis bien tombé sur les librairies SOAPFactory, SOAPEnveloppe, mais j'ai trouvé aucun tuto permettant de les utiliser...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 private void debugDisplayParsedXML(HttpServletRequest request) { Element racine =null; org.jdom.Document document =null; SAXBuilder sxb = new SAXBuilder(); try { document = sxb.build(request.getInputStream()); } catch(Exception e){ e.printStackTrace();} //On initialise un nouvel élément racine avec l'élément racine du document. racine = document.getRootElement(); logger.info("taille de Racine:"+racine.getContentSize()); // Ici j'obient 5 comme taille // ces deux lignes foire complètement : le getChildren ne retourne rien List listElement = racine.getChildren("soapenv"); logger.info("Nombre d'enfants : "+listElement.size()); // évidemment, le reste ne marche pas ^^ Iterator i = listElement.iterator(); while(i.hasNext()) { Element courant = (Element)i.next(); logger.info(" Nom : "+courant.getChild("").getText()); } }
Bref, j'implore de l'aide!![]()
Partager