Sto cercando di crere un piccolo e semplice web service con soap e php però quando cerco di farlo funzionare mi da l'errore in titolo qualcuno riesce ad aiutarmi??
il codice del client
Codice PHP:
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
ini_set('log_errors',1);
ini_set('log_errors_max_len',0);
ini_set('ignore_repeated_errors',0);
ini_set('ignore_repeated_source',0);
ini_set('report_memleaks',1);
ini_set('track_errors',1);
if(!extension_loaded("soap")){
dl("php_soap.dll");
}
ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("servizioorario.wsdl");
function GetTimbratura ($data){
$arr[]=array(
"id" => 1,
"data"=> "26/07/2013",
"orario"=>"8:45",
"permesso" => false,
"ferie" => false
);
return array($arr);
}
$server->AddFunction("GetTimbratura");
$server->handle();
?>
questo quello del server
Codice PHP:
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
ini_set('log_errors',1);
ini_set('log_errors_max_len',0);
ini_set('ignore_repeated_errors',0);
ini_set('ignore_repeated_source',0);
ini_set('report_memleaks',1);
ini_set('track_errors',1);
if(!extension_loaded("soap")){
dl("php_soap.dll");
}
ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("servizioorario.wsdl");
function GetTimbratura ($data){
$arr[]=array(
"id" => 1,
"data"=> "26/07/2013",
"orario"=>"8:45",
"permesso" => false,
"ferie" => false
);
return array($arr);
}
$server->AddFunction("GetTimbratura");
$server->handle();
?>
questo del wsdl
codice:
<?xml version="1.0"?>
<definitions name="WebOrario"
targetNamespace="urn:WebOrario"
xmlns:tns="urn:WebOrario"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema>
<xsd:complexType name='timbratura'>
<xsd:all>
<xsd:element name='id' type='xsd:int' />
<xsd:element name='data' type='xsd:string' />
<xsd:element name='orario' type='xsd:string' />
<xsd:element name='permesso' type='xsd:boolean' />
<xsd:element name='ferie' type='xsd:boolean' />
</xsd:all>
</xsd:complexType>
<!-- <xsd:complexType name='festivita'>
<xsd:all>
<xsd:element name='id' type='xsd:int' />
<xsd:element name='giorno' type='xsd:int' />
<xsd:element name='mese' type='xsd:int' />
<xsd:element name='descrizione' type='xsd:string' />
</xsd:all>
</xsd:complexType> -->
</xsd:schema>
</types>
<message name="GetTimbratura">
<part name="data" type="xsd:string" />
</message>
<message name="GetTimbraturaResponse">
<part name="return" type="tns:timbratura[]"/>
</message>
<portType name="TimbraturePort">
<operation name="GetTimbratura">
<input message="tns:GetTimbratura" />
<output message="tns:GetTimbraturaResponse" />
</operation>
</portType>
<binding name="TimbratureBinding" type="tns:TimbraturePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="GetTimbratura">
<soap:operation soapAction="urn:TimbratureAction" />
<input>
<soap:body use="encoded" namespace="urn:GetTimbratura" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:GetTimbratura" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="TimbratureService">
<port name="TimbraturePort" binding="tns:TimbratureBinding">
<soap:address location="http://osservatorio.energia.provincia.tn.it/applicativi/provasoap/serverorario.php" />
</port>
</service>
</definitions>
questo l'errore che mi restituisce
codice:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/weborario/servizioorario.wsdl' : failed to load external entity "http://localhost/weborario/servizioorario.wsdl" in C:\Users\pr41103\Desktop\Programmazione\xampp-183\xampp\htdocs\weborario\prova2\clientorario.php:18 Stack trace: #0 C:\Users\pr41103\Desktop\Programmazione\xampp-183\xampp\htdocs\weborario\prova2\clientorario.php(18): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in C:\Users\pr41103\Desktop\Programmazione\xampp-183\xampp\htdocs\weborario\prova2\clientorario.php on line 18
qualcuno sa darmi spiegazioni? sono nuovo dei web service....