Bonjour à tous,
Voilà, j'utilise la librairie nusoap 0.7.3 (qui est la dernière me semble-il) et j'ai un petit souci.
Je travaille sur deux machines différentes et avec deux fichiers php (un serveur qui génére le wsdl et le client qui appel une fonction : MaFonction) sont identique.
Sur le premier serveur, j'obtiens le résultat escompté :
Requete:
Reponse:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9POST /webservices/mon_ws.php HTTP/1.0 Host: dev1.chezmoi.net User-Agent: NuSOAP/0.7.3 (1.114) Content-Type: text/xml; charset=ISO-8859-1 SOAPAction: "urn:MonWSDL#MaFonction" Content-Length: 529 <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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:tns="urn:MonWSDL"><SOAP-ENV:Body><tns:MaFonction xmlns:tns="urn:MonWSDL"><votre_nom xsi:type="xsd:string">Bridou</votre_nom></tns:MaFonction></SOAP-ENV:Body></SOAP-ENV:Envelope>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11HTTP/1.1 200 OK Date: Wed, 27 Feb 2008 08:29:39 GMT Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-22 mod_ssl/2.0.54 OpenSSL/0.9.7e X-Powered-By: PHP/4.3.10-22 X-SOAP-Server: NuSOAP/0.7.3 (1.114) Content-Length: 454 Connection: close Content-Type: text/xml; charset=ISO-8859-1 <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope 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/"><SOAP-ENV:Body><ns1:MaFonctionResponse xmlns:ns1="urn:MonWSDL"><return xsi:type="xsd:string">Salut Bridou</return></ns1:MaFonctionResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
Tandis que sur le second serveur la requête est toujours correcte mais la réponse renvoyée est en fait la définition du wsdl purement et simplement :
Requete:
Reponse:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9POST /soap/mon_ws.php?wsdl HTTP/1.0 Host: monIP:3128 User-Agent: NuSOAP/0.7.3 (1.114) Content-Type: text/xml; charset=ISO-8859-1 SOAPAction: "urn:MonWSDL#MaFonction" Content-Length: 529 <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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:tns="urn:MonWSDL"><SOAP-ENV:Body><tns:MaFonction xmlns:tns="urn:MonWSDL"><votre_nom xsi:type="xsd:string">Bridou</votre_nom></tns:MaFonction></SOAP-ENV:Body></SOAP-ENV:Envelope>
Ce n'est pas moi qui est configuré les machines mais la différence notable que j'ai souligné est la suivante :
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
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
69HTTP/1.1 200 OK Date: Wed, 27 Feb 2008 08:40:07 GMT Server: Apache Content-Length: 3055 Connection: close Content-Type: text/xml; charset=ISO-8859-1 <?xml version="1.0" encoding="ISO-8859-1"?> <definitions 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:tns="urn:MonWSDL" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:MonWSDL"> <types> <xsd:schema targetNamespace="urn:MonWSDL" > <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> <xsd:complexType name="Personne"> <xsd:all> <xsd:element name="prenom" type="xsd:string"/> <xsd:element name="age" type="xsd:int"/> </xsd:all> </xsd:complexType> <xsd:complexType name="TypeRetour"> <xsd:all> <xsd:element name="retour_1" type="xsd:string"/> <xsd:element name="retour_2" type="xsd:string"/> <xsd:element name="retour_3" type="xsd:string"/> </xsd:all> </xsd:complexType> </xsd:schema> </types> <message name="MaFonctionRequest"> <part name="votre_nom" type="xsd:string" /></message> <message name="MaFonctionResponse"> <part name="return" type="xsd:string" /></message> <message name="MaSecondeFonctionRequest"> <part name="var_personne" type="tns:Personne" /></message> <message name="MaSecondeFonctionResponse"> <part name="return" type="tns:TypeRetour" /></message> <portType name="MonWSDLPortType"> <operation name="MaFonction"> <documentation>Fonction qui dit salut !</documentation> <input message="tns:MaFonctionRequest"/> <output message="tns:MaFonctionResponse"/> </operation> <operation name="MaSecondeFonction"> <documentation>Greet a person entering the sweepstakes</documentation> <input message="tns:MaSecondeFonctionRequest"/> <output message="tns:MaSecondeFonctionResponse"/> </operation> </portType> <binding name="MonWSDLBinding" type="tns:MonWSDLPortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="MaFonction"> <soap:operation soapAction="urn:MonWSDL#MaFonction" style="rpc"/> <input><soap:body use="encoded" namespace="urn:MonWSDL" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input> <output><soap:body use="encoded" namespace="urn:MonWSDL" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output> </operation> <operation name="MaSecondeFonction"> <soap:operation soapAction="urn:MonWSDL#MaSecondeFonction" style="rpc"/> <input><soap:body use="encoded" namespace="urn:MonWSDL" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input> <output><soap:body use="encoded" namespace="urn:MonWSDL" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output> </operation> </binding> <service name="MonWSDL"> <port name="MonWSDLPort" binding="tns:MonWSDLBinding"> <soap:address location="http://monIP:3128/soap/mon_ws.php?wsdl"/> </port> </service> </definitions>
Serveur 1 : Apache 2 + Php4
Serveur 2 : Apache 2 + Php5 (et j'utilise un port différent : 3128)
Au niveau du code je sais donc que c'est correct (puisque les fichiers sont identiques sur chaque serveur). De plus si j'essaie d'accéder à une fonction inexistante, j'obtiens bien une erreur sur les deux serveurs. Donc c'est vraiment la réponse de soap qui coince.
Auriez vous des pistes à m'indiquer pour que je vérifie à quel niveau cela peut survenir ? Est-il possible que la configuration de php ou apache bloque la réponse du nusoap ?
Car en regardant l'entête de la réponse du second serveur il manque bien :
X-SOAP-Server: NuSOAP/0.7.3 (1.114)
Merci pour votre aide !
Bonne journée
Bridou
Partager