Ce qui suit est mon webservice appeler 2 méthodes de DataClass (registerCustomer et getCountries):Ne pas obtenir les données de webservice
<!-- a string array req param, used as a return for the getAvailable cars method -->
<message name="response">
<part name="resParam" type="tns:strArray"/>
</message>
<!-- just a string message -->
<message name="request">
<part name="reqParam" type="xsd:string"/>
</message>
<!-- Methods published, together with there inputs and outputs -->
<portType name="testPortType">
<!-- Method 0. Takes nothing returns a string array -->
<operation name="getCountries">
<output message="tns:response"/>
</operation>
<!-- Method 1. Takes a string param and returns nothing -->
<operation name="registerCustomer">
<input message="tns:request"/>
</operation>
<!-- Method 2. Takes a string param and returns nothing -->
<operation name="">
<input message="tns:request"/>
</operation>
</portType>
<!-- define the transport and protocol -->
<binding name="testBinding" type="tns:testPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getCountries">
<soap:operation soapAction=""/>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:mymyInputNamespace"/>
</output>
</operation>
<operation name="registerCustomer">
<soap:operation soapAction=""/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:mymyInputNamespace"/>
</input>
</operation>
</binding>
<!-- who implements these services ? -->
<service name="testService">
<port name="testPort" binding="tns:testBinding">
<soap:address location="http://localhost/dataobjects/dataclass.php"/>
A partir de la page php ils ne sont pas accessibles et il me donne l'erreur suivante:
Fatal error: Call to undefined method SoapServer::getCountries() in C:\Program Files\xampplite\htdocs\testingpage.php on $dataset = $dataobj->getCountries();
$dataobj = new SoapServer("http://localhost/dataobjects/myWebservice.wsdl", array('soap_version' => SOAP_1_2,'trace' => 1));
$dataset = $dataobj->getCountries();
echo("<h2>Available Countries (".count($dataset)."):</h2><br />");
foreach($dataset as $c) {
echo($c.", ");
ai essayé comme vous me dit: essayer { \t $ service = "http: //localhost/dataobjects/myWebservice.wsdl"; \t $ dataobj = new SoapClient ($ service, tableau ('location' => "http: // localhost/dataobjects/myWebservice")); \t $ dataset = $ dataobj-> getCountries(); } catch (Exception $ e) {echo $ e; } maintenant il me donne une autre erreur: SoapFault exception: [Client] DTD ne sont pas supportés par SOAP dans C: \ Program Files \ xampplite \ htdocs \ testingpage.php: 13 Stack trace: # 0 [fonction interne]: SoapClient -> __ call ('getCountries', Array) # 1 C: \ Program Files \ xampplite \ htdocs \ testingpage.php (13): SoapClient-> getCountries() # 2 {main} – IanCian
Vous ne devez pas utiliser une DTD pour valider votre Message XML, utilisez plutôt un schéma XML (ou rien). –