[Web Service] SoapFault exception: [HTTP] Unknown protocol.
Bonjour, bonjour,
Avant tout bonne année à tous :ccool:
Alors voila j'ai un petit problème de web service et j'arrive pas à trouver une solution, j'ai chercher et ca part dans tous les sens :
sur mon server :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
ini_set('soap.wsdl_cache_enabled',0);
$s= new SoapServer('./add.wsdl',array('uri'=>'http://devdam.in.ac-nancy-metz.fr/sos-signalement/',
'location' => 'http://devdam.in.ac-nancy-metz.fr/sos-signalement/'));
$s->addFunction('accueil');
$s->handle();
function accueil($contexte)
{ ..... } |
sur mon client
Code:
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
|
ini_set('soap.wsdl_cache_enabled',0);
$client = new SoapClient
(
'./add.wsdl',
array
(
'uri' => 'http://devdam.in.ac-nancy-metz.fr/sos-signalement/',
'location' => 'http://devdam.in.ac-nancy-metz.fr/sos-signalement/',
'trace' => 1,
'exceptions' => 0
)
);
try
{
$result = $client-> __soapCall('accueil', array('1'));
echo $result;
} catch (SoapFault $e)
{
echo "Error: {$e->faultstring}";
}
echo "<pre>\n";
echo "Request :\n".htmlspecialchars($client ->__getLastRequest()) ."\n";
echo "Response:\n".htmlspecialchars($client ->__getLastResponse())."\n";
echo "</pre>"; |
et mon fichier wdsl
Code:
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
|
<?xml version="1.0"?>
<definitions name="CSP"
targetNamespace="urn:CSP"
xmlns:tns="urn:CSP"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:typens="urn:CSP"
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 xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:CSP">
</xsd:schema>
</types>
<message name="entier">
<part name="entier" type="xsd:int"/>
</message>
<message name="caractere">
<part name="caractere" type="xsd:string"/>
</message>
<portType name="CspPorts">
<operation name="accueil">
<input message="entier"/>
<output message="caractere"/>
</operation>
</portType>
<binding name="MyBinding" type="typens:CspPorts">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="accueil">
<soap:operation soapAction="http://devdam.in.ac-nancy-metz.fr/sos-signalement/add.wsdl"/>
</operation>
</binding>
<service name="accueil">
<documentation>SOS</documentation>
<port name="CspPorts" binding="typens:MyBinding">
<soap:address location="http://devdam.in.ac-nancy-metz.fr/sos-signalement/index.php"/>
</port>
</service>
</definitions> |
Voilou alors quand je lance le serveur j'ai ce message :
Code:
1 2 3 4 5 6 7 8
|
SoapFault exception: [HTTP] Unknown protocol. Only http and https are allowed. in /appli/sos-signalement/www/testsoap.php:22 Stack trace: #0 [internal function]: SoapClient->__doRequest('__soapCall('accueil', Array) #2 {main}
Request :
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:accueil><entier>1</entier></SOAP-ENV:accueil></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response: |
la ligne 22 c'est celle ci :
Code:
1 2
|
$result = $client-> __soapCall('accueil', array('1')); |
et voila je vois pas pourquoi le serveur connais pas le protocole http :cfou: