Bonjour , je suis débutant en Soap.
je souhaite mettre en place un webservice me permettant de mettre à jour mon flux catalogue et récupérer mes commandes sur un site distant.
Le problème se pose pour la récupération des commandes.
J'utilise la librairie Nusoap avec la wsdl qui m'a été fourni. Les attributs demandés ne sont pas identifiés alors qu'ils sont bien dans le array envoyé.
Mon code
Maintenant mon message d'erreur
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 <?php require_once('lib/nusoap.php'); require_once('lib/nusoapmime.php'); $e_user_id = "2229"; $orderId = "20120660222901"; $now = date('Y-m-d\TH:i:s'); $client = new nusoap_client_mime('laredoute-order.wsdl', true); $client->soap_defencoding = 'utf-8'; $err = $client->getError(); if ($err) { echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; exit(); } $params = array( 'HubID' => '5', 'SellerID' => $e_user_id, 'MessageDate' => $now, 'MessageRelease' => '2.0', 'OrderID' => $orderId, ); $result = $client->call('RetrieveSellerOrder_2.0Op', $params); if ($client->fault) { echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>'; print_r($result); echo '</pre>'; } else { $err = $client->getError(); if ($err) { echo '<h2>Error</h2><pre>' . $err . '</pre>'; } echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; } ?>
Il faut savoir que je ne suis pas encore en prod mais en recette et je fais mes tests avec easyPhp
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 Array ( [faultcode] => SOAP-ENV:Server [faultstring] => This is an operation implementation generated fault [faultactor] => [detail] => Array ( [Fault_1.0] => Array ( [FaultId] => VALI_010 [FaultMessage] => Input data invalid [FaultTrace] => [BusinessServices/RCA_Order_2.0/Interface/RetrieveSellerOrder_2.0.process/Start] Output data invalid at com.tibco.pe.core.ProcessGroup.a(Unknown Source) at com.tibco.pe.core.ProcessGroup.eval(Unknown Source) at com.tibco.pe.plugin.Activity.eval(Unknown Source) at com.tibco.pe.core.TaskImpl.eval(Unknown Source) at com.tibco.pe.core.Job.a(Unknown Source) at com.tibco.pe.core.Job.k(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source) caused by: org.xml.sax.SAXException: validation error: attribute "HubID" is required ({com.tibco.xml.validation}COMPLEX_E_MISSING_ATTRIBUTE) at /{http://Redcats/Order/SellerOrder/2.0}RetrieveSellerOrderRequest_2.0[1]/parameters[1]/RetrieveSellerOrderRequest_2.0[1] com.tibco.xml.validation.exception.MissingAttributesException: attribute "HubID" is required at com.tibco.xml.validation.state.driver.ValidationJazz.a(ValidationJazz.java:821) at com.tibco.xml.validation.state.driver.ValidationJazz.endAttributes(ValidationJazz.java:790) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:87) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:92) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:92) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:129) at com.tibco.xml.xdata.bind.BindingRunner.validate(Unknown Source) at com.tibco.pe.core.ProcessGroup.a(Unknown Source) at com.tibco.pe.core.ProcessGroup.eval(Unknown Source) at com.tibco.pe.plugin.Activity.eval(Unknown Source) at com.tibco.pe.core.TaskImpl.eval(Unknown Source) at com.tibco.pe.core.Job.a(Unknown Source) at com.tibco.pe.core.Job.k(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source) validation error: attribute "SellerID" is required ({com.tibco.xml.validation}COMPLEX_E_MISSING_ATTRIBUTE) at /{http://Redcats/Order/SellerOrder/2.0}RetrieveSellerOrderRequest_2.0[1]/parameters[1]/RetrieveSellerOrderRequest_2.0[1] com.tibco.xml.validation.exception.MissingAttributesException: attribute "SellerID" is required at com.tibco.xml.validation.state.driver.ValidationJazz.a(ValidationJazz.java:821) at com.tibco.xml.validation.state.driver.ValidationJazz.endAttributes(ValidationJazz.java:790) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:87) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:92) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:92) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:129) at com.tibco.xml.xdata.bind.BindingRunner.validate(Unknown Source) at com.tibco.pe.core.ProcessGroup.a(Unknown Source) at com.tibco.pe.core.ProcessGroup.eval(Unknown Source) at com.tibco.pe.plugin.Activity.eval(Unknown Source) at com.tibco.pe.core.TaskImpl.eval(Unknown Source) at com.tibco.pe.core.Job.a(Unknown Source) at com.tibco.pe.core.Job.k(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source) validation error: attribute "MessageDate" is required ({com.tibco.xml.validation}COMPLEX_E_MISSING_ATTRIBUTE) at /{http://Redcats/Order/SellerOrder/2.0}RetrieveSellerOrderRequest_2.0[1]/parameters[1]/RetrieveSellerOrderRequest_2.0[1] com.tibco.xml.validation.exception.MissingAttributesException: attribute "MessageDate" is required at com.tibco.xml.validation.state.driver.ValidationJazz.a(ValidationJazz.java:821) at com.tibco.xml.validation.state.driver.ValidationJazz.endAttributes(ValidationJazz.java:790) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:87) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:92) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:92) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:129) at com.tibco.xml.xdata.bind.BindingRunner.validate(Unknown Source) at com.tibco.pe.core.ProcessGroup.a(Unknown Source) at com.tibco.pe.core.ProcessGroup.eval(Unknown Source) at com.tibco.pe.plugin.Activity.eval(Unknown Source) at com.tibco.pe.core.TaskImpl.eval(Unknown Source) at com.tibco.pe.core.Job.a(Unknown Source) at com.tibco.pe.core.Job.k(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source) at com.tibco.xml.xdata.bind.BindingRemarkHandler.assertNoErrors(Unknown Source) at com.tibco.xml.xdata.bind.BindingRunner.validate(Unknown Source) at com.tibco.pe.core.ProcessGroup.a(Unknown Source) at com.tibco.pe.core.ProcessGroup.eval(Unknown Source) at com.tibco.pe.plugin.Activity.eval(Unknown Source) at com.tibco.pe.core.TaskImpl.eval(Unknown Source) at com.tibco.pe.core.Job.a(Unknown Source) at com.tibco.pe.core.Job.k(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source) [TrcTs] => 2012-03-21T09:35:44.51+01:00 [msgID] => 3a14X5O1n1kDQpZwxhxZLe6HduM= ) ) )
Dans le message d'erreur en rouge vous verrez les attributs manquants mais qui sont bien transmis en rouge dans mon code.
Merci d'avance pour votre compréhension.
Cordialement
Partager