Salve,
riprendo questa conversazione. Sto cercando di seguire la procedura per attivare un'amica come esercente.
il problema è la chiamata SOAP.
intanto, avevo bisogno di farvi una domanda, questa "validazione" è obbligatoria, anche se un esercente non ha un negozio online? (non ci sto capendo molto)
utilizzando il codice che avete postato sopra, continuo a ritrovarmi con questo messaggio:
Could not connect to host
grazie per l'aiuto
object(SoapFault)#2 (9) { ["message":protected]=> string(25) "Could not connect to host" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(54) "cert.php" ["line":protected]=> int(25) ["trace":"Exception":private]=> array(3) { [0]=> array(4) { ["function"]=> string(11) "__doRequest" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(5) { [0]=> string(410) " 111aa22bbXXXXXXXXX" [1]=> string(78) "
https://ws.cartadeldocente.istruzione.it/VerificaVoucherDocWEB/VerificaVoucher" [2]=> string(42) "
http://bonus.miur.it/VerificaVoucher/Chec" [3]=> int(1) [4]=> int(0) } } [1]=> array(6) { ["file"]=> string(54) "cert.php" ["line"]=> int(25) ["function"]=> string(6) "__call" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(5) "Check" [1]=> array(1) { [0]=> array(1) { ["checkReq"]=> array(3) { ["tipoOperazione"]=> string(1) "1" ["codiceVoucher"]=> string(8) "11aa22bb" ["partitaIvaEsercente"]=> string(11) "XXXXXXXX" } } } } } [2]=> array(6) { ["file"]=> string(54) "cert.php" ["line"]=> int(25) ["function"]=> string(5) "Check" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> array(1) { ["checkReq"]=> array(3) { ["tipoOperazione"]=> string(1) "1" ["codiceVoucher"]=> string(8) "11aa22bb" ["partitaIvaEsercente"]=> string(11) "XXXXXXXXXX" } } } } } ["previous":"Exception":private]=> NULL ["faultstring"]=> string(25) "Could not connect to host" ["faultcode"]=> string(4) "HTTP" }
il codice:
<?php
$wsdl = "VerificaVoucher.wsdl";
$local_cert = "php_soap_cert.pem";
$location = "https://ws.cartadeldocente.istruzione.it/VerificaVoucherDocWEB/VerificaVoucher";
$password="XXXXXXXX";
$options = array(
'location' => $location,
'local_cert' => $local_cert,
'passphrase' => $password,
'stream_context' => stream_context_create(array(
'ssl' => array(
'verify_peer'=> false,
'verify_peer_name'=> false,
'allow_self_signed'=> true
)
))
);
$soapClient = new SoapClient($wsdl, $options);
try {
$result = $soapClient->Check(array("checkReq"=>array("tipoOperazione"=>"1","codiceVoucher"=>"11aa22bb","partitaIvaEsercente"=>"XXXXXXX")));
} catch(Exception $e) {
var_dump($e);
}
?>
file VerificaVoucher.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="VerificaVoucher" targetNamespace="http://bonus.miur.it/VerificaVoucher/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://bonus.miur.it/VerificaVoucher/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema targetNamespace="http://bonus.miur.it/VerificaVoucher/">
<xsd:complexType name="Check">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="tipoOperazione" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="codiceVoucher" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="partitaIvaEsercente" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CheckResponse">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="nominativoBeneficiario" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="partitaIvaEsercente" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="ambito" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="bene" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="importo" type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Confirm">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="tipoOperazione" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="codiceVoucher" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="importo" type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ConfirmResponse">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="esito" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="CheckRequestObj">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="checkReq" type="tns:Check"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CheckResponseObj">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="checkResp" type="tns:CheckResponse"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConfirmRequestObj">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="checkReq" type="tns:Confirm"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConfirmResponseObj">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="checkResp" type="tns:ConfirmResponse"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="CheckRequest">
<wsdl:part element="tns:CheckRequestObj" name="parameters"/>
</wsdl:message>
<wsdl:message name="CheckResponse">
<wsdl:part element="tns:CheckResponseObj" name="parameters"/>
</wsdl:message>
<wsdl:message name="ConfirmRequest">
<wsdl:part element="tns:ConfirmRequestObj" name="parameters"/>
</wsdl:message>
<wsdl:message name="ConfirmResponse">
<wsdl:part element="tns:ConfirmResponseObj" name="parameters"/>
</wsdl:message>
<wsdl:portType name="VerificaVoucher">
<wsdl:operation name="Check">
<wsdl:input message="tns:CheckRequest"/>
<wsdl:output message="tns:CheckResponse"/>
</wsdl:operation>
<wsdl:operation name="Confirm">
<wsdl:input message="tns:ConfirmRequest"/>
<wsdl:output message="tns:ConfirmResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="VerificaVoucherSOAP" type="tns:VerificaVoucher">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Check">
<soap:operation soapAction="http://bonus.miur.it/VerificaVoucher/Check"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Confirm">
<soap:operation soapAction="http://bonus.miur.it/VerificaVoucher/Confirm"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="VerificaVoucher">
<wsdl:port binding="tns:VerificaVoucherSOAP" name="VerificaVoucherSOAP">
<soap:address location="https://ws.cartadeldocente.istruzione.it/VerificaVoucherDocWEB/VerificaVoucher"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>