Bonjour à tous,
Je ne suis pas vraiment pratiquant de votre forum donc si je viens à votre rencontre c'est bien que j'ai un problème difficilement soluble.
Le Pitch :
J'interroge un serveur SOAP écrit en PHP via SOAPUI, lorsque j'envois un XML correspondant à la description de mon service (donc conforme au WSDL) j'obtiens une réponse vide. L'interrogation via un client PHP me retourne "Error Fetching http headers" et ce de manière instantanée (donc l'hypothèse d'un time out est à écarter j'ai aussi positionné ini_set('default_socket_timeout', 60); pour l'écarter définitivement). Si maintenant dans mon XML (SOAP UI) j'ajoute une balise <tutu/> ou si dans mon PHP j'ajoute à mon appel de service un paramètre 'bidon' alors le serveur SOAP me retourne l'exécution correcte de ma procédure.
Le Code :
Le serveur SOAP PHP (simplifié pour l'occasion, sans impact sur le comportement) :
La class output utilisée dans le serveur :
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 <?php //require_once "../../classes/palette.php"; require_once "../../classes/output.php"; ini_set('soap.wsdl_cache_enabled', 0); $serversoap=new SoapServer("http://devcmservices.fmlogistic.fr:82/wsdl/WS_palette.wsdl", array('cache_wsdl' => WSDL_CACHE_NONE)); //$HTTP_RAW_POST_DATA = file_get_contents('php://input'); function creation($paramSite,$paramClient,$paramPalette,$paramMessage_id= 0){ $ret_value= new output('0', 'Success full Creation'); return $ret_value; } function confirmation($paramSite,$paramClient,$paramPalette){ $ret_value= new output('0', 'Success full Confirmation'); return $ret_value; } $serversoap->addFunction("echoString"); $serversoap->addFunction(array("creation", "confirmation")); //$serversoap->setClass("palette"); $serversoap->handle(); ?>
Le WSDL (à mon avis c'est ici qu'il y a un problème...) :
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 <?php class output{ var $code; var $message; var $faultcode; function output($param_code, $param_message){ $this->code=$param_code; $this->faultcode=$param_code; $this->message=$param_message; } function getMessage(){ return $this->message; } function getCode(){ return $this->code; } function getFaultcode(){ return $this->code; } } ?>
Le client PHP (pardonnez les 70 cas de tests commentés...) :
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278 <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions name="WS_palette" targetNamespace="http://devcmservices.fmlogistic.fr:82/WS_palette/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://devcmservices.fmlogistic.fr:82/WS_palette/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://devcmservices.fmlogistic.fr:82/WS_palette/"> <xsd:element name="LOGIN" nillable="true" type="tns:LOGIN"/> <xsd:complexType name="LOGIN"> <xsd:sequence> <xsd:element name="username" type="xsd:string"></xsd:element> <xsd:element name="password" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name="output"> <xsd:sequence> <xsd:element name="code" type="xsd:string"></xsd:element> <xsd:element name="message" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> <xsd:element name="creation"> <xsd:complexType> <xsd:sequence> <xsd:element name="in" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="creationResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="out" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="reception"> <xsd:complexType> <xsd:sequence> <xsd:element name="in" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="receptionResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="out" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="confirmation"> <xsd:complexType> <xsd:sequence> <xsd:element name="in" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="confirmationResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="out" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="elm_pallet" nillable="true" type="tns:type_pallet"/> <xsd:complexType name="type_pallet"> <xsd:sequence> <xsd:element name="SSCC" type="xsd:string"></xsd:element> <xsd:element name="date_of_manufacture" type="xsd:dateTime"></xsd:element> <xsd:element name="best_before_date" type="xsd:date"></xsd:element> <xsd:element name="pallet_number" type="xsd:string"></xsd:element> <xsd:element name="magasin_zone" type="xsd:string"></xsd:element> <xsd:element name="location" type="xsd:string"></xsd:element> <xsd:element name="logistic_batch_number" type="xsd:string"> </xsd:element> <xsd:element name="WMS_order_number" type="xsd:string"></xsd:element> <xsd:element name="customer_order_number" type="xsd:string"> </xsd:element> <xsd:element name="cimsup_batch_number" type="xsd:string"></xsd:element> <xsd:element name="components_list" type="tns:components_list"> </xsd:element> <xsd:element name="original_manufacturing_order_number" type="xsd:string"> </xsd:element> <xsd:element name="destination_manufacturing_order_number" type="xsd:string"> </xsd:element> <xsd:element name="FM_qualitative_status" type="xsd:string"> </xsd:element> <xsd:element name="customer_qualitative_status" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name="components_list"> <xsd:sequence> <xsd:element name="component" type="tns:component" maxOccurs="unbounded" minOccurs="0"> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name="component"> <xsd:sequence> <xsd:element name="item_number" type="xsd:string"></xsd:element> <xsd:element name="quantity" type="xsd:int"></xsd:element> <xsd:element name="reserved_quantity" type="xsd:int"></xsd:element> <xsd:element name="unit" type="xsd:string"></xsd:element> <xsd:element name="shelf_life" type="xsd:string"></xsd:element> <xsd:element name="customer_order_line_number" type="xsd:string"> </xsd:element> <xsd:element name="WMS_order_line_number" type="xsd:string"> </xsd:element> <xsd:element name="child_SSCC" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> <xsd:element name="receptionFault"> <xsd:complexType> <xsd:sequence> <xsd:element name="receptionFault" type="xsd:string"></xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="confirmationFault"> <xsd:complexType> <xsd:sequence> <xsd:element name="confirmationFault" type="xsd:string"> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema></wsdl:types> <wsdl:message name="LOGIN"> <wsdl:part name="parameters" element="tns:LOGIN"/> </wsdl:message> <wsdl:message name="creationRequest"> <wsdl:part name="warehouse" type="xsd:string"></wsdl:part> <wsdl:part name="customer" type="xsd:string"></wsdl:part> <wsdl:part name="pallet" type="tns:type_pallet"></wsdl:part> <wsdl:part name="message_id" type="xsd:string"></wsdl:part> </wsdl:message> <wsdl:message name="creationResponse"> <wsdl:part name="return" type="tns:output"></wsdl:part> </wsdl:message> <wsdl:message name="receptionRequest"> <wsdl:part name="warehouse" type="xsd:string"></wsdl:part> <wsdl:part name="customer" type="xsd:string"></wsdl:part> <wsdl:part name="SSCC" type="xsd:string"></wsdl:part> </wsdl:message> <wsdl:message name="receptionResponse"> <wsdl:part name="return" type="tns:output"></wsdl:part> </wsdl:message> <wsdl:message name="confirmationRequest"> <wsdl:part name="warehouse" type="xsd:string"></wsdl:part> <wsdl:part name="customer" type="xsd:string"></wsdl:part> <wsdl:part name="pallet" type="tns:type_pallet"></wsdl:part> </wsdl:message> <wsdl:message name="confirmationResponse"> <wsdl:part name="return" type="tns:output"></wsdl:part> </wsdl:message> <wsdl:message name="creationFault"> <wsdl:part name="faultcode" type="tns:output"></wsdl:part> <!--<wsdl:part name="faultstring" type="xsd:string"></wsdl:part> <wsdl:part name="xdebug_message" type="xsd:string"></wsdl:part>--> </wsdl:message> <wsdl:message name="receptionFault"> <wsdl:part name="faultcode" type="tns:output"></wsdl:part> <!--<wsdl:part name="faultstring" type="xsd:string"></wsdl:part> <wsdl:part name="xdebug_message" type="xsd:string"></wsdl:part>--> </wsdl:message> <wsdl:message name="confirmationFault"> <wsdl:part name="faultcode" type="tns:output"></wsdl:part> <!--<wsdl:part name="faultstring" type="xsd:string"></wsdl:part> <wsdl:part name="xdebug_message" type="xsd:string"></wsdl:part>--> </wsdl:message> <wsdl:portType name="obj_pallet"> <wsdl:operation name="creation"> <wsdl:documentation>creation of the pallet which is waiting the receiving on CMS side</wsdl:documentation> <wsdl:input message="tns:creationRequest"></wsdl:input> <wsdl:output message="tns:creationResponse"></wsdl:output> <wsdl:fault name="fault" message="tns:creationFault"></wsdl:fault> </wsdl:operation> <wsdl:operation name="reception"> <wsdl:documentation>receiving of a waiting pallet </wsdl:documentation> <wsdl:input message="tns:receptionRequest"></wsdl:input> <wsdl:output message="tns:receptionResponse"></wsdl:output> <wsdl:fault name="fault" message="tns:receptionFault"></wsdl:fault> </wsdl:operation> <wsdl:operation name="confirmation"> <wsdl:documentation>Receiving confirmation of a pallet on WMS side which came from CMS side and execute the withdrawal of stock</wsdl:documentation> <wsdl:input message="tns:confirmationRequest"></wsdl:input> <wsdl:output message="tns:confirmationResponse"></wsdl:output> <wsdl:fault name="fault" message="tns:confirmationFault"></wsdl:fault> </wsdl:operation> </wsdl:portType> <wsdl:binding name="NewBinding" type="tns:obj_pallet"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="creation"> <soap:operation soapAction="http://devcmservices.fmlogistic.fr:82/WS_palette/creation" /> <wsdl:input> <soap:body use="literal" /> <soap:header message="tns:LOGIN" part="parameters" use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal" /> <soap:header message="tns:LOGIN" part="parameters" use="literal"/> </wsdl:output> <wsdl:fault name="fault"> <soap:fault use="literal" name="fault" /> </wsdl:fault> </wsdl:operation> <wsdl:operation name="reception"> <soap:operation soapAction="http://devcmservices.fmlogistic.fr:82/WS_palette/reception" /> <wsdl:input> <soap:body use="literal" /> <soap:header message="tns:LOGIN" part="parameters" use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal" /> <soap:header message="tns:LOGIN" part="parameters" use="literal"/> </wsdl:output> <wsdl:fault name="fault"> <soap:fault use="literal" name="fault" /> </wsdl:fault> </wsdl:operation> <wsdl:operation name="confirmation"> <soap:operation soapAction="http://devcmservices.fmlogistic.fr:82/WS_palette/confirmation" /> <wsdl:input> <soap:body use="literal" /> <soap:header message="tns:LOGIN" part="parameters" use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal" /> <soap:header message="tns:LOGIN" part="parameters" use="literal"/> </wsdl:output> <wsdl:fault name="fault"> <soap:fault use="literal" name="fault" /> </wsdl:fault> </wsdl:operation> </wsdl:binding> <wsdl:service name="serv_Pallet"> <wsdl:port name="pallet" binding="tns:NewBinding"> <soap:address location="http://devcmservices.fmlogistic.fr:82/server/WS_palette.php" /> </wsdl:port> </wsdl:service></wsdl:definitions>
Le XML (SOAP UI) qui ne fonctionne pas (correspondant à la définition du service au niveau paramètres string:warehouse/cstring:ustomer/objet:pallet) :
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 <?php set_include_path('/websuite/www/webservices/classes/'); require_once "login.php"; require_once "palette.php"; ini_set('default_socket_timeout', 60); $wsdl="http://devcmservices.fmlogistic.fr:82/wsdl/WS_palette.wsdl"; $service=new SoapClient($wsdl, array( 'wsdl_cache' => 0, 'trace' => 1, 'connection_timeout' => 5 )); $logins= new LOGIN('USERNAME','PASSWORD'); $header = new SoapHeader('NAMESPACE','LOGIN',$logins); $service->__setSoapHeaders($header); try{ $tabServicesResults=null; $paramSite='T76'; $paramClient='786400043'; $paramPalette= new palette(); $paramMessage_id="12"; $paramComponent = new component(); $paramComponent->item_number="0000680880"; $paramComponent->quantity="90"; $paramComponent->unit="PCE"; $paramComponent->shelf_life="15/05/2018"; $paramComponent->customer_order_line_number; $paramComponent->WMS_order_line_number; $paramComponent->child_SSCC; $paramComponent->reserved_quantity="0"; $paramPalette->add_component_line($paramComponent); $paramComponent = new component(); $paramComponent->item_number="0000680887"; $paramComponent->quantity="180"; $paramComponent->unit="PCE"; $paramComponent->shelf_life="15/05/2018"; $paramComponent->customer_order_line_number; $paramComponent->WMS_order_line_number; $paramComponent->child_SSCC; $paramComponent->reserved_quantity="0"; $paramPalette->add_component_line($paramComponent); $paramPalette->SSCC="696905240050235020"; $paramPalette->date_of_manufacture="12/05/2015"; $paramPalette->best_before_date="12/05/2018"; $paramPalette->pallet_number="12"; $paramPalette->magasin_zone="BUFF_IN"; $paramPalette->location="BUFFER2"; $paramPalette->logistic_batch_number="12121212"; $paramPalette->WMS_order_number="haha"; $paramPalette->customer_order_number="OF12"; $paramPalette->cimsup_batch_number=""; //$paramPalette->components_list; $paramPalette->original_manufacturing_order_number=""; $paramPalette->destination_manufacturing_order_number="OF13"; $paramPalette->FM_qualitative_status=""; $paramPalette->customer_qualitative_status=""; //$ret=$paramPalette->confirmation($paramSite,$paramClient,$paramPalette); //var_dump($ret); //$tabServicesResults=$service->reception('toto','titi','tata'); //var_dump($tabServicesResults); //$tabServicesResults=$service->confirmation($paramSite,$paramClient,'tutu'); //ça ne marche pas ... //$tabServicesResults=$service->confirmation($paramSite,$paramClient,$paramPalette); //ça marche $tabServicesResults=$service->confirmation($paramSite,$paramClient,$paramPalette,'toto'); //$tabServicesResults=$service->creation($paramSite,$paramClient,$paramPalette,$paramMessage_id); //$tabServicesResults=$service->creation($paramSite,$paramClient,$paramPalette,$paramMessage_id); /*$cmd=new commande(); $cmd->LOGIN($logins); $tabServicesResults=$cmd->reservation($paramSite,$paramClient,$paramOrder,$paramUrgent_order, $paramAction);*/ echo "Response :<br>", htmlentities($service->__getLastResponse()), "<br>"; var_dump($tabServicesResults); } catch( Exception $Ex ) { var_dump( $Ex ); echo "Request :<br>", htmlentities($service->__getLastRequest()), "<br>"; echo "Response :<br>", htmlentities($service->__getLastResponse()), "<br>"; } //phpinfo(); //$tabServicesResults=$service->confirmation($paramSite,$paramClient,$paramPalette); ?>
Le XML (SOAP UI) qui fonctionne (et ne correspondant pas à la définition du service au niveau paramètres string:warehouse/cstring:ustomer/objet:pallet + string:tutu ...):
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 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="NAMESPACE"> <SOAP-ENV:Header> <ns1:LOGIN> <username>USERNAME</username> <password>PASSWORD</password> </ns1:LOGIN> </SOAP-ENV:Header> <SOAP-ENV:Body> <warehouse>T76</warehouse> <customer>786400043</customer> <pallet> <SSCC>336042880604300975</SSCC> <date_of_manufacture>230420150000</date_of_manufacture> <best_before_date>280420160000</best_before_date> <pallet_number>TST3906785</pallet_number> <magasin_zone>098.005.05</magasin_zone> <location>098.005.05</location> <logistic_batch_number>CNE0653512</logistic_batch_number> <WMS_order_number>CMS0066446</WMS_order_number> <customer_order_number/> <cimsup_batch_number/> <components_list> <component> <item_number>0000651100</item_number> <quantity>4</quantity> <reserved_quantity/> <unit>COL</unit> <shelf_life>280420160000</shelf_life> <customer_order_line_number/> <WMS_order_line_number/> <child_SSCC/> </component> </components_list> <original_manufacturing_order_number/> <destination_manufacturing_order_number/> <FM_qualitative_status/> <customer_qualitative_status/> </pallet> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Les résultats sous SOAP UI :
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 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="NAMESPACE"> <SOAP-ENV:Header> <ns1:LOGIN> <username>USERNAME</username> <password>PASSWORD</password> </ns1:LOGIN> </SOAP-ENV:Header> <SOAP-ENV:Body> <warehouse>T76</warehouse> <customer>786400043</customer> <pallet> <SSCC>336042880604300975</SSCC> <date_of_manufacture>230420150000</date_of_manufacture> <best_before_date>280420160000</best_before_date> <pallet_number>TST3906785</pallet_number> <magasin_zone>098.005.05</magasin_zone> <location>098.005.05</location> <logistic_batch_number>CNE0653512</logistic_batch_number> <WMS_order_number>CMS0066446</WMS_order_number> <customer_order_number/> <cimsup_batch_number/> <components_list> <component> <item_number>0000651100</item_number> <quantity>4</quantity> <reserved_quantity/> <unit>COL</unit> <shelf_life>280420160000</shelf_life> <customer_order_line_number/> <WMS_order_line_number/> <child_SSCC/> </component> </components_list> <original_manufacturing_order_number/> <destination_manufacturing_order_number/> <FM_qualitative_status/> <customer_qualitative_status/> </pallet> <tutu/> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
La conclusion :
Je suis au bout de mes idées, j'ai essayé de modifier mon fichier WSDL, de le réécrire, de supprimer des morceaux d'en ajouter d'autres ... je reste persuadé que le problème vient soit du WSDL, soit de l'interprétation que SoapServer fait de ce WSDL... Je trouve quand même très très étrange qu'en ajoutant un paramètre non existant dans la description du service face marcher ce dernier... donc : A l'aiiiiiiddddeeeeeeuuuuh !
Merci d'avance !
Partager