Bonjour à tous,

Je travaille actuellement sur l'implémentation de web services soap en PHP.
J'utilise la librairie native SoapClient et SoapServer.

Je rencontre un problème qui semble provenir de l'écriture de mon fichier WSDL ci-joint :

Code xml : 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="UTF-8"?>
<definitions 	name="domainWS"
				xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
				xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     			xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
     			xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
     			xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     			xmlns="http://schemas.xmlsoap.org/wsdl/"
     			xmlns:tns="http://localhost/itmv2/web/soap/"
     			targetNamespace="http://localhost/itmv2/web/soap/">
	<types>
   		<xsd:schema xmlns:tns="http://localhost/itmv2/web/soap/" targetNamespace="http://localhost/itmv2/web/soap/">
    		<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    		<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
    		<xsd:element name="DomainWS">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element name="id" type="xsd:positiveInteger"/>
						<xsd:element name="name" type="xsd:string"/>
						<xsd:element name="isValid" type="xsd:boolean"/>
						<xsd:element name="level" type="xsd:positiveInteger"/>
						<xsd:element name="parentId" type="xsd:positiveInteger"/>
						<xsd:element name="errorCode" type="xsd:integer"/>
      					<xsd:element name="errorMessage" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="DomainListWS">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element name="tns:DomainWS" minOccurs="0" maxOccurs="unbounded"/>
						<xsd:element name="errorCode" type="xsd:integer"/>
      					<xsd:element name="errorMessage" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
   		</xsd:schema>
  	</types>
  	<message name="getDomainsRequest">
   		<part name="parameters" type="xsd:string" />
  	</message>
  	<message name="getDomainsResponse">
   		<part name="body" type="tns:DomainListWS" />
  	</message>
  	<portType name="domainWSPortType">
   		<operation name="getDomains">
    		<documentation>Retourne la liste des domaines fonctionnels</documentation>
    		<input message="tns:getDomainsRequest"/>
    		<output message="tns:getDomainsResponse"/>
   		</operation>
  	</portType>
  	<binding name="domainWSBinding" type="tns:domainWSPortType">
  		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  		<operation name="getDomains">
   			<soap:operation soapAction="http://localhost/itmv2/web/soap/reference-domain" />
   			<input>
				<soap:body use="literal"/>
	    	</input>
	    	<output>
				<soap:body use="literal"/>
	    	</output>
	    </operation>
 	</binding>
 	<service name="domainWSService">
  		<port name="ITMWServicePort" binding="tns:domainWSBinding">
   			<soap:address location="http://localhost/itmv2/web/soap/reference-domain" />
  		</port>
 	</service>
</definitions>

Lorsque j'utilise la méthode SoapClient->__getFunctions() voici ce que cela me retourne :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
array (size=1)
  0 => string 'UNKNOWN getDomains(string $parameters)'
Même si cela semble bien fonctionner (mis à part peut-être si ce wsdl passe au travers d'un analyseur), je préférerai :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
array (size=1)
  0 => string 'DomainListWS getDomains(string $parameters)'
Je pense que cela provient de la partie <message> de mon WSDL :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
<message name="getDomainsResponse">
   	<part name="body" type="tns:DomainListWS" />
 </message>
Si je mets :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
<message name="getDomainsResponse">
   	<part name="body" element="tns:DomainListWS" />
</message>
Alors j'ai bien :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
array (size=1)
  0 => string 'DomainListWS getDomains(string $parameters)'
Mais avec une erreur :

Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SOAP-ERROR: Encoding: object has no 'errorCode' property</faultstring>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope

En vous remerciant par avance pour votre aide précieuse.

Pierrick