Bonjour,
J'utilise Zend_Soap_Client pour consommer un service qui a été écrit en java sous netbeans. L'appel fonctionne, seulement les paramètres envoyés par PHP ne sont pas reçus pas le ws. Les chaines sont vides. J'utilise Zend_Soap_Client en mode non-wsdl.
Le wsdl définissant ce service est le suivant :
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
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions name="Authentification"
targetNamespace="http://localhost:8080/XXXX/Authentification"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://localhost:8080/XXXX/Authentification"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<message name="authentifierRequest">
<part name="email" type="xsd:string"/>
<part name="mdp" type="xsd:string"/>
</message>
<message name="authentifierResponse">
<part name="authentifierResult" type="xsd:int"/>
</message>
<message name="deconnecterRequest">
<part name="email" type="xsd:string"/>
</message>
<message name="deconnecterResponse">
<part name="deconnecterResult" type="xsd:boolean"/>
</message>
<portType name="Authentification">
<operation name="authentifier" parameterOrder="email mdp">
<input message="tns:authentifierRequest"/>
<output message="tns:authentifierResponse"/>
</operation>
<operation name="deconnecter" parameterOrder="email">
<input message="tns:deconnecterRequest"/>
<output message="tns:deconnecterResponse"/>
</operation>
</portType>
<binding name="AuthentificationPortBinding" type="tns:Authentification">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="authentifier">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="deconnecter">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Authentification">
<port name="AuthentificationPort" binding="tns:AuthentificationPortBinding">
<soap:address location="http://localhost:8080/XXXX/Authentification"/>
</port>
</service>
</definitions> |
Le code de ce web service est le suivant :
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
| import javax.jws.WebService;
@WebService(serviceName = "Authentification", portName = "AuthentificationPort", endpointInterface = "localhost._8080.XXXX.authentification.Authentification", targetNamespace = "http://localhost:8080/XXXX/Authentification", wsdlLocation = "WEB-INF/wsdl/Authentification/XXXX/web_services/wsdl/Authentification.wsdl")
public class Authentification
{
public int authentifier(java.lang.String email, java.lang.String mdp)
{
int res = 0;
ProfilUtilisateur pu;
try
{
pu = ProfilUtilisateur.getProfilUtilisateurByEmail(email);
if (pu.getMdp().equals(mdp))
{
res = pu.getIdProfilUtilisateur();
}
}
catch (Exception ex)
{
return res = -1;
}
return res;
}
public boolean deconnecter(java.lang.String email)
{
throw new UnsupportedOperationException("Not implemented yet.");
}
} |
Dans mon code php, j'appelle le web service de la manière suivante :
1 2 3 4 5 6
| $authentificationWS = new Zend_Soap_Client();
$authentificationWS->setSoapVersion(SOAP_1_1);
$authentificationWS->setLocation('http://localhost:8080/XXXX/Authentification');
$authentificationWS->setUri('http://localhost:8080/XXXX/Authentification');
$authResult = $authentificationWS->authentifier(array('email' => 'test', 'mdp' => 'test')); |
Voici la requete soap :
1 2
| <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost:8080/XXXX/Authentification"><SOAP-ENV:Body><ns1:authentifier><param0><item><key>email</key><value>test</value></item><item><key>mdp</key><value>test</value></item></param0></ns1:authentifier></SOAP-ENV:Body></SOAP-ENV:Envelope> |
Et la réponse :
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:authentifierResponse xmlns:ns2="http://localhost:8080/XXXX/Authentification"><authentifierResult>-1</authentifierResult></ns2:authentifierResponse></S:Body></S:Envelope>
Avez-vous une idée ou tout du moins une piste pour expliquer le fait que la chaine reçue (email) par le ws soit vide ?
Merci d'avance.
Partager