PDA

View Full Version : [PHP+SOAP] Chiamata webservice aspx


il pupo
18-10-2012, 11:55
Ciao a tutti,
ho un grosso problema con un webservice (creato in aspx con DB Oracle)
praticamente quando faccio la chiamata (PHP utilizzando la classe nusoap) ottengo come risposta questo errore:
ORA-01008: not all variables bound

posto sia il codice PHP che il WSDL
chiamata PHP
<?
require_once('class/soap.php');
$client = new soapclient('http://XXXXXXXXXX/server.asmx');

$err = $client->getError();
if ($err) {
echo '<p><b>Constructor error: ' . $err . '</b></p>';
}
if ($client->fault) {
echo '<p><b>Fault: ';
print_r($result);
echo '</b></p>';
} else {
$err = $client->getError();
if ($err) {
echo '<p><b>Error: ' . $err . '</b></p>';
} else {

$param = array("dati" => "00000000000");
$result = $client->call(
'setDati',
array("setDati"=>$param),
'uri:setDati',
'http://tempuri.org/setDati'
);

echo "<pre>RESULT: ";
print_r($result);
echo "</pre>";
}
}

?>

WSDL

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="HelloWorld">
<s:complexType />
</s:element>
<s:element name="HelloWorldResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="setDati">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="dati" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="setDatiResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="setDatiResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
<wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
</wsdl:message>
<wsdl:message name="setDatiSoapIn">
<wsdl:part name="parameters" element="tns:setDati" />
</wsdl:message>
<wsdl:message name="setDatiSoapOut">
<wsdl:part name="parameters" element="tns:setDatiResponse" />
</wsdl:message>
<wsdl:portType name="PuntiFidelitySoap">
<wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:output message="tns:HelloWorldSoapOut" />
</wsdl:operation>
<wsdl:operation name="setDati">
<wsdl:input message="tns:setDatiSoapIn" />
<wsdl:output message="tns:setDatiSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PuntiFidelitySoap" type="tns:PuntiFidelitySoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setDati">
<soap:operation soapAction="http://tempuri.org/setDati" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="PuntiFidelitySoap12" type="tns:PuntiFidelitySoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="HelloWorld">
<soap12:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setDati">
<soap12:operation soapAction="http://tempuri.org/setDati" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PuntiFidelity">
<wsdl:port name="PuntiFidelitySoap" binding="tns:PuntiFidelitySoap">
<soap:address location="http://XXXXXXXXXX/server.asmx" />
</wsdl:port>
<wsdl:port name="PuntiFidelitySoap12" binding="tns:PuntiFidelitySoap12">
<soap12:address location="http://XXXXXXXXXX/server.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Cosa diavolo sbaglio?
Grazie per l'aiuto

idoido
18-10-2012, 12:02
l'errore che hai postato è di pl/sql, non sembra relativo all'invocazione tramite php (tranne se non sono stati inseriti correttamente i parametri, ma dal codice che vedo sembra sia ok)

il mio consiglio è quello di testare il webservice con un progetto .net windows forms semplicissimo e controllare che funzioni a dovere.