Salut,
J'ai déployé un petit webservice retournant un string helloword(). Après des tests en java ca marche super bien. En fouillant un peut sur le web pour faire un client en php j'ai écris ceci :Mon serveur apache me retourne une erreur du genre
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 <?php echo "begin"; // première étape : désactiver le cache lors de la phase de test ini_set("soap.wsdl_cache_enabled", "0"); ?> <br> <?php echo "=========1=========== "; // lier le client au fichier WSDL $client = new SoapClient('http://localhost:8084/CalculatorWSApplication/helloWS?wsdl', array( "trace" => 1, // enable trace to view what is happening "exceptions" => 0, // disable exceptions "cache_wsdl" => 0) // disable any caching on the wsdl, encase you alter the wsdl server ); ?> <br> <?php echo "=========2========== "; ?> <br> <?php // executer la methode getHello echo $client->helloWord(); echo "=========3============" ; // display what was sent to the server (the request) echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>"; // display the response from the server echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>"; ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 [Mon Apr 11 13:47:23 2011] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch configured -- resuming normal operations [Mon Apr 11 13:47:30 2011] [error] [client 127.0.0.1] PHP Catchable fatal error: Object of class stdClass could not be converted to string in /var/www/test.php on line 30, referer: http://localhost/
Je suis un bleu en php, et j'avoue ne pas comprendre ce probleme :"stdClass could not be converted to string" ma methode retourne un string c'est fou.
voici mon wsdl
Merci de m'éclairer
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 <!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-740-. --> − <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-740-. --> − <definitions targetNamespace="http://calculator.me/" name="CalculatorWSService"> − <types> − <xsd:schema> <xsd:import namespace="http://calculator.me/" schemaLocation="http://localhost:8084/CalculatorWSApplication/CalculatorWS?xsd=1"/> </xsd:schema> </types> − <message name="add"> <part name="parameters" element="tns:add"/> </message> − <message name="addResponse"> <part name="parameters" element="tns:addResponse"/> </message> − <message name="helloWord"> <part name="parameters" element="tns:helloWord"/> </message> − <message name="helloWordResponse"> <part name="parameters" element="tns:helloWordResponse"/> </message> − <message name="getarray"> <part name="parameters" element="tns:getarray"/> </message> − <message name="getarrayResponse"> <part name="parameters" element="tns:getarrayResponse"/> </message> − <portType name="CalculatorWS"> − <operation name="add"> <input wsam:Action="http://calculator.me/CalculatorWS/addRequest" message="tns:add"/> <output wsam:Action="http://calculator.me/CalculatorWS/addResponse" message="tns:addResponse"/> </operation> − <operation name="helloWord"> <input wsam:Action="http://calculator.me/CalculatorWS/helloWordRequest" message="tns:helloWord"/> <output wsam:Action="http://calculator.me/CalculatorWS/helloWordResponse" message="tns:helloWordResponse"/> </operation> − <operation name="getarray"> <input wsam:Action="http://calculator.me/CalculatorWS/getarrayRequest" message="tns:getarray"/> <output wsam:Action="http://calculator.me/CalculatorWS/getarrayResponse" message="tns:getarrayResponse"/> </operation> </portType> − <binding name="CalculatorWSPortBinding" type="tns:CalculatorWS"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> − <operation name="add"> <soap:operation soapAction=""/> − <input> <soap:body use="literal"/> </input> − <output> <soap:body use="literal"/> </output> </operation> − <operation name="helloWord"> <soap:operation soapAction=""/> − <input> <soap:body use="literal"/> </input> − <output> <soap:body use="literal"/> </output> </operation> − <operation name="getarray"> <soap:operation soapAction=""/> − <input> <soap:body use="literal"/> </input> − <output> <soap:body use="literal"/> </output> </operation> </binding> − <service name="CalculatorWSService"> − <port name="CalculatorWSPort" binding="tns:CalculatorWSPortBinding"> <soap:address location="http://localhost:8084/CalculatorWSApplication/CalculatorWS"/> </port> </service> </definitions>
Partager