Salut à tous
je suis en PHP et je dois envoyer une requete XML. On m'a donné les valeurs que je dosi envoyer vers le serveur XML mais je n'arrive pas à l'envoyer. Voici ce que je dois envoyer.
a ce que j'ai compris la première partie du code est le header. Il y a une variable Autentification qui me permet d'acceder au 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 POST monurl HTTP/1.0 Host: name.name.fr Content-Type: text/xml; charset=utf-8 Content-Length: 823 Autentification=xxxxx Action="" <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <ns1:mafonction xmlns:ns1="urn:aa"> <var1 xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">$variable1</var1> <var2 xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></var2> </ns1:mafonction> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
J'ai essayé d'envoyer la requete avec nusoap.php mais j'obtiens une reponse nulle. Voici mon code
var_dump($client) me retourne null, requete est a vide et $reponse me donne un message autentification failed. Donc je pense que j'ai mal envoyé ma requete. J'ai donc rajouté au debut de mon code ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13require_once('nusoap.php'); $url='monurl'; flux='<Autentification>xxxxx</Autentification>'; flux.='<ns1:mafonction xmlns:ns1="urn:aa">'; flux.='<var1 xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">$variable1</var1>'; flux.='<var2 xsi:type="xsd:string" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></var2>'; flux.='</ns1:mafonction>'; $soapclient->debug_flag = true; $soapclient = new soapclient($url, 'wsdl'); $requete = $soapclient->call('getEligibilite', $flux); $reponse = $soapclient->response;
mais ca ne fonctionne pas mieux.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7header('POST monurl HTTP/1.0) ; header('POST Host: name.name.fr) ; header('POST Content-Type: text/xml; charset=utf-8) ; header('POST Content-Length: 823) ; header('POST Autentification=xxxxx) ; header('POST Action="") ;
Je n'y connais pas grand chose en XML donc excusez moi si je n'ai pas été tres clair dans mes explications. A ce que j'ai compris je n'arrive pas à envoyer le header. Mais bon...
en vous remerciant
RO






Répondre avec citation
Partager