[Web Service] client php web service
Bonjour,
J'ai un problème lors de l'appel de mon web service en java avec un client PHP .
Pour l'instant je n'utilise qu'une seule fonction la suivante :
Code:
1 2 3 4 5 6 7
|
public String sayHello(@WebParam(name = "parameter1")
String parameter1, @WebParam(name = "parameter2")
String parameter2) {
//TODO write your implementation code here:
return "HELLO :"+parameter1+"--"+parameter2;
} |
Le problème est que lorsque j'appelle ma fonction avec un client PHP,la methode retourne le resultats suivant
HELLO :null--null
Voici le code du client PHP:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
<?php
$wsdl='http://localhost:8080/WebServicephp/NewWebServicesayhelloService?WSDL';
$client = new soapclient($wsdl);
//creation du client
try {
$client = new SoapClient($wsdl);
$sku1 = 'test1';
$sku2 = 'test2';
$param = array("p1"=>$sku1, "p2"=>$sku2);
echo "parametres :".$sku1."-".$sku2;
print "<br>";
$result = $client->sayHello($param);
echo('Resultat: ');
echo $result->return;
}
catch(Exception $e){
echo "Error!<br />";
echo $e -> getMessage ();
}
?> |
Voici le WSDL
Code:
1 2
|
<definitions targetNamespace="http://sayHello/" name="NewWebServicesayhelloService"><types><xsd:schema><xsd:import namespace="http://sayHello/" schemaLocation="http://localhost:8080/WebServicephp/NewWebServicesayhelloService?xsd=1"/></xsd:schema></types><message name="sayHello"><part name="parameters" element="tns:sayHello"/></message><message name="sayHelloResponse"><part name="parameters" element="tns:sayHelloResponse"/></message><portType name="NewWebServicesayhello"><operation name="sayHello"><input wsam:Action="http://sayHello/NewWebServicesayhello/sayHelloRequest" message="tns:sayHello"/><output wsam:Action="http://sayHello/NewWebServicesayhello/sayHelloResponse" message="tns:sayHelloResponse"/></operation></portType><binding name="NewWebServicesayhelloPortBinding" type="tns:NewWebServicesayhello"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/><operation name="sayHello"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation></binding><service name="NewWebServicesayhelloService"><port name="NewWebServicesayhelloPort" binding="tns:NewWebServicesayhelloPortBinding"><soap:address location="http://localhost:8080/WebServicephp/NewWebServicesayhelloService"/></port></service></definitions> |
merci d'avance .