Bonjour,

Je dois faire un serveur soap pour un client. Celui-ci m'envoi des messages du type :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
<myTestRequest>
    <library name="ma librairie">
        <books>
            <book ref="xy0">Tintin au tibet</book>
            <book ref="xy1">Tintin au congo</book>
            <book ref="xy3">Tintin au forum PHP 2008</book>
        </books>
    </library>    
</myTestRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Le wsdl (généré par eclipse) pour l'instant ressemble à :

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
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:tns="http://www.soaptest.com/soapTest/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="soap"
	targetNamespace="http://www.soaptest.com/soapTest/">
 
    <wsdl:message name="myTestRequest">
		<wsdl:part name="myTestRequest" type="xsd:anySimpleType" />
	</wsdl:message>
 
	<wsdl:message name="myTestResponse">
		<wsdl:part name="myTestResponse" type="xsd:anySimpleType" />
	</wsdl:message>
 
	<wsdl:portType name="soapPortType">
		<wsdl:operation name="myTest">
			<wsdl:input message="tns:myTestRequest"></wsdl:input>
			<wsdl:output message="tns:myTestResponse"></wsdl:output>
		</wsdl:operation>
	</wsdl:portType>
 
	<wsdl:binding name="soapBinding" type="tns:soapPortType">
		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
		<wsdl:operation name="myTest">
			<soap:operation soapAction="http://www.soaptest.com/soapTest/myTest" />
			<wsdl:input>
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
 
	<wsdl:service name="SOAPconnector">
		<wsdl:port binding="tns:soapBinding" name="soapPort">
			<soap:address
				location="http://192.168.0.11/soap/serveur.php" />
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>
Mon problème vient de ce que je reçois coté serveur en entrée de ma fonction myTest :

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
stdClass Object
(
    [library] => stdClass Object
        (
            [books] => stdClass Object
                (
                    [book] => Array
                        (
                            [0] => Tintin au tibet
                            [1] => Tintin au congo
                            [2] => Tintin au forum PHP 2008
                        )
 
                )
 
        )
 
)
Déjà c'est pas du xml mais ça c'est pas le plus gros pb, une petite fonction peut rapidement le convertir en XML. Mais les attributs ont tous disparu !

Comment faire pour récupérer en entrée, soit un objet simpleXML ou DOM, ou bien même le flux XML dans une string mais qu'il soit vraiment complet ?

nota : le flux xml d'exemple fait dans la réalité 20km de long et peux éventuellement avoir des namespaces un peu partout -_-